コード例 #1
0
 protected void drpCategory_SelectedIndexChanged1(object sender, EventArgs e)
 {
     if ((drpCategory.SelectedIndex == 1) || (drpCategory.SelectedIndex == 2) || (drpCategory.SelectedIndex == 3))
     {
         trOptions.Visible   = true;
         chblOptions.Enabled = true;
         drpLocation.Enabled = true;
         LocationHandler locH = new LocationHandler();
         drpLocation.DataSource     = locH.GetLocationListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
         drpLocation.DataTextField  = "name";
         drpLocation.DataValueField = "name";
         drpLocation.DataBind();
         drpLocation.Items.Insert(0, "انتخاب کنید");
         OptionHandler opt = new OptionHandler();
         optlist = opt.GetOptionListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
         chblOptions.DataSource     = optlist;
         chblOptions.DataTextField  = "name";
         chblOptions.DataValueField = "ID";
         chblOptions.DataBind();
     }
     else
     {
         trOptions.Visible   = false;
         chblOptions.Enabled = false;
         drpLocation.Enabled = false;
     }
 }
コード例 #2
0
 protected void drpCategory_SelectedIndexChanged1(object sender, EventArgs e)
 {
     if ((drpCategory.SelectedIndex == 1) || (drpCategory.SelectedIndex == 2) || (drpCategory.SelectedIndex == 3))
     {
         if (drpCategory.SelectedIndex == 1)
         {
             txtCapacity.Text     = 1.ToString();
             txtCapacity.ReadOnly = true;
         }
         else
         {
             txtCapacity.ReadOnly = false;
         }
         LocationHandler locH    = new LocationHandler();
         List <Location> loclist = locH.GetLocationListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
         if (loclist != null)
         {
             drpLocation.Enabled        = true;
             drpLocation.DataSource     = loclist;
             drpLocation.DataTextField  = "name";
             drpLocation.DataValueField = "ID";
             drpLocation.DataBind();
             drpLocation.Items.Insert(0, "انتخاب کنید");
         }
         else
         {
             drpLocation.ClearSelection();
             drpLocation.Enabled = false;
         }
         OptionHandler opt = new OptionHandler();
         optlist = opt.GetOptionListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
         if (optlist != null)
         {
             trOptions.Visible          = true;
             chblOptions.Enabled        = true;
             chblOptions.DataSource     = optlist;
             chblOptions.DataTextField  = "name";
             chblOptions.DataValueField = "ID";
             chblOptions.DataBind();
         }
         else
         {
             trOptions.Visible   = false;
             chblOptions.Enabled = false;
         }
     }
     else
     {
         trOptions.Visible   = false;
         chblOptions.Enabled = false;
         drpLocation.Enabled = false;
     }
 }
コード例 #3
0
        protected void grdRequestList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int reqId = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "checkReq")
            {
                hdnfReqId.Value = reqId.ToString();

                //List<ResourceControl.Entity.Resource> resList = new List<ResourceControl.Entity.Resource>();
                ResourceHandler rsh = new ResourceHandler();

                RequestHandler requestHandler = new RequestHandler();
                var            requestDetails = requestHandler.GetRequestDetails(reqId);

                _resList = requestDetails.Status > 1 ? rsh.GetResourceListByReqIDForAfterAccept(reqId) : rsh.GetResourceListByReqID(reqId);

                ViewState.Add("reqId", reqId);
                ViewState.Add("_resList", _resList);

                if (drpRequestTypeList.SelectedIndex == 0)
                {
                    drpCandidateResource.DataSource     = _resList;
                    drpCandidateResource.DataTextField  = "name";
                    drpCandidateResource.DataValueField = "ID";
                    drpCandidateResource.DataBind();
                    drpCandidateResource.Items.Insert(0, new ListItem {
                        Value = "0", Text = "انتخاب کنید..."
                    });

                    dvOperation.Visible       = true;
                    dvOperation1.Visible      = true;
                    dvSuggestResource.Visible = true;
                }
                else
                {
                    dvOperation.Visible       = false;
                    dvOperation1.Visible      = false;
                    dvSuggestResource.Visible = false;
                }

                if (drpRequestTypeList.SelectedIndex == 5)
                {
                    dvOperation.Visible  = false;
                    dvOperation1.Visible = false;
                }

                grdDateTime.EditIndex = -1;
                RequestDateTimeHandler rqdateTimeH = new RequestDateTimeHandler();
                _dateTimeList          = rqdateTimeH.GetDateTimeListByRequestId(reqId);
                grdDateTime.DataSource = _dateTimeList.OrderBy(c => c.Date);
                grdDateTime.DataBind();



                lblRequestNumber.Text = requestDetails.ID.ToString();
                lblIssuerName.Text    = requestDetails.IssuerName.ToString();
                lblCourseName.Text    = requestDetails.CourseName.ToString();



                string scrp = "function f(){$find(\"" + RadWindow1.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true);
            }

            if (e.CommandName == "deny")
            {
                hdnfDenyReqId.Value = reqId.ToString();

                string scrp = "function f(){$find(\"" + RadWindow2.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true);
            }

            if (e.CommandName == "edit")
            {
                Response.Redirect("UserEditRequest.aspx?id=" + generaterandomstr() + "@A" + "0" + "-" + generaterandomstr() + "&reqId=" + e.CommandArgument);
            }

            if (e.CommandName == "History")
            {
                CommonBusiness cmb = new CommonBusiness();

                lst_history.DataSource = cmb.GetUserLogByModifyId(int.Parse(e.CommandArgument.ToString()), 11);
                lst_history.DataBind();

                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
            }
            if (e.CommandName == "showInfo")
            {
                #region ShowInfo

                hdnfReqId.Value = reqId.ToString();
                RequestHandler rh         = new RequestHandler();
                GridViewRow    curruntRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                imgStatus2.ImageUrl = ((Image)curruntRow.Cells[2].FindControl("imgStatus")).ImageUrl;
                var requestDetails = rh.GetRequestDetails(reqId);
                lblRequestId.Text     = requestDetails.ID.ToString();
                lblDarkhast.Text      = requestDetails.CourseName;
                lbldateOfRequest.Text = requestDetails.Issue_time;
                RequestDateTimeHandler rqdateTimeH = new RequestDateTimeHandler();
                _dateTimeList = rqdateTimeH.GetDateTimeListByRequestId(reqId);
                var dateTime = _dateTimeList.OrderBy(c => c.Date).FirstOrDefault(c => c.Date != null);
                if (dateTime != null)
                {
                    lblRequest.Text = dateTime.Date;
                }
                //var requestDateTime = requestDetails.DateTimeRange.FirstOrDefault(c => c.Date != null);
                //if (requestDateTime != null)
                //{
                //    var firstOrDefault = requestDetails.DateTimeRange.FirstOrDefault(c => c.StartTime != 0).Date;
                //    if (firstOrDefault != null)
                //        lblRequest.Text = firstOrDefault;
                //}



                var startTime = _dateTimeList.FirstOrDefault(c => c.StartTime != 0);
                if (startTime != null)
                {
                    lblTime1.Text = TimeSpan.FromTicks((long)startTime.StartTime).ToString().Substring(0, 5);
                }

                var endTime = _dateTimeList.FirstOrDefault(c => c.EndTime != 0);
                if (endTime != null)
                {
                    lblTime2.Text = TimeSpan.FromTicks((long)endTime.EndTime).ToString().Substring(0, 5);
                }

                switch (requestDetails.Status)
                {
                case 0:
                    lblStatue.Text = "درخواست استاد ثبت گردیده و در انتظار ارجاع هست";
                    break;

                case 1:
                    lblStatue.Text = "درخواست ارجاع داده شده است";
                    break;

                case 2:
                    lblStatue.Text = "درخواست شما مورد تایید واقع گردیده";
                    break;

                case 3:
                    lblStatue.Text = "درخواست شما مورد تایید واقع نگردیده";
                    break;

                case 4:
                    lblStatue.Text = "درخواست شما اطلاع رسانی گردیده است";
                    break;

                case 5:
                    lblStatue.Text = "درخواست شما از دست رفته است";
                    break;
                }
                lblTozieh.Text   = requestDetails.Note;
                lblCapecity.Text = requestDetails.Capacity.ToString();
                lblLocation.Text = requestDetails.Location;
                if (!string.IsNullOrEmpty(requestDetails.Answer_time))
                {
                    if (requestDetails.Status == 2)
                    {
                        lblheader.Text = "زمان پاسخ به درخواست:";
                    }
                    else
                    {
                        lblheader.Text  = "زمان رد درخواست:";
                        litDenyNot.Text = "علت رد درخواست:";
                    }
                    lblheader.Visible         = true;
                    lblDateOfResponse.Visible = true;
                    lblDateOfResponse.Text    = requestDetails.Answer_time;
                    if (requestDetails.Status != 2)
                    {
                        litDenyNot.Visible = true;
                        lblDenyNot.Visible = true;
                        lblDenyNot.Text    = requestDetails.Answernote;
                    }
                }
                else
                {
                    lblheader.Visible         = false;
                    lblDateOfResponse.Visible = false;
                    litDenyNot.Visible        = false;
                    lblDenyNot.Visible        = false;
                }
                var requestDateTimes = _dateTimeList.OrderBy(d => d.Date);
                if (requestDateTimes.Count() > 1)
                {
                    tblRangeOfDate.Visible = true;
                }
                else
                {
                    tblRangeOfDate.Visible = false;
                }
                if (requestDateTimes.Any())
                {
                    tblRangeOfDate.Visible    = true;
                    grdOldDateTime.DataSource = requestDateTimes;
                    grdOldDateTime.DataBind();
                }
                var cth          = new CategoryHandler();
                var categoryName = cth.GetCategoryList().FirstOrDefault(c => c.ID == requestDetails.CatID).Name;
                lblPosition.Text = categoryName;
                var opt           = new OptionHandler();
                var optlist       = opt.GetOptionListByCatID(requestDetails.CatID);
                var rsopt         = new Req_Opt_JuncHandler();
                var resOptJunlist = rsopt.GetReq_Opt_JuncListByReqID(requestDetails.ID);
                var requestOption = new List <Option>();
                foreach (Req_Opt_Junc optJunc in resOptJunlist)
                {
                    foreach (var option in optlist)
                    {
                        if (optJunc.Opt_id == option.ID)
                        {
                            requestOption.Add(new Option {
                                Name = option.Name
                            });
                        }
                    }
                }
                grdFacilities.DataSource = requestOption;
                grdFacilities.DataBind();
                string scrp = "function f(){$find(\"" + RadWindow3.ClientID +
                              "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true);


                #endregion
            }
        }
コード例 #4
0
        protected void grdDeletedRequest_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int reqId = Convert.ToInt32(e.CommandArgument);


            if (e.CommandName == "showInfo")
            {
                #region ShowInfo

                hdnfReqId.Value = reqId.ToString();
                RequestHandler rh         = new RequestHandler();
                GridViewRow    curruntRow = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
                //   imgStatus2.ImageUrl = ((Image)curruntRow.Cells[2].FindControl("imgStatus")).ImageUrl;
                var requestDetails = rh.GetRequestDetails(reqId);
                lblRequestId.Text     = requestDetails.ID.ToString();
                lblDarkhast.Text      = requestDetails.CourseName;
                lbldateOfRequest.Text = requestDetails.Issue_time;
                RequestDateTimeHandler rqdateTimeH = new RequestDateTimeHandler();
                _dateTimeList = rqdateTimeH.GetDateTimeListByRequestId(reqId);
                var dateTime = _dateTimeList.OrderBy(c => c.Date).FirstOrDefault(c => c.Date != null);
                if (dateTime != null)
                {
                    lblRequest.Text = dateTime.Date;
                }
                //var requestDateTime = requestDetails.DateTimeRange.FirstOrDefault(c => c.Date != null);
                //if (requestDateTime != null)
                //{
                //    var firstOrDefault = requestDetails.DateTimeRange.FirstOrDefault(c => c.StartTime != 0).Date;
                //    if (firstOrDefault != null)
                //        lblRequest.Text = firstOrDefault;
                //}



                var startTime = _dateTimeList.FirstOrDefault(c => c.StartTime != 0);
                if (startTime != null)
                {
                    lblTime1.Text = TimeSpan.FromTicks((long)startTime.StartTime).ToString().Substring(0, 5);
                }

                var endTime = _dateTimeList.FirstOrDefault(c => c.EndTime != 0);
                if (endTime != null)
                {
                    lblTime2.Text = TimeSpan.FromTicks((long)endTime.EndTime).ToString().Substring(0, 5);
                }

                switch (requestDetails.Status)
                {
                case 0:
                    lblStatue.Text = "درخواست استاد ثبت گردیده و در انتظار ارجاع هست";
                    break;

                case 1:
                    lblStatue.Text = "درخواست ارجاع داده شده است";
                    break;

                case 2:
                    lblStatue.Text = "درخواست شما مورد تایید واقع گردیده";
                    break;

                case 3:
                    lblStatue.Text = "درخواست شما مورد تایید واقع نگردیده";
                    break;

                case 4:
                    lblStatue.Text = "درخواست شما اطلاع رسانی گردیده است";
                    break;

                case 5:
                    lblStatue.Text = "درخواست شما از دست رفته است";
                    break;
                }
                lblTozieh.Text   = requestDetails.Note;
                lblCapecity.Text = requestDetails.Capacity.ToString();
                lblLocation.Text = requestDetails.Location;
                if (!string.IsNullOrEmpty(requestDetails.Answer_time))
                {
                    if (requestDetails.Status == 2)
                    {
                        lblheader.Text = "زمان پاسخ به درخواست:";
                    }
                    else
                    {
                        lblheader.Text  = "زمان رد درخواست:";
                        litDenyNot.Text = "علت رد درخواست:";
                    }
                    lblheader.Visible         = true;
                    lblDateOfResponse.Visible = true;
                    lblDateOfResponse.Text    = requestDetails.Answer_time;
                    if (requestDetails.Status != 2)
                    {
                        litDenyNot.Visible = true;
                        lblDenyNot.Visible = true;
                        lblDenyNot.Text    = requestDetails.Answernote;
                    }
                }
                else
                {
                    lblheader.Visible         = false;
                    lblDateOfResponse.Visible = false;
                    litDenyNot.Visible        = false;
                    lblDenyNot.Visible        = false;
                }
                var requestDateTimes = _dateTimeList.OrderBy(d => d.Date);
                if (requestDateTimes.Count() > 1)
                {
                    tblRangeOfDate.Visible = true;
                }
                else
                {
                    tblRangeOfDate.Visible = false;
                }
                if (requestDateTimes.Any())
                {
                    tblRangeOfDate.Visible    = true;
                    grdOldDateTime.DataSource = requestDateTimes;
                    grdOldDateTime.DataBind();
                }
                var cth          = new CategoryHandler();
                var categoryName = cth.GetCategoryList().FirstOrDefault(c => c.ID == requestDetails.CatID).Name;
                lblPosition.Text = categoryName;
                var opt     = new OptionHandler();
                var optlist = opt.GetOptionListByCatID(requestDetails.CatID);
                var rsopt   = new Req_Opt_JuncHandler();
                // var resOptJunlist = rsopt.GetReq_Opt_JuncListByReqID(requestDetails.ID);
                var requestOption = new List <Option>();
                //foreach (Req_Opt_Junc optJunc in resOptJunlist)
                //{
                //    foreach (var option in optlist)
                //    {
                //        if (optJunc.Opt_id == option.ID)
                //            requestOption.Add(new Option { Name = option.Name });
                //    }
                //}
                grdFacilities.DataSource = requestOption;
                grdFacilities.DataBind();
                string scrp = "function f(){$find(\"" + RadWindow3.ClientID +
                              "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(this.Page, GetType(), ClientID, scrp, true);


                #endregion
            }
        }
コード例 #5
0
        protected void drpCategory_SelectedIndexChanged1(object sender, EventArgs e)
        {
            chkMeeting.Checked = false;
            chkMeeting_CheckedChanged(sender, e);
            if ((drpCategory.SelectedIndex == 1) || (drpCategory.SelectedIndex == 2) || (drpCategory.SelectedIndex == 3))
            {
                if (drpCategory.SelectedIndex == 1)
                {
                    txtCapacity.Text     = 1.ToString();
                    txtCapacity.ReadOnly = true;
                }
                else
                {
                    txtCapacity.ReadOnly = false;
                }
                trOptions.Visible   = true;
                chblOptions.Enabled = true;
                drpLocation.Enabled = true;
                LocationHandler locH = new LocationHandler();
                drpLocation.Items.Clear();
                drpLocation.DataSource     = locH.GetLocationListByCatID(Convert.ToInt32(drpCategory.SelectedValue)).Distinct();
                drpLocation.DataTextField  = "name";
                drpLocation.DataValueField = "ID";
                drpLocation.DataBind();
                drpLocation.Items.Insert(0, "انتخاب کنید");
                OptionHandler opt = new OptionHandler();
                optlist = opt.GetOptionListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
                chblOptions.Items.Clear();
                chblOptions.DataSource     = optlist;
                chblOptions.DataTextField  = "name";
                chblOptions.DataValueField = "ID";
                chblOptions.DataBind();

                trDaneshkadeh.Visible = userID == 1;
                Daneshkade item = new Daneshkade();
                item.NameDanesh = "--انتخاب کنید--";
                item.ID         = -1;
                DaneshkadeHandler dnsh = new DaneshkadeHandler();
                dnshList = dnsh.GetAllDaneshkade();
                dnshList.Insert(0, item);
                drpChooseDanshkade.Items.Clear();
                drpChooseDanshkade.DataSource     = dnshList;
                drpChooseDanshkade.DataTextField  = "NameDanesh";
                drpChooseDanshkade.DataValueField = "ID";
                drpChooseDanshkade.DataBind();


                if (drpCategory.SelectedIndex == 3 || drpCategory.SelectedIndex == 2)
                {
                    chkMeeting.Visible = true;
                    if (drpCategory.SelectedIndex == 2)
                    {
                        chkMeeting.Text = "بدون استاد";
                    }
                    else
                    {
                        chkMeeting.Text = " تخصیص سالن کنفرانس جهت برگزاری جلسات";
                    }
                }
                else
                {
                    chkMeeting.Visible = false;
                }
            }
            else
            {
                trOptions.Visible   = false;
                chblOptions.Enabled = false;
                drpLocation.Enabled = false;
                chkMeeting.Visible  = false;
            }
            ////////////////////////////////////////////
            RadComboBoxField.Enabled = true;
            RC_UserHandler usrH      = new RC_UserHandler();
            List <RC_User> listostad = usrH.GetOstadListByDaneshID(Convert.ToInt32(Session["DaneshId"]));

            if (listostad != null)
            {
                for (int i = 0; i <= listostad.Count - 1; i++)
                {
                    listostad[i].Name = listostad[i].Name.Replace("ي", "ی");
                }
            }
            RadComboBoxField.Items.Clear();
            RadComboBoxField.DataSource     = listostad;
            RadComboBoxField.DataTextField  = "name";
            RadComboBoxField.DataValueField = "ID";
            RadComboBoxField.DataBind();
            RadComboBoxField.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("جستجو و انتخاب کنید"));


            ///////////////////////////////////////////
        }
コード例 #6
0
        private void ToEditMode(int reqID)
        {
            trOptions.Visible   = true;
            chblOptions.Enabled = true;
            drpLocation.Enabled = false;
            RequestHandler  reqH = new RequestHandler();
            RequestFR       req  = reqH.GetRequestDetails(reqID);
            CategoryHandler cth  = new CategoryHandler();

            catlist = cth.GetCategoryList();
            drpCategory.DataSource     = catlist;
            drpCategory.DataTextField  = "name";
            drpCategory.DataValueField = "ID";
            drpCategory.DataBind();
            drpCategory.Items.Insert(0, "انتخاب کنید");
            drpCategory.Items.FindByValue(req.CatID.ToString()).Selected = true;
            OptionHandler opt = new OptionHandler();

            optlist = opt.GetOptionListByCatID(req.CatID);
            chblOptions.DataSource     = optlist;
            chblOptions.DataTextField  = "name";
            chblOptions.DataValueField = "ID";
            chblOptions.DataBind();
            List <Req_Opt_Junc> res_opt_junlist = new List <Req_Opt_Junc>();
            Req_Opt_JuncHandler rsopt           = new Req_Opt_JuncHandler();

            res_opt_junlist = rsopt.GetReq_Opt_JuncListByReqID(reqID);
            if (res_opt_junlist != null)
            {
                for (int i = 0; i < res_opt_junlist.Count; i++)
                {
                    if (res_opt_junlist[i].IsActive == true)
                    {
                        chblOptions.Items.FindByValue(res_opt_junlist[i].Opt_id.ToString()).Selected = true;
                    }
                }
            }
            RC_UserHandler usrh  = new RC_UserHandler();
            RC_User        ostad = usrh.Get_Ostad_Details(req.IssuerID);

            drpProfessor.Items.Insert(0, ostad.Name);
            drpProfessor.Enabled = false;

            CourseHandler corH = new CourseHandler();

            courselist               = corH.GetCourseListByUserID(req.IssuerID);
            drpCourse.DataSource     = courselist;
            drpCourse.DataTextField  = "name";
            drpCourse.DataValueField = "DID";
            drpCourse.DataBind();
            if (req.CourseName == "درخواست جلسه")
            {
                Session["isMeeting"] = true;
            }
            else
            {
                Session["isMeeting"] = false;
            }
            if ((bool)Session["isMeeting"])
            {
                trProfCrs.Visible = false;
            }
            LocationHandler locH = new LocationHandler();

            drpLocation.DataSource     = locH.GetLocationListByCatID(Convert.ToInt32(drpCategory.SelectedValue));
            drpLocation.DataTextField  = "name";
            drpLocation.DataValueField = "ID";
            drpLocation.DataBind();
            drpLocation.Items.FindByText(req.Location).Selected = true;
            txtCapacity.Text    = req.Capacity.ToString();
            txtDescription.Text = req.Note;
            if (req.CourseDID != 0)
            {
                drpCourse.Items.FindByValue(req.CourseDID.ToString()).Selected = true;
            }

            var datetimelist = req.DateTimeRange;

            //Set a Time and Date of Request

            var requestStartTime = datetimelist.FirstOrDefault(c => c.StartTime != 0);

            if (requestStartTime != null)
            {
                var startTime = TimeSpan.FromTicks(requestStartTime.StartTime);
                RadTimePicker1.SelectedTime = startTime;
            }

            var requestEndTime = datetimelist.FirstOrDefault(c => c.StartTime != 0);

            if (requestEndTime != null)
            {
                var endTime = TimeSpan.FromTicks(requestEndTime.EndTime);
                RadTimePicker2.SelectedTime = endTime;
            }

            var requestDateTime = datetimelist.FirstOrDefault(c => c.StartTime != 0);

            if (requestDateTime != null)
            {
                pcal1.Text = requestDateTime.Date;
            }

            if (datetimelist.Count > 1)
            {
                chbRepeat.Checked = true;
                dvEndDate.Visible = true;
                string scrp2 = "var objCal1 = new AMIB.persianCalendar('ContentPlaceHolder1_pcal2', {extraInputID: 'ContentPlaceHolder1_pcal2',extraInputFormat: 'yyyy/mm/dd'}); ";
                ScriptManager.RegisterStartupScript(this, GetType(), ClientID, scrp2, true);
                var listOfDay = new List <string>();
                foreach (RequestDateTime dateTime in datetimelist.OrderBy(c => c.Date))
                {
                    var dateSplit = dateTime.Date.Split('/');
                    var d         = new DateTime(Convert.ToInt32(dateSplit[0]), Convert.ToInt32(dateSplit[1]), Convert.ToInt32(dateSplit[2]), new PersianCalendar());
                    listOfDay.Add(d.DayOfWeek.ToString());
                }


                var listOfDayforRequest = listOfDay.Distinct();

                var lastOrDefault = datetimelist.OrderBy(d => d.Date).LastOrDefault();
                if (lastOrDefault != null)
                {
                    var endDateRequest = lastOrDefault.Date;
                    pcal2.Text = endDateRequest;
                }
                foreach (var day in listOfDayforRequest)
                {
                    switch (day)
                    {
                    case "Friday":

                        chblWeekDates.Items[6].Selected = true;
                        break;

                    case "Saturday":
                        chblWeekDates.Items[0].Selected = true;
                        break;

                    case "Sunday":
                        chblWeekDates.Items[1].Selected = true;
                        break;

                    case "Monday":
                        chblWeekDates.Items[2].Selected = true;
                        break;

                    case "Tuesday":
                        chblWeekDates.Items[3].Selected = true;
                        break;

                    case "Wednesday":
                        chblWeekDates.Items[4].Selected = true;
                        break;

                    case "Thursday":
                        chblWeekDates.Items[5].Selected = true;
                        break;
                    }
                }
            }

            grdOldDateTime.DataSource = datetimelist.OrderBy(d => d.Date);
            grdOldDateTime.DataBind();

            btnEditRequest.Enabled = true;
            btnEditRequest.Visible = true;

            if (drpCategory.SelectedIndex == 1)
            {
                txtCapacity.Text     = 1.ToString();
                txtCapacity.ReadOnly = true;
            }
        }