Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int servicewinid = 0;
            BindDropCustomer();

            if (Request.QueryString.Count != 0)
            {
                servicewinid = Convert.ToInt16(Request.QueryString[0]);
            }
            if (servicewinid != 0)
            {
                BindDropDown();
                objSerWindow = objSerWindow.Get_By_serviceid(servicewinid);
                int varSiteId = objSerWindow.Siteid;
                drpSites.SelectedValue = Convert.ToString(varSiteId);
                DisplayServiceWindow(varSiteId);
            }
            else
            {
                reqValSite.ErrorMessage = Resources.MessageResource.errSelectSite.ToString();

                BindDropDown();

                DefaultSetting();
            }
        }
    }
Example #2
0
    protected void drpSites_SelectedIndexChanged(object sender, EventArgs e)
    {
        int varSiteId;

        varSiteId = Convert.ToInt16(drpSites.SelectedValue);

        objSerWindow = objSerWindow.Get_By_id(varSiteId);
        if (objSerWindow.Siteid != 0)
        {
            DefaultSetting();
            lblErrorMsg.Font.Bold       = true;
            lblErrorMsg.Text            = "The Following are the Service Window Parameters for this Site";
            lblErrorMsgWorkingDays.Text = "";
            lblErrorMsgWorkingTime.Text = "";
            DisplayServiceWindow(varSiteId);
        }

        else
        {
            DefaultSetting();
            lblErrorMsg.Font.Bold       = true;
            lblErrorMsg.Text            = "Service Window is not set for this Site";
            lblErrorMsgWorkingDays.Text = "";
            lblErrorMsgWorkingTime.Text = "";
        }
    }
