Пример #1
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            if (Label1.Text != "Invalid Selection" && Label2.Text != "Invalid Selection")
            {
                int DeptID = (int)HttpContext.Current.Session["DeptID"];

                int      EmpID = Convert.ToInt32(SelectStaffDropDownList.SelectedValue);
                DateTime start = Convert.ToDateTime(Label1.Text);
                DateTime end   = Convert.ToDateTime(Label2.Text);
                if (SupplierBizLogic.IsDuplicate(DeptID, start, end))
                {
                    Response.Write("<script>alert('The selected dates already assigned !');</script>");
                    Label1.Text            = "";
                    Label2.Text            = "";
                    Label3.Text            = "";
                    Label4.Text            = "";
                    Calendar1.SelectedDate = DateTime.Now.Date;
                    SelectStaffDropDownList.SelectedIndex = 0;
                    DateRadioButtonList.SelectedIndex     = 0;
                    count = 0;
                }
                else
                {
                    SupplierBizLogic.CreateDelegation(EmpID, start, end, DeptID);
                    Response.Write("<script>alert('Job Delegated !');</script>");
                    Label1.Text            = "";
                    Label2.Text            = "";
                    Label3.Text            = "";
                    Label4.Text            = "";
                    Calendar1.SelectedDate = DateTime.Now.Date;
                    SelectStaffDropDownList.SelectedIndex = 0;
                    DateRadioButtonList.SelectedIndex     = 0;
                }
            }
            else
            {
                Response.Write("<script>alert('Invalid Selection');</script>");
            }
        }