예제 #1
0
 private void submitButton_Click(object sender, System.EventArgs e)
 {
     if (this.IsValid)
     {
         String attendees = "";
         foreach (ListItem attendee in attendeeList.Items)
         {
             if (attendee.Selected)
             {
                 attendees += attendee.Text + " (" + attendee.Value + "), ";
             }
         }
         attendees += " and " + nameBox.Text;
         String dateString =
             calendar.SelectedDate.Date.Date.ToShortDateString();
         Service1 dataService = new Service1();
         int queryResult = dataService.AddEvent(eventBox.Text,
             roomList.SelectedItem.Value,
             attendees,
             dateString);
         if (queryResult == 1)
         {
             resultLabel.Text = "Event Added.";
             ds = dataService.GetData();
             Application.Lock();
             Application["ds"] = ds;
             Application.UnLock();
             eventTable = ds.Tables["Events"];
             calendar.SelectedDate =
                 getFreeDate(calendar.SelectedDate.AddDays(1));
             eventDetails1.DataSource = eventTable;
             eventDetails1.DataBind();
             eventDetails2.DataSource = eventTable;
             eventDetails2.DataBind();
         }
         else
         {
             resultLabel.Text = "Event not added due to DB access problem.";
         }
     }
 }
예제 #2
0
 protected void Application_Start(Object sender, EventArgs e)
 {
     Service1 dataService = new Service1();
     DataSet ds = dataService.GetData();
     Application["ds"] = ds;
 }