예제 #1
0
        void Add()
        {
            //create an instance of TNovation
            clsEventCollection TNovation = new clsEventCollection();
            //validate the data on the webform
            Boolean OK = TNovation.ThisEvent.Valid(textBoxEventName.Text, textBoxCompanyName.Text,textBoxContact.Text, textBoxStartDate.Text, textBoxGuestSpeaker.Text, textBoxLocation.Text, textBoxTypeOfEvent.Text, textBoxConsultantAttending.Text);
            //if the data is OK then add it to the object
            if (OK == true)
            {
                //get the data entered by the user
                TNovation.ThisEvent.EventCode = Convert.ToInt32(textBoxEventCode.Text);
                TNovation.ThisEvent.EventName = textBoxEventName.Text;
                TNovation.ThisEvent.CompanyName = textBoxCompanyName.Text;

                TNovation.ThisEvent.Contact = textBoxContact.Text;
                TNovation.ThisEvent.StartDate = Convert.ToDateTime(textBoxStartDate.Text);
                TNovation.ThisEvent.GuestSpeaker = textBoxGuestSpeaker.Text;
                TNovation.ThisEvent.Location = textBoxLocation.Text;
                TNovation.ThisEvent.TypeOfEvent = textBoxTypeOfEvent.Text;
                TNovation.ThisEvent.ConsultantAttending = textBoxConsultantAttending.Text;
                //add the record
                TNovation.Add();
            }
            else
            {
                //report an error
               // lblError.Text = "There were problems with the data entered";
            }
        }
예제 #2
0
 Int32 DisplayEvents()
 {
     //create an instance of the event collection
     clsEventCollection Events = new clsEventCollection();
     //see the data source to the list of eventin the collection
     listBoxEvent.DataSource =Events.EventList;
     //set the name of the primary key value
     listBoxEvent.ValueMember = "EventCode";
     //set the data field to be displayed
     listBoxEvent.DisplayMember = "EventName";
     //return the count of records in the list
     return Events.Count;
 }
예제 #3
0
        void DeleteEvent()
        {
            //function to delete the selected record

            //create a new instance of the client book
            clsEventCollection TNovation = new clsEventCollection();
            //find the record to delete
            TNovation.ThisEvent.Find(EventCode);
            //delete the record
            TNovation.Delete();
        }