示例#1
0
 protected void LoadCalendar()
 {
     try
     {
         if (Session["CalendarStartDate"] == null)
         {
             Session["CalendarStartDate"] = firstDayOfWeek(DateTime.Now, DayOfWeek.Sunday);
         }
         if (Session["BusinessBeginsHour"] == null)
         {
             Session["BusinessBeginsHour"] = 9;
         }
         if (Session["BusinessEndsHour"] == null)
         {
             Session["BusinessEndsHour"] = 18;
         }
         //DayPilotCalendar1.Attributes.Add("cellDuration", "15");
         DayPilotCalendar1.BusinessBeginsHour = (int)Session["BusinessBeginsHour"];
         DayPilotCalendar1.BusinessEndsHour   = (int)Session["BusinessEndsHour"];
         DayPilotCalendar1.StartDate          = (DateTime)Session["CalendarStartDate"];
         Session["CalendarData"] = CalendarData.GetData(ddlLocation.SelectedValue, ddlConsultant.SelectedValue, DayPilotCalendar1.StartDate, DayPilotCalendar1.StartDate.AddDays(7));
         table = (DataTable)Session["CalendarData"];
         DayPilotCalendar1.DataSource = table;
         DataBind();
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#2
0
        protected void UpdateAppointmentTime(string id, DateTime start, DateTime end)
        {
            try
            {
                long lid;

                if (long.TryParse(id, out lid))
                {
                    CalendarData.MoveAppointment(lid, start, end);

                    LoadCalendar();

                    DataRow dr = table.Rows.Find(id);

                    if (dr != null)
                    {
                        dr["start"] = start;
                        dr["end"]   = end;
                        table.AcceptChanges();
                    }

                    Session["CalendarData"] = table;
                    DayPilotCalendar1.DataBind();
                    DayPilotCalendar1.Update();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }