CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Assigning an Event ID to more than one User ID

Print topic Send  topic

Author Message
Vincent
Posted: 08/11/2005, 9:36 PM

Hi everyone,

I'm developing an Event Coodination System for a company. They want to be able to assign more than one presenter to one event, which basically means assigning multiple User_ID to one Event_ID. Any input on How to implement this with CCS 2.3?

Thank you.

Vincent
Vincent
Posted: 08/11/2005, 9:37 PM

I forgot, with classic ASP O:)

V
peterr


Posts: 5971
Posted: 08/12/2005, 2:16 AM

You may find similar solution in the Knowledge Base project/example - multiple products and categories can be assigned to each KB article. KB example can be requested at http://www.yessoftware.com/ccsprojects/indexkb.php , if you agree to the license/conditions.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Vincent
Posted: 08/15/2005, 8:24 AM

Ok, I don't have access to the knowledge base app. I've followed the link you sent me, but never received a confirmation email. Do you think you could give me an example instead? That will be wonderful.

Vincent
peterr


Posts: 5971
Posted: 08/15/2005, 12:52 PM

It depends on when you submitted your request, but you should receive a response within 12 hours.
Sorry I currently don't have time to analyze, dissect and describe steps needed to implement that example.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Vincent
Posted: 08/15/2005, 3:29 PM

No worries Peter, I understand. Thank you.

Vincent
charles
Posted: 08/17/2005, 5:45 AM

I think you can start by creating a table with event_id and presenter_id as compound primary keys.
You can then link a grid form based on your presenter table with a record form based on this event/presenter table .
That way you can add as many presenters to an event as possible.
It is similar to assigning more than one employee to a task in the codecharge studio example.
best of luck
Vincent
Posted: 08/22/2005, 9:03 AM

I took a look a the taskman example, you cannot assign more than one employee per task or am I missing something here?
peterr


Posts: 5971
Posted: 08/22/2005, 12:00 PM

Of course you cannot... Tasks should always be assigned to one person. If not one person is responsible for a task then no one is responsible. How can you manage tasks without assigning responsibility?
However, you can develop any system you want with CCS. The example is just that - an example with a lot of features missing.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Vincent
Posted: 08/22/2005, 1:41 PM

Peter,

I don't get your answer. Charles sent me to the taskman example. I'm not an idiot :-) of course you can't do this I realized that, I was trying to see if maybe charles was referring to an updated version of the taskman example. I never took this example as a full apllication but as ..... an example you are right ;-) The fact that a task should be assigned to one person is besides the point here but anyway... I'm just a little bit frustrated here. Peter, you know CCS pretty well and I can understand that sometimes you must think that some of us are stupid. CCS seems really to be a great tool, the learning curve can be time consuming sometimes though. At that point I will be done if I had coded this thing by hand. I was just trying to implement this with CCS as a lot of pages have been generated with it... oh well
peterr


Posts: 5971
Posted: 08/22/2005, 2:23 PM

Sorry if my answer wasn't appropriate. I haven't linked your question to Charles' answer. Now I suspect that he was referring to these examples in CCS Example Pack, outside of the Task Manager:
http://examples.codecharge.com/ExamplePack/ManyToManyCh...anyCheckbox.php
http://examples.codecharge.com/ExamplePack/ManyToManyLi...nyListboxes.php
http://examples.codecharge.com/ExamplePack/ManyToManyLi...ManyListbox.php
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
Vincent
Posted: 08/22/2005, 3:33 PM

Thank you Peter, it seems to be what Charles was talking about. My apologies to you also as my answer was a little rough. I'm french, and sometimes the French side comes out of me ;-)
Vincent
Posted: 08/22/2005, 10:13 PM

Hello,

I took the "Updating Many-to-Many relations via two listboxes" example to recreate a similar situation. Instead of having Projects, Employees and project_employees I have Events, Presenter and Events_Assigned.

I followed the step by step instructions to recreate the page, the only thing that I don't seem to get working is the RightButton and LeftButton. Everytime I try to assign an event to presenters, I'm loosing the event_Id querystring parameter which on the example is emp_id.

Can Somebody point at me what I'm doing wrong maybe that will be greatly appreciated.

Table: Events
Event_id
Event_name

Table: Presenters
PresenterID
PresenterLName
PresenterFName

Table: Events_Assigned
Event_ID
Presenter_ID


HTML Code:
<html>  
<head>  
<title>Events_Assignment</title>  
<link rel="stylesheet" type="text/css" href="Themes/InLine/Style.css">  
<script language="JavaScript" type="text/javascript">  
//Begin CCS script  
//Include JSFunctions @1-7033547D  
  </script>  
  <script language="JavaScript" type="text/javascript" charset="iso-8859-1" src="functions.js"></script>  
  <script language="JavaScript" type="text/javascript">  
    
//End Include JSFunctions  
  
//page_events1_RightButton_OnClick @20-8D56A9BD  
function page_events1_RightButton_OnClick()  
{  
    var result;  
//End page_events1_RightButton_OnClick  
  
//Custom Code @27-2A29BDB7  
  
 var AvailableLB = document.getElementById("available");  
 var LinkedLB = document.getElementById("linked");  
 for (var i=0; i < AvailableLB.length; i++) {  
   if (AvailableLB.options.selected == true) {  
       LinkedLB.options[LinkedLB.length] =   
       new Option(AvailableLB.options.text, AvailableLB.options.value);  
       AvailableLB.options = null;  
       i=i-1;  
   }  
 }  
  
//End Custom Code  
  
//Close page_events1_RightButton_OnClick @20-BC33A33A  
    return result;  
}  
//End Close page_events1_RightButton_OnClick  
  
//page_events1_LeftButton_OnClick @21-DF5E0A2F  
function page_events1_LeftButton_OnClick()  
{  
    var result;  
//End page_events1_LeftButton_OnClick  
  
//Custom Code @28-2A29BDB7  
   
 var AvailableLB = document.getElementById("available");  
 var LinkedLB = document.getElementById("linked");  
 for (var i=0; i < LinkedLB.length; i++) {  
   if (LinkedLB.options.selected == true) {  
      AvailableLB.options[AvailableLB.length] =   
	  new Option(LinkedLB.options.text, LinkedLB.options.value);  
      LinkedLB.options = null;  
      i=i-1;  
   }  
 }  
  
//End Custom Code  
  
//Close page_events1_LeftButton_OnClick @21-BC33A33A  
    return result;  
}  
//End Close page_events1_LeftButton_OnClick  
  
//page_events1_OnSubmit @12-5AE93307  
function page_events1_OnSubmit()  
{  
    var result;  
//End page_events1_OnSubmit  
  
//Custom Code @29-2A29BDB7  
  
 var LinkedLB = document.getElementById("linked");  
 document.events1.LinkedID.value = ""  
 for (i=0; i<LinkedLB.options.length; i++) {  
    if (document.events1.LinkedID.value != "" ) {  
        document.events1.LinkedID.value = document.events1.LinkedID.value + ","  
	}  
	document.events1.LinkedID.value = document.events1.LinkedID.value + LinkedLB.options.value  
 }  
  
//End Custom Code  
  
//Close page_events1_OnSubmit @12-BC33A33A  
    return result;  
}  
//End Close page_events1_OnSubmit  
  
//page_events1_Button_Delete_OnClick @15-D0C8D936  
function page_events1_Button_Delete_OnClick()  
{  
    disableValidation = true;  
}  
//End page_events1_Button_Delete_OnClick  
  
//bind_events @1-8C6DD01B  
function bind_events() {  
    if (document.forms["events1"]) check_and_bind('document.forms["events1"]','onsubmit',page_events1_OnSubmit);  
    if (document.forms["events1"]) check_and_bind('document.forms["events1"].LeftButton','onclick',page_events1_LeftButton_OnClick);  
    if (document.forms["events1"]) check_and_bind('document.forms["events1"].RightButton','onclick',page_events1_RightButton_OnClick);  
    if (document.forms["events1"]) check_and_bind('document.forms["events1"].Button_Delete','onclick',page_events1_Button_Delete_OnClick);  
    forms_onload();  
}  
//End bind_events  
  
window.onload = bind_events; //Assign bind_events @1-19F7B649  
  
//End CCS script</script>  
{Header} <br>  
<table width="100%" border="1">  
  <tr>  
    <td>    
      <!-- BEGIN Grid events --><font class="InLineFormHeaderFont">List of  
      Events </font>   
      <table class="InLineFormTABLE" cellspacing="0" cellpadding="3">  
        <tr>  
          <td class="InLineColumnTD" nowrap>  
            <!-- BEGIN Sorter Sorter_event_id --><a class="InLineSorterLink" href="{Sort_URL}">Id</a>   
            <!-- BEGIN Asc_On --><img src="Themes/InLine/AscOn.gif" border="0"><!-- END Asc_On -->  
            <!-- BEGIN Desc_On --><img src="Themes/InLine/DescOn.gif" border="0"><!-- END Desc_On --><!-- END Sorter Sorter_event_id --> </td>   
          <td class="InLineColumnTD" nowrap>  
            <!-- BEGIN Sorter Sorter_event_name --><a class="InLineSorterLink" href="{Sort_URL}">Name</a>   
            <!-- BEGIN Asc_On --><img src="Themes/InLine/AscOn.gif" border="0"><!-- END Asc_On -->  
            <!-- BEGIN Desc_On --><img src="Themes/InLine/DescOn.gif" border="0"><!-- END Desc_On --><!-- END Sorter Sorter_event_name --> </td>   
        </tr>  
   
        <!-- BEGIN Row -->  
        <tr>  
          <td class="InLineDataTD">{event_id} </td>   
          <td class="InLineDataTD"><a class="InLineDataLink" href="{event_name_Src}">{event_name}</a> </td>   
        </tr>  
 <!-- END Row -->  
        <!-- BEGIN NoRecords -->  
        <tr>  
          <td class="InLineDataTD" colspan="2">No records </td>   
        </tr>  
 <!-- END NoRecords -->  
        <tr>  
          <td class="InLineFooterTD" nowrap colspan="2"><a class="InLineDataLink" href="{Link1_Src}">Add  
            New</a>   
            <!-- BEGIN Navigator Navigator -->  
            <!-- BEGIN First_On --><a class="InLineNavigatorLink" href="{First_URL}">First</a> <!-- END First_On -->  
            <!-- BEGIN First_Off -->First <!-- END First_Off -->  
            <!-- BEGIN Prev_On --><a class="InLineNavigatorLink" href="{Prev_URL}">Prev</a> <!-- END Prev_On -->  
            <!-- BEGIN Prev_Off -->Prev <!-- END Prev_Off -->    
            <!-- BEGIN Pages -->  
            <!-- BEGIN Page_On --><a class="InLineNavigatorLink" href="{Page_URL}">{Page_Number}</a> <!-- END Page_On -->  
            <!-- BEGIN Page_Off -->{Page_Number} <!-- END Page_Off --><!-- END Pages -->of  
            {Total_Pages}    
            <!-- BEGIN Next_On --><a class="InLineNavigatorLink" href="{Next_URL}">Next</a> <!-- END Next_On -->  
            <!-- BEGIN Next_Off -->Next <!-- END Next_Off -->  
            <!-- BEGIN Last_On --><a class="InLineNavigatorLink" href="{Last_URL}">Last</a> <!-- END Last_On -->  
            <!-- BEGIN Last_Off -->Last <!-- END Last_Off --><!-- END Navigator Navigator -->  </td>   
        </tr>  
   
      </table>  
 <!-- END Grid events --></td>   
    <td>    
      <!-- BEGIN Record events1 -->  
      <form name="{HTMLFormName}" action="{Action}" method="post">  
        <font class="InLineFormHeaderFont">Add/Edit Events </font>   
        <table class="InLineFormTABLE" cellspacing="0" cellpadding="3">  
          <!-- BEGIN Error -->  
          <tr>  
            <td class="InLineErrorDataTD" colspan="2">{Error}</td>   
          </tr>  
 <!-- END Error -->  
          <tr>  
            <td class="InLineFieldCaptionTD">Name </td>   
            <td class="InLineDataTD"><input class="InLineInput" maxlength="250" size="50" value="{event_name}" name="{event_name_Name}"> </td>   
          </tr>  
   
          <tr>  
            <td class="InLineFieldCaptionTD" colspan="2">  
              <table width="100%">  
                <tr>  
                  <td>    
                    <select class="InLineSelect" name="{AvailableListBox_Name}" multiple size="8" id="available">  
  {AvailableListBox_Options} </select>  
 </td>   
                  <td>    
                    <!-- BEGIN Button RightButton --><input class="InLineButton" type="submit" value=">>" name="{Button_Name}"><!-- END Button RightButton --><br>  
                    <br>  
                    <!-- BEGIN Button LeftButton --><input class="InLineButton" type="submit" value="<<" name="{Button_Name}"><!-- END Button LeftButton --></td>   
                  <td>    
                    <select class="InLineSelect" name="{LinkedListBox_Name}" multiple size="8" id="linked">  
  {LinkedListBox_Options} </select>  
 </td>   
                </tr>  
   
              </table>  
 <input type="hidden" value="{LinkedID}" name="{LinkedID_Name}"></td>   
          </tr>  
   
          <tr>  
            <td class="InLineFooterTD" nowrap align="right" colspan="2">  
              <!-- BEGIN Button Button_Insert --><input class="InLineButton" type="submit" value="Add" name="{Button_Name}"><!-- END Button Button_Insert -->  
              <!-- BEGIN Button Button_Update --><input class="InLineButton" type="submit" value="Submit" name="{Button_Name}"><!-- END Button Button_Update -->  
              <!-- BEGIN Button Button_Delete --><input class="InLineButton" type="submit" value="Delete" name="{Button_Name}"><!-- END Button Button_Delete -->  </td>   
          </tr>  
   
        </table>  
   
      </form>  
 <!-- END Record events1 --></td>   
  </tr>  
</table>  
<br>  
{Footer}  
</body>  
</html>

Vincent
Posted: 08/22/2005, 10:14 PM

Here is the Events_Assigned_events.asp code:
<%  
'BindEvents Method @1-8CA0CB01  
Sub BindEvents()  
    Set events1.AvailableListBox.DataSource.CCSEvents("BeforeBuildSelect") = GetRef("events1_AvailableListBox_DataSource_BeforeBuildSelect")  
    Set events1.CCSEvents("AfterInsert") = GetRef("events1_AfterInsert")  
    Set events1.CCSEvents("AfterUpdate") = GetRef("events1_AfterUpdate")  
    Set events1.CCSEvents("BeforeDelete") = GetRef("events1_BeforeDelete")  
End Sub  
'End BindEvents Method  
  
Function events1_AvailableListBox_DataSource_BeforeBuildSelect() 'events1_AvailableListBox_DataSource_BeforeBuildSelect @18-F2574D28  
  
'Custom Code @30-73254650  
' -------------------------  
Dim PresenterConnection  
Dim PresenterRecordSet  
Dim LinkedPresenter  
  
'Populate multi-selectable project CheckBox list  
 If CCGetFromGet("event_id",0) <> 0 Then  
  
   'Create a new database connection object  
   Set PresenterConnection = New clsDBREALsMs  
   PresenterConnection.Open  
   Set PresenterRecordSet = PresenterConnection.Execute("SELECT Presenter_ID FROM Events_Assigned WHERE Event_ID =" & PresenterConnection.ToSQL(CCGetFromGet("Event_ID", 0),ccsInteger))  
   While NOT PresenterRecordSet.EOF  
     If Not IsEmpty(LinkedPresenter) Then LinkedPresenter = LinkedPresenter&","  
     LinkedPresenter = LinkedPresenter&PresenterRecordSet("Presenter_ID")  
     PresenterRecordSet.MoveNext  
   Wend  
     
   'Close and destroy the recordset  
   PresenterRecordSet.Close  
   Set PresenterRecordSet = Nothing  
  
   'Close and destroy the database connection object  
   PresenterConnection.Close  
   Set PresenterConnection = Nothing  
 End If  
  
   'Modify the Where clause of the AvailableListBox List Box  
   If NOT IsEmpty(LinkedPresenter) Then  
	events1.AvailableListBox.DataSource.Where = "PresenterID NOT IN (" &LinkedPresenter& ")"  
   End If    
  
' -------------------------  
'End Custom Code  
  
End Function 'Close events1_AvailableListBox_DataSource_BeforeBuildSelect @18-54C34B28  
  
Function EventPresentersModify(Actions)   
Dim EventPresentersConn  
Dim EventID  
Dim PresenterID  
Dim PresenterList  
Dim GetLastInsKey  
  
  'Create a new database connection object  
  Set EventPresentersConn = New clsDBREALsMs  
  EventPresentersConn.Open  
  
  'Retrieve current project  
  EventID = Request.QueryString("event_id")  
  PresenterList = Split(Request.Form("LinkedID"),",")  
  
  If Actions = "Insert" Then  
     'Retrieve the last inserted key  
     'Use MS SQL method  
     ' GetLastInsKey = CCDLookup("@@IDENTITY","events","",DBREALsMs)  
     'Use a method compatible with all databases (unsafe when multiple users insert records at the same time)  
     GetLastInsKey = CCDLookup("max(event_id)", "events", "", DBREALsMs)  
     'Insert New links  
     For Each PresenterID In PresenterList  
       EventPresentersConn.Execute("INSERT INTO Events_Assigned (Presenter_ID, Event_ID) VALUES (" & EventPresentersConn.ToSQL(PresenterID,ccsInteger) & "," & EventPresentersConn.ToSQL(GetLastInsKey,ccsInteger) & ")")  
     Next  
  End If   
  If EventID > 0 Then  
    If Actions = "Delete" Or Actions = "Update" Then  
       'Delete project employees links  
       EventPresentersConn.Execute("DELETE FROM Events_Assigned WHERE Event_ID=" & EventPresentersConn.ToSQL(EventID,ccsInteger))  
    End If   
    If Actions = "Update" Then  
       'Insert assigned employees  
       For Each PresenterID In PresenterList  
         EventPresentersConn.Execute("INSERT INTO Events_Assigned (Presenter_ID, Event_ID) VALUES (" & EventPresentersConn.ToSQL(PresenterID,ccsInteger) & "," & EventPresentersConn.ToSQL(EventID,ccsInteger) & ")")  
       Next  
    End If   
  End If   
  
  'Close and destroy the database connection object  
  EventPresentersConn.Close  
  Set EventPresentersConn = Nothing  
  
End Function  
  
Function events1_AfterInsert() 'events1_AfterInsert @12-FEA7C1F1  
  
'Custom Code @31-73254650  
' -------------------------  
  EventPresentersModify("Insert")  
' -------------------------  
'End Custom Code  
  
End Function 'Close events1_AfterInsert @12-54C34B28  
  
Function events1_AfterUpdate() 'events1_AfterUpdate @12-318E007E  
  
'Custom Code @32-73254650  
' -------------------------  
  EventPresentersModify("Update")  
' -------------------------  
'End Custom Code  
  
End Function 'Close events1_AfterUpdate @12-54C34B28  
  
Function events1_BeforeDelete() 'events1_BeforeDelete @12-0538E30D  
  
'Custom Code @33-73254650  
' -------------------------  
 EventPresentersModify("Delete")  
' -------------------------  
'End Custom Code  
  
End Function 'Close events1_BeforeDelete @12-54C34B28  
  
  
%>  

Thank You,

Vincent
Vincent
Posted: 08/22/2005, 10:24 PM

:-< I didn't realize that the code portion was going to be displayed so big, messing up at the same time the layout. I'm sorry about this.

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.