예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            AgendaBLL agendabll = new AgendaBLL();
            string    Opera     = Request.QueryString["Opera"];

            if (CheckValue())
            {
                if (Opera == "Add")
                {
                    //新增日程
                    MeetingModel.agenda agenda = new MeetingModel.agenda();
                    MID3             = int.Parse(Request.QueryString["MID2"]);
                    agenda.m_id      = MID3;
                    agenda.starttime = DateTime.Parse(txtStarttime.Text);
                    agenda.endtime   = DateTime.Parse(txtEndtime.Text);
                    agenda.detail    = txtDetail.Text;
                    if (agendabll.AddAgenda(agenda) > 0)
                    {
                        Response.Write("<script>alert('添加成功')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('添加失败')</script>");
                    }
                }
                else
                {
                    //更改日程信息
                    int agendanumber           = int.Parse(Request.QueryString["agendanumber"]);
                    MeetingModel.agenda agenda = agendabll.GetAgendaInfo(agendanumber);
                    //MID3 = int.Parse(Request.QueryString["MID2"]);
                    //agenda.m_id = MID3;
                    agenda.starttime = DateTime.Parse(txtStarttime.Text);
                    agenda.endtime   = DateTime.Parse(txtEndtime.Text);
                    agenda.detail    = txtDetail.Text;
                    if (agendabll.UpdateAgenda(agenda) > 0)
                    {
                        Response.Write("<script>alert('修改成功')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('修改失败')</script>");
                    }
                }
            }
        }
예제 #2
0
    }//end UpdateInstallationObject(x6)


    public void PopulateDateAndTimeUserControl(EmployeeBLL employee, DateTime selectedDate) {
        try {
            //get staff agenda
            SerializableDictionary<DateTime, DaySchedule> staffCalendar = employee.agenda.staffCalendar;

            //CHECK STAFF BUSY DAYS 
            // Use var keyword to enumerate dictionary. The same as: foreach (KeyValuePair<string, int> pair in calendar)
            //R    bool? isEmployeeBusy = AgendaBLL.IsStaffBusy(ref staffCalendar, selectedDate, selectedTime);//time is irrelevant here as this method is called to create this date on staff's calendar

            DaySchedule employeeDaySchedule = AgendaBLL.GetDaySchedule(ref staffCalendar, selectedDate);

            if (employeeDaySchedule != null) {
                //loop through day's time. ie: each hr and 1/h of the staff agenda
                foreach (var pair in employeeDaySchedule.daySchedule) {
                    int tempTime;
                    string tempTimeStatus;
                    tempTime = pair.Key;
                    tempTimeStatus = pair.Value;
                    System.Diagnostics.Debug.Print("Key: {0},  Value: {1}", tempTime, tempTimeStatus);
                    //check if staff is busy 
                    if (pair.Value == DaySchedule.GetDayStatusEnumString(DayStatusEnum.BUSY))
                        //set these on date&time usercontrol  
                        this.DateSelectionUserControl.DisableShowTimeCell(tempTime);
                }//endforloop
            }//endif
            else
                //staff daySchedule is empty so enable all buttons
                this.DateSelectionUserControl.EnableAllShowTimeCells();

            //update LabelServProvider
            this.LabelServProvider.Text = employee.firstName; //employee.title + " " + employee.firstName; 

        }//endtry
        catch (Exception ex) {
            System.Diagnostics.Debug.Print("<h2>BookAppt.aspx, PopulateDateAndTimeUserControl(x6)</h2>\n" + ex.ToString() + "\n" + ex.InnerException + "\n" + ex.Message);
            // Log the exception and notify system operators
            ExceptionUtility.LogException(ex, "BookAppt.aspx, PopulateDateAndTimeUserControl(x6)");
            ExceptionUtility.NotifySystemOps(ex);
        }
    }