Example #3
0
    protected void DisplayServiceWindow(int varSiteId)
    {
        objSerWindow = objSerWindow.Get_By_id(varSiteId);
        if (objSerWindow.Siteid != 0)
        {
            objSerHours = objSerHours.Get_By_id(objSerWindow.Servicewindowid);
            if (objSerHours.Servicewindowid != 0)
            {
                if (objSerHours.Starthour == 0 && objSerHours.Startmin == 15 && objSerHours.Endhour == 23 && objSerHours.Endmin == 45)
                {
                    rdbtn24hr.Checked   = true;
                    rdbtnSelect.Checked = false;
                }
                else
                {
                    rdbtn24hr.Checked          = false;
                    rdbtnSelect.Checked        = true;
                    drpStarthour.SelectedValue = Convert.ToString(objSerHours.Starthour);
                    drpStartmin.SelectedValue  = Convert.ToString(objSerHours.Startmin);
                    drpEndhr.SelectedValue     = Convert.ToString(objSerHours.Endhour);
                    drpEndmin.SelectedValue    = Convert.ToString(objSerHours.Endmin);
                }
            }

            colServiceDay = objSerDay.Get_All_By_Id(objSerWindow.Servicewindowid);
            foreach (ServiceDay_mst service in colServiceDay)
            {
                string varServiceDay;
                varServiceDay = service.Weekday.ToString();
                if (varServiceDay == "Monday")
                {
                    if (service.Isworking == true)
                    {
                        chkMonday.Checked = true;
                    }
                    else
                    {
                        chkMonday.Checked = false;
                    }
                }
                if (varServiceDay == "Tuesday")
                {
                    if (service.Isworking == true)
                    {
                        chkTuesday.Checked = true;
                    }
                    else
                    {
                        chkTuesday.Checked = false;
                    }
                }
                if (varServiceDay == "Wednesday")
                {
                    if (service.Isworking == true)
                    {
                        chkWednesday.Checked = true;
                    }
                    else
                    {
                        chkWednesday.Checked = false;
                    }
                }

                if (varServiceDay == "Thursday")
                {
                    if (service.Isworking == true)
                    {
                        chkThursday.Checked = true;
                    }
                    else
                    {
                        chkThursday.Checked = false;
                    }
                }

                if (varServiceDay == "Friday")
                {
                    if (service.Isworking == true)
                    {
                        chkFriday.Checked = true;
                    }
                    else
                    {
                        chkFriday.Checked = false;
                    }
                }

                if (varServiceDay == "Saturday")
                {
                    if (service.Isworking == true)
                    {
                        chkSaturday.Checked = true;
                    }
                    else
                    {
                        chkSaturday.Checked = false;
                    }
                }

                if (varServiceDay == "Sunday")
                {
                    if (service.Isworking == true)
                    {
                        chkSunday.Checked = true;
                    }
                    else
                    {
                        chkSunday.Checked = false;
                    }
                }
            }
        }
        else
        {
            DefaultSetting();
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        // Declare local variable varsiteid,FlagInsertSla and FlagStatus
        int varsiteid;
        ServiceWindow_mst objservicewindow = new ServiceWindow_mst();

        varsiteid = Convert.ToInt16(drpSites.SelectedValue);
        int count = objservicewindow.Get_ServiceWindow_By_Siteid(varsiteid);

        if (count >= 1)
        {
            int  FlagInsertSla;
            int  FlagStatus;
            bool FlagEscalateLevel1 = true;
            bool FlagEscalateLevel2 = true;
            bool FlagEscalateLevel3 = true;
            lblErrorTimeSelect.Text = "";
            if (txtDays.Text == "0" && drphr.SelectedValue == "0" && drpMin.SelectedValue == "0")
            {
                lblErrorTimeSelect.Text = Resources.MessageResource.errResTime.ToString();
            }
            else
            {
                if (chkLevel1.Checked == true)
                {
                    if (radio1Level1.Checked == true)
                    {
                        int varTotalTime       = calculateTotalminutes();
                        int varTotalTimeLevel1 = calculateTotalminutesLevel1();
                        if (varTotalTimeLevel1 > varTotalTime)
                        {
                            FlagEscalateLevel1 = false;
                        }
                    }
                    if (radio2Level1.Checked == true)
                    {
                        int varTotalTime       = calculateTotalminutes();
                        int varTotalTimeLevel1 = calculateTotalminutesLevel1();
                        if (varTotalTimeLevel1 == 0)
                        {
                            FlagEscalateLevel1 = false;
                        }
                    }
                }
                if (chkLevel2.Checked == true)
                {
                    if (radio1Level2.Checked == true)
                    {
                        int varTotalTime       = calculateTotalminutes();
                        int varTotalTimeLevel2 = calculateTotalminutesLevel2();
                        if (varTotalTimeLevel2 > varTotalTime)
                        {
                            FlagEscalateLevel2 = false;
                        }
                    }
                    if (radio2Level2.Checked == true)
                    {
                        int varTotalTime       = calculateTotalminutes();
                        int varTotalTimeLevel2 = calculateTotalminutesLevel2();
                        if (varTotalTimeLevel2 == 0)
                        {
                            FlagEscalateLevel2 = false;
                        }
                    }
                }

                if (chkLevel3.Checked == true)
                {
                    if (radio1Level3.Checked == true)
                    {
                        int varTotalTime       = calculateTotalminutes();
                        int varTotalTimeLevel3 = calculateTotalminutesLevel3();
                        if (varTotalTimeLevel3 > varTotalTime)
                        {
                            FlagEscalateLevel3 = false;
                        }
                    }

                    if (radio2Level3.Checked == true)
                    {
                        int varTotalTime       = calculateTotalminutes();
                        int varTotalTimeLevel3 = calculateTotalminutesLevel3();
                        if (varTotalTimeLevel3 == 0)
                        {
                            FlagEscalateLevel3 = false;
                        }
                    }
                }

                // get sitetd from dropdown to variable varsiteid

                // Check SLA Definition is exist in database with same name and site
                objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid);
                // Check SLA Priority definition is exist in databse with siteid and priorityid
                objSlaPriority = objSlaPriority.Get_By_Siteid(varsiteid, Convert.ToInt16(drpPriority.SelectedValue));
                // if both objSla.Siteid and objSlaPriority.Slaid is zero then,No SLA Definition is exist in database
                if (objSla.Siteid == 0 && objSlaPriority.Slaid == 0)
                {
                    if (FlagEscalateLevel1 == true && FlagEscalateLevel2 == true && FlagEscalateLevel3 == true)
                    {
                        objSla.Siteid         = varsiteid;
                        objSla.Slaname        = txtSlaName.Text.ToString().Trim();
                        objSla.Createdatetime = DateTime.Now.ToString();
                        objSla.Enable         = true;
                        objSla.Description    = txtDescription.Text.ToString().Trim();
                        // Call objSla.Insert() to insert records in database
                        FlagInsertSla = objSla.Insert();
                        // If FlagInsertSla is 1 then record insert in database successfully
                        if (FlagInsertSla == 1)
                        {
                            // Call Function objSla.Get_By_SLAName() to get Slaid of created sla
                            objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid);

                            if (objSla.Siteid != 0)
                            {
                                // declare local variable FlagInsertPriority
                                int FlagInsertPriority;
                                objSlaPriority.Slaid           = objSla.Slaid;
                                objSlaPriority.Siteid          = varsiteid;
                                objSlaPriority.Priorityid      = Convert.ToInt16(drpPriority.SelectedValue);
                                objSlaPriority.Resolutiondays  = Convert.ToInt16(txtDays.Text);
                                objSlaPriority.Resolutionhours = Convert.ToInt16(drphr.SelectedValue);
                                objSlaPriority.Resolutionmin   = Convert.ToInt16(drpMin.SelectedValue);
                                // Call function objSlaPriority.Insert() to insert records in SLA_Priority_mst
                                FlagInsertPriority = objSlaPriority.Insert();
                                // if FlagInsertPriority is not zero then records insert successfully
                                if (FlagInsertPriority != 0)
                                {
                                    //lblErrorMsg.Text = Resources.MessageResource.errSLADef.ToString();



                                    if (chkLevel1.Checked == true)
                                    {
                                        InsertIntoLevel1(objSla.Slaid);
                                    }
                                    if (chkLevel2.Checked == true)
                                    {
                                        InsertIntoLevel2(objSla.Slaid);
                                    }
                                    if (chkLevel3.Checked == true)
                                    {
                                        InsertIntoLevel3(objSla.Slaid);
                                    }

                                    Clear();
                                    Response.Redirect("~/admin/viewsla.aspx");
                                    //CheckDefaultValueForEscalation();
                                }
                                else
                                {
                                    // Call objSla.Delete to delete record from SLA_mst to delete sla definition,because some error occurred in SLA_Priority_mst
                                    objSla.Delete(objSla.Slaid);
                                    // Display Error message some error occurred
                                    lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString();
                                }
                            }
                        }
                    }
                    else
                    {
                        if (FlagEscalateLevel1 == false)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.strLevel1.ToString();
                        }
                        if (FlagEscalateLevel2 == false)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.strLevel2.ToString();
                        }
                        if (FlagEscalateLevel3 == false)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.strLevel3.ToString();
                        }
                    }
                }
                else
                {
                    lblErrorMsg.Text = Resources.MessageResource.errSLAExist.ToString();
                }
            }
        }
        else
        {
            lblErrorMsg.Text = "Service Window not set for this Site,Set the Service Window for this Site";
        }
    }
Example #5
0
    // Handler btnSave_click to handle event
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblErrorMsgWorkingTime.Text = "";
        lblErrorMsgWorkingDays.Text = "";
        // Declare local variables FlagStartEndTime and FlagDaysCheck and varSiteId and FlagInsert
        int FlagStartEndTime = 0;
        int FlagDaysCheck    = 0;
        int varSiteId;
        int FlagInsert;
        // Declare locl variables starthr,startmin,endhr and endmin
        int starthr, startmin, endhr, endmin;

        // Check radio button 24 hr has checked
        if (rdbtn24hr.Checked == true)
        {
            starthr  = 0;
            startmin = 1;
            endhr    = 23;
            endmin   = 59;
        }
        // Select other check box
        else
        {
            starthr  = Convert.ToInt16(drpStarthour.SelectedValue);
            startmin = Convert.ToInt16(drpStartmin.SelectedValue);
            endhr    = Convert.ToInt16(drpEndhr.SelectedValue);
            endmin   = Convert.ToInt16(drpEndmin.SelectedValue);
        }

        // Check Start time Should be less than End Time
        if (rdbtn24hr.Checked == true)
        {
            FlagStartEndTime = 1;
        }
        else
        {
            // Check condition start hour  shoild less than End hour
            if (starthr < endhr)
            {
                FlagStartEndTime = 1;
            }
            // Check condition start hour and end hour is equal,then start min should less than End min
            else if (starthr == endhr && startmin < endmin)
            {
                FlagStartEndTime = 1;
            }
            else
            {
                FlagStartEndTime = 0;
            }
        }


        // Check At Least one Working Days has been Selected
        if (chkMonday.Checked == false && chkTuesday.Checked == false && chkWednesday.Checked == false && chkThursday.Checked == false && chkFriday.Checked == false && chkSaturday.Checked == false && chkSunday.Checked == false)
        {
            FlagDaysCheck = 0;
        }
        else
        {
            FlagDaysCheck = 1;
        }
        // If FlagStartEndTime is zeros then display error message,start time should less than end time
        if (FlagStartEndTime == 0)
        {
            lblErrorMsgWorkingTime.Text = Resources.MessageResource.errWorkingTime.ToString();
            lblErrorMsg.Text            = "";
        }
        // If FlagDaysCheck is zeros then display error message,select at least one check box
        if (FlagDaysCheck == 0)
        {
            lblErrorMsgWorkingDays.Text = Resources.MessageResource.errWorkingDays.ToString();
            lblErrorMsg.Text            = "";
        }

        // If FlagStartEndTime is one and FlagDaysCheck is one then
        if (FlagStartEndTime == 1 && FlagDaysCheck == 1)
        {
            // Declare local variable varSiteId
            varSiteId = Convert.ToInt16(drpSites.SelectedValue);
            // to get the object objSerWindow by calling function Get_By_id(varSiteId)
            objSerWindow = objSerWindow.Get_By_id(varSiteId);
            // If objSerWindow.Siteid  is not zero then object exist
            if (objSerWindow.Siteid == 0)
            {
                objSerWindow.Siteid = varSiteId;
                FlagInsert          = objSerWindow.Insert();
                // If Flag Insert is 1,then inser operation performed successfully
                if (FlagInsert == 1)
                {
                    // Definition of Service hours insertion -Start
                    // Declare local variable
                    int FlagHrInsert;
                    int FlagDayInsert;

                    objSerWindow = objSerWindow.Get_By_id(varSiteId);
                    objSerHours.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerHours.Starthour       = starthr;
                    objSerHours.Startmin        = startmin;
                    objSerHours.Endhour         = endhr;
                    objSerHours.Endmin          = endmin;
                    FlagHrInsert = objSerHours.Insert();
                    // Definition of Service hours insertion -End

                    // Definition of Service Day insertion -Start

                    // find  which check box has been selected
                    if (chkMonday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Monday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Monday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    if (chkTuesday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Tuesday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Tuesday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    if (chkWednesday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Wednesday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Wednesday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    if (chkThursday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Thursday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Thursday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    if (chkFriday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Friday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Friday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    if (chkSaturday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Saturday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Saturday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    if (chkSunday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Sunday";
                        objSerDay.Isworking       = true;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday         = "Sunday";
                        objSerDay.Isworking       = false;
                        FlagDayInsert             = objSerDay.Insert();
                    }
                    // if FlagHrInsert and FlagDayInsert is one ie data hase been inserted successfully
                    if (FlagHrInsert == 1 && FlagDayInsert == 1)
                    {
                        lblErrorMsg.Text = Resources.MessageResource.errServiceWindParm.ToString();
                    }
                    else
                    {
                        objSerDay.Delete(objSerWindow.Servicewindowid);
                        objSerHours.Delete(objSerWindow.Servicewindowid);
                        objSerWindow.Delete(objSerWindow.Servicewindowid);
                        lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString();
                    }


                    // Definition of Service Day insertion -End
                }
                else
                {
                    lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString();
                }
            }
            else
            {
                // Definition of Service hours Update -Start
                int FlagHrUpdate;
                int FlagDayUpdate;

                objSerWindow = objSerWindow.Get_By_id(varSiteId);
                objSerHours.Servicewindowid = objSerWindow.Servicewindowid;
                objSerHours.Starthour       = starthr;
                objSerHours.Startmin        = startmin;
                objSerHours.Endhour         = endhr;
                objSerHours.Endmin          = endmin;
                FlagHrUpdate = objSerHours.Update();
                // Definition of Service hours Update -End


                // Definition of Service Day Updation -Start

                if (chkMonday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Monday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Monday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (chkTuesday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Tuesday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Tuesday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (chkWednesday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Wednesday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Wednesday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (chkThursday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Thursday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Thursday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (chkFriday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Friday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Friday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (chkSaturday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Saturday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Saturday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (chkSunday.Checked == true)
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Sunday";
                    objSerDay.Isworking       = true;
                    FlagDayUpdate             = objSerDay.Update();
                }
                else
                {
                    objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerDay.Weekday         = "Sunday";
                    objSerDay.Isworking       = false;
                    FlagDayUpdate             = objSerDay.Update();
                }
                if (FlagHrUpdate == 1 && FlagDayUpdate == 1)
                {
                    lblErrorMsg.Text = Resources.MessageResource.errServiceWindParm.ToString();
                }



                // Definition of Service Day insertion -End
            }
            if (Request.QueryString.Count != 0)
            {
                Response.Redirect("~/admin/ViewServiceWindow.aspx");
            }
        }
    }
 public int Update_ServiceWindow_mst_By_id(ServiceWindow_mst objServiceWindow)
 {
     return (int)ExecuteNonQuery(Sp_ServiceWindow_Update, new object[] { objServiceWindow.Siteid, objServiceWindow.Servicewindowid });
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        // Declare local variable varsiteid,FlagInsertSla and FlagStatus
        int varsiteid;
        ServiceWindow_mst objservicewindow = new ServiceWindow_mst();
        varsiteid = Convert.ToInt16(drpSites.SelectedValue);
        int count = objservicewindow.Get_ServiceWindow_By_Siteid(varsiteid);
        if (count >= 1)
        {
            int FlagInsertSla;
            int FlagStatus;
            bool FlagEscalateLevel1 = true;
            bool FlagEscalateLevel2 = true;
            bool FlagEscalateLevel3 = true;
            lblErrorTimeSelect.Text = "";
            if (txtDays.Text == "0" && drphr.SelectedValue == "0" && drpMin.SelectedValue == "0")
            {
                lblErrorTimeSelect.Text = Resources.MessageResource.errResTime.ToString();
            }
            else
            {

                if (chkLevel1.Checked == true)
                {
                    if (radio1Level1.Checked == true)
                    {
                        int varTotalTime = calculateTotalminutes();
                        int varTotalTimeLevel1 = calculateTotalminutesLevel1();
                        if (varTotalTimeLevel1 > varTotalTime)
                        { FlagEscalateLevel1 = false; }
                    }
                    if (radio2Level1.Checked == true)
                    {
                        int varTotalTime = calculateTotalminutes();
                        int varTotalTimeLevel1 = calculateTotalminutesLevel1();
                        if (varTotalTimeLevel1 ==0)
                        { FlagEscalateLevel1 = false; }
                    }

                }
                if (chkLevel2.Checked == true)
                {
                    if (radio1Level2.Checked == true)
                    {
                        int varTotalTime = calculateTotalminutes();
                        int varTotalTimeLevel2 = calculateTotalminutesLevel2();
                        if (varTotalTimeLevel2 > varTotalTime)
                        { FlagEscalateLevel2 = false; }
                    }
                    if (radio2Level2.Checked == true)
                    {
                        int varTotalTime = calculateTotalminutes();
                        int varTotalTimeLevel2 = calculateTotalminutesLevel2();
                        if (varTotalTimeLevel2 == 0)
                        { FlagEscalateLevel2 = false; }
                    }

                }

                if (chkLevel3.Checked == true)
                {
                    if (radio1Level3.Checked == true)
                    {
                        int varTotalTime = calculateTotalminutes();
                        int varTotalTimeLevel3 = calculateTotalminutesLevel3();
                        if (varTotalTimeLevel3 > varTotalTime)
                        { FlagEscalateLevel3 = false; }
                    }

                    if (radio2Level3.Checked == true)
                    {
                        int varTotalTime = calculateTotalminutes();
                        int varTotalTimeLevel3 = calculateTotalminutesLevel3();
                        if (varTotalTimeLevel3 == 0)
                        { FlagEscalateLevel3 = false; }
                    }

                }

                // get sitetd from dropdown to variable varsiteid

                // Check SLA Definition is exist in database with same name and site
                objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid);
                // Check SLA Priority definition is exist in databse with siteid and priorityid
                objSlaPriority = objSlaPriority.Get_By_Siteid(varsiteid, Convert.ToInt16(drpPriority.SelectedValue));
                // if both objSla.Siteid and objSlaPriority.Slaid is zero then,No SLA Definition is exist in database
                if (objSla.Siteid == 0 && objSlaPriority.Slaid == 0)
                {

                    if (FlagEscalateLevel1 == true && FlagEscalateLevel2 == true && FlagEscalateLevel3 == true)
                    {

                        objSla.Siteid = varsiteid;
                        objSla.Slaname = txtSlaName.Text.ToString().Trim();
                        objSla.Createdatetime = DateTime.Now.ToString();
                        objSla.Enable = true;
                        objSla.Description = txtDescription.Text.ToString().Trim();
                        // Call objSla.Insert() to insert records in database
                        FlagInsertSla = objSla.Insert();
                        // If FlagInsertSla is 1 then record insert in database successfully
                        if (FlagInsertSla == 1)
                        {
                            // Call Function objSla.Get_By_SLAName() to get Slaid of created sla
                            objSla = objSla.Get_By_SLAName(txtSlaName.Text.ToString().Trim(), varsiteid);

                            if (objSla.Siteid != 0)
                            {
                                // declare local variable FlagInsertPriority
                                int FlagInsertPriority;
                                objSlaPriority.Slaid = objSla.Slaid;
                                objSlaPriority.Siteid = varsiteid;
                                objSlaPriority.Priorityid = Convert.ToInt16(drpPriority.SelectedValue);
                                objSlaPriority.Resolutiondays = Convert.ToInt16(txtDays.Text);
                                objSlaPriority.Resolutionhours = Convert.ToInt16(drphr.SelectedValue);
                                objSlaPriority.Resolutionmin = Convert.ToInt16(drpMin.SelectedValue);
                                // Call function objSlaPriority.Insert() to insert records in SLA_Priority_mst
                                FlagInsertPriority = objSlaPriority.Insert();
                                // if FlagInsertPriority is not zero then records insert successfully
                                if (FlagInsertPriority != 0)
                                {
                                    //lblErrorMsg.Text = Resources.MessageResource.errSLADef.ToString();

                                    if (chkLevel1.Checked == true)
                                    {
                                        InsertIntoLevel1(objSla.Slaid);
                                    }
                                    if (chkLevel2.Checked == true)
                                    {
                                        InsertIntoLevel2(objSla.Slaid);
                                    }
                                    if (chkLevel3.Checked == true)
                                    {
                                        InsertIntoLevel3(objSla.Slaid);
                                    }

                                    Clear();
                                    Response.Redirect("~/admin/viewsla.aspx");
                                    //CheckDefaultValueForEscalation();
                                }
                                else
                                {
                                    // Call objSla.Delete to delete record from SLA_mst to delete sla definition,because some error occurred in SLA_Priority_mst
                                    objSla.Delete(objSla.Slaid);
                                    // Display Error message some error occurred
                                    lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString();
                                }

                            }

                        }
                    }
                    else
                    {
                        if (FlagEscalateLevel1 == false)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.strLevel1.ToString();

                        }
                        if (FlagEscalateLevel2 == false)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.strLevel2.ToString();

                        }
                        if (FlagEscalateLevel3 == false)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.strLevel3.ToString();

                        }

                    }
                }
                else
                {

                    lblErrorMsg.Text = Resources.MessageResource.errSLAExist.ToString();
                }
            }
        }
        else
        {
            lblErrorMsg.Text = "Service Window not set for this Site,Set the Service Window for this Site";
        }
    }
    public CollectionBase GenerateViewServiceWindow_mstCollection(ref IDataReader returnData)
    {
        BLLCollection<ServiceWindow_mst> col = new BLLCollection<ServiceWindow_mst>();
        while (returnData.Read())
        {
            ServiceWindow_mst obj = new ServiceWindow_mst();
            obj.Servicewindowid = (int)returnData["Servicewindowid"];
            obj.Siteid = (int)returnData["Siteid"];
            col.Add(obj);
        }

        returnData.Close();
        returnData.Dispose();
        return col;
    }
 public int Insert_ServiceWindow_mst(ServiceWindow_mst objServiceWindow)
 {
     return (int)ExecuteNonQuery(Sp_ServiceWindow_Insert, new object[] { objServiceWindow.Siteid, objServiceWindow.Servicewindowid });
 }
    public object GenerateServiceWindow_mstObject(ref IDataReader returnData)
    {
        ServiceWindow_mst obj = new ServiceWindow_mst();
        while (returnData.Read())
        {

            obj.Servicewindowid = (int)returnData["Servicewindowid"];
            obj.Siteid = (int)returnData["Siteid"];

        }
        returnData.Close();
        returnData.Dispose();
        return obj;
    }
    // Handler btnSave_click to handle event
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblErrorMsgWorkingTime.Text = "";
        lblErrorMsgWorkingDays.Text = "";
        // Declare local variables FlagStartEndTime and FlagDaysCheck and varSiteId and FlagInsert
        int FlagStartEndTime=0;
        int FlagDaysCheck = 0;
        int varSiteId;
        int FlagInsert;
        // Declare locl variables starthr,startmin,endhr and endmin
        int starthr, startmin, endhr, endmin;
        // Check radio button 24 hr has checked
        if (rdbtn24hr.Checked == true)
        {
            starthr = 0;
            startmin = 1;
            endhr = 23;
            endmin = 59;
        }
            // Select other check box
        else
        {
            starthr = Convert.ToInt16(drpStarthour.SelectedValue);
            startmin = Convert.ToInt16(drpStartmin.SelectedValue);
            endhr = Convert.ToInt16(drpEndhr.SelectedValue);
            endmin = Convert.ToInt16(drpEndmin.SelectedValue);
        }

        // Check Start time Should be less than End Time
        if (rdbtn24hr.Checked == true)
        {
            FlagStartEndTime = 1;

        }
        else
        {
            // Check condition start hour  shoild less than End hour
            if (starthr < endhr)
                {
                FlagStartEndTime = 1;

                }
           // Check condition start hour and end hour is equal,then start min should less than End min
              else if (starthr == endhr && startmin < endmin)
              {
                  FlagStartEndTime = 1;
              }
              else { FlagStartEndTime = 0; }
        }

        // Check At Least one Working Days has been Selected
        if (chkMonday.Checked == false && chkTuesday.Checked == false && chkWednesday.Checked == false && chkThursday.Checked == false && chkFriday.Checked == false && chkSaturday.Checked == false && chkSunday.Checked == false)
        {
            FlagDaysCheck = 0;

        }
        else
        {
            FlagDaysCheck = 1;

        }
        // If FlagStartEndTime is zeros then display error message,start time should less than end time
        if(FlagStartEndTime==0)
        {
            lblErrorMsgWorkingTime.Text = Resources.MessageResource.errWorkingTime.ToString();
            lblErrorMsg.Text = "";
        }
        // If FlagDaysCheck is zeros then display error message,select at least one check box
        if (FlagDaysCheck == 0)
        {
            lblErrorMsgWorkingDays.Text = Resources.MessageResource.errWorkingDays.ToString();
            lblErrorMsg.Text = "";
        }

        // If FlagStartEndTime is one and FlagDaysCheck is one then
        if (FlagStartEndTime == 1 && FlagDaysCheck == 1)
        {

            // Declare local variable varSiteId
            varSiteId = Convert.ToInt16(drpSites.SelectedValue);
            // to get the object objSerWindow by calling function Get_By_id(varSiteId)
            objSerWindow = objSerWindow.Get_By_id(varSiteId);
            // If objSerWindow.Siteid  is not zero then object exist
            if (objSerWindow.Siteid == 0)
                {
                    objSerWindow.Siteid = varSiteId;
                    FlagInsert = objSerWindow.Insert();
                // If Flag Insert is 1,then inser operation performed successfully
                if (FlagInsert == 1)
                    {
                        // Definition of Service hours insertion -Start
                       // Declare local variable
                        int FlagHrInsert;
                        int FlagDayInsert;

                        objSerWindow = objSerWindow.Get_By_id(varSiteId);
                        objSerHours.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerHours.Starthour = starthr;
                        objSerHours.Startmin = startmin;
                        objSerHours.Endhour = endhr;
                        objSerHours.Endmin = endmin;
                        FlagHrInsert = objSerHours.Insert();
                        // Definition of Service hours insertion -End

                        // Definition of Service Day insertion -Start

                    // find  which check box has been selected
                    if (chkMonday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Monday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Monday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        if (chkTuesday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Tuesday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Tuesday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        if (chkWednesday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Wednesday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Wednesday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        if (chkThursday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Thursday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Thursday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        if (chkFriday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Friday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Friday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        if (chkSaturday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Saturday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Saturday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        if (chkSunday.Checked == true)
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Sunday";
                            objSerDay.Isworking = true;
                            FlagDayInsert = objSerDay.Insert();
                        }
                        else
                        {
                            objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                            objSerDay.Weekday = "Sunday";
                            objSerDay.Isworking = false;
                            FlagDayInsert = objSerDay.Insert();

                        }
                        // if FlagHrInsert and FlagDayInsert is one ie data hase been inserted successfully
                        if (FlagHrInsert == 1 && FlagDayInsert == 1)
                        {
                            lblErrorMsg.Text = Resources.MessageResource.errServiceWindParm.ToString();

                        }
                        else
                        {
                            objSerDay.Delete(objSerWindow.Servicewindowid);
                            objSerHours.Delete(objSerWindow.Servicewindowid);
                            objSerWindow.Delete(objSerWindow.Servicewindowid);
                            lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString();

                        }

                        // Definition of Service Day insertion -End

                    }
                    else
                    {
                        lblErrorMsg.Text = Resources.MessageResource.errOccured.ToString();
                    }

                }
                else
                {

                    // Definition of Service hours Update -Start
                    int FlagHrUpdate;
                    int FlagDayUpdate;

                    objSerWindow = objSerWindow.Get_By_id(varSiteId);
                    objSerHours.Servicewindowid = objSerWindow.Servicewindowid;
                    objSerHours.Starthour = starthr;
                    objSerHours.Startmin = startmin;
                    objSerHours.Endhour = endhr;
                    objSerHours.Endmin = endmin;
                    FlagHrUpdate = objSerHours.Update();
                    // Definition of Service hours Update -End

                    // Definition of Service Day Updation -Start

                    if (chkMonday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Monday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Monday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (chkTuesday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Tuesday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Tuesday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (chkWednesday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Wednesday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Wednesday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (chkThursday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Thursday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Thursday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (chkFriday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Friday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Friday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (chkSaturday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Saturday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Saturday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (chkSunday.Checked == true)
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Sunday";
                        objSerDay.Isworking = true;
                        FlagDayUpdate = objSerDay.Update();
                    }
                    else
                    {
                        objSerDay.Servicewindowid = objSerWindow.Servicewindowid;
                        objSerDay.Weekday = "Sunday";
                        objSerDay.Isworking = false;
                        FlagDayUpdate = objSerDay.Update();

                    }
                    if (FlagHrUpdate == 1 && FlagDayUpdate == 1)
                    {
                        lblErrorMsg.Text = Resources.MessageResource.errServiceWindParm.ToString();

                    }

                    // Definition of Service Day insertion -End

                }
            if (Request.QueryString.Count != 0)
            {
                Response.Redirect("~/admin/ViewServiceWindow.aspx");
            }

        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int servicewinid = 0;
            BindDropCustomer();

            if (Request.QueryString.Count  != 0)
            {
               servicewinid = Convert.ToInt16(Request.QueryString[0]);
            }
            if (servicewinid != 0)
            {
                BindDropDown();
                objSerWindow = objSerWindow.Get_By_serviceid(servicewinid);
                int varSiteId = objSerWindow.Siteid;
                drpSites.SelectedValue = Convert.ToString(varSiteId);
                DisplayServiceWindow(varSiteId);
            }
            else
            {
                reqValSite.ErrorMessage = Resources.MessageResource.errSelectSite.ToString();

                BindDropDown();

                DefaultSetting();
            }
        }
    }
    protected void drpSites_SelectedIndexChanged(object sender, EventArgs e)
    {
        int varSiteId;
        varSiteId = Convert.ToInt16(drpSites.SelectedValue);

        objSerWindow = objSerWindow.Get_By_id(varSiteId);
        if (objSerWindow.Siteid != 0)
        {
            DefaultSetting();
            lblErrorMsg.Font.Bold = true;
            lblErrorMsg.Text = "The Following are the Service Window Parameters for this Site";
            lblErrorMsgWorkingDays.Text = "";
            lblErrorMsgWorkingTime.Text = "";
            DisplayServiceWindow(varSiteId);

        }

        else
        {
            DefaultSetting();
            lblErrorMsg.Font.Bold = true;
            lblErrorMsg.Text = "Service Window is not set for this Site";
            lblErrorMsgWorkingDays.Text = "";
            lblErrorMsgWorkingTime.Text = "";

        }
    }
    protected void DisplayServiceWindow(int varSiteId)
    {
        objSerWindow = objSerWindow.Get_By_id(varSiteId);
        if (objSerWindow.Siteid != 0)
        {
            objSerHours = objSerHours.Get_By_id(objSerWindow.Servicewindowid);
            if (objSerHours.Servicewindowid != 0)
            {

                if (objSerHours.Starthour == 0 && objSerHours.Startmin == 15 && objSerHours.Endhour == 23 && objSerHours.Endmin == 45)
                {
                    rdbtn24hr.Checked = true;
                    rdbtnSelect.Checked = false;
                }
                else
                {
                    rdbtn24hr.Checked = false;
                    rdbtnSelect.Checked = true;
                    drpStarthour.SelectedValue = Convert.ToString(objSerHours.Starthour);
                    drpStartmin.SelectedValue = Convert.ToString(objSerHours.Startmin);
                    drpEndhr.SelectedValue = Convert.ToString(objSerHours.Endhour);
                    drpEndmin.SelectedValue = Convert.ToString(objSerHours.Endmin);

                }

            }

            colServiceDay = objSerDay.Get_All_By_Id(objSerWindow.Servicewindowid);
            foreach (ServiceDay_mst service in colServiceDay)
            {
                string varServiceDay;
                varServiceDay = service.Weekday.ToString();
                if (varServiceDay == "Monday")
                {
                    if (service.Isworking == true)
                    {
                        chkMonday.Checked = true;

                    }
                    else
                    {
                        chkMonday.Checked = false;

                    }

                }
                if (varServiceDay == "Tuesday")
                {
                    if (service.Isworking == true)
                    {
                        chkTuesday.Checked = true;

                    }
                    else
                    {
                        chkTuesday.Checked = false;

                    }

                }
                if (varServiceDay == "Wednesday")
                {
                    if (service.Isworking == true)
                    {
                        chkWednesday.Checked = true;

                    }
                    else
                    {
                        chkWednesday.Checked = false;

                    }

                }

                if (varServiceDay == "Thursday")
                {
                    if (service.Isworking == true)
                    {
                        chkThursday.Checked = true;

                    }
                    else
                    {
                        chkThursday.Checked = false;

                    }

                }

                if (varServiceDay == "Friday")
                {
                    if (service.Isworking == true)
                    {
                        chkFriday.Checked = true;

                    }
                    else
                    {
                        chkFriday.Checked = false;

                    }

                }

                if (varServiceDay == "Saturday")
                {
                    if (service.Isworking == true)
                    {
                        chkSaturday.Checked = true;

                    }
                    else
                    {
                        chkSaturday.Checked = false;

                    }

                }

                if (varServiceDay == "Sunday")
                {
                    if (service.Isworking == true)
                    {
                        chkSunday.Checked = true;

                    }
                    else
                    {
                        chkSunday.Checked = false;

                    }

                }

            }

        }
        else
        {
            DefaultSetting();

        }
    }