예제 #1
0
    protected void CallBack_BListUserInformation_onCallback(object sender, CallBackEventArgs e)
    {
        AttackDefender.CSRFDefender(this.Page);
        DateRangeDetails dateRangeDetailsObj = this.JsSerializer.Deserialize <DateRangeDetails>(this.StringBuilder.CreateString(e.Parameters[3]));
        //string year = dateRangeDetailsObj.ToDate.Substring(0, 4);
        //string month = dateRangeDetailsObj.ToDate.Substring(5, 2);
        string toDate = dateRangeDetailsObj.ToDate;

        this.GetUserInformation((LoadState)Enum.Parse(typeof(LoadState), this.StringBuilder.CreateString(e.Parameters[0])), decimal.Parse(this.StringBuilder.CreateString(e.Parameters[1]), CultureInfo.InvariantCulture), toDate);
        this.ErrorHiddenField_UserInformation.RenderControl(e.Output);
        this.BListUserInformation_UserInformation.RenderControl(e.Output);
    }
        private void Fill_cmbMonth_MasterMonthlyOperation(LoadState LS, int Year, decimal PersonnelID)
        {
            string[] retMessage = new string[4];
            try
            {
                string   CurrentLangID   = string.Empty;
                string   SysLangID       = string.Empty;
                string   Identifier      = string.Empty;
                int      month           = 0;
                DateTime currentDateTime = DateTime.Now;
                CurrentLangID = this.LangProv.GetCurrentLanguage();
                SysLangID     = this.LangProv.GetCurrentSysLanguage();
                switch (SysLangID)
                {
                case "en-US":
                    switch (CurrentLangID)
                    {
                    case "en-US":
                        Identifier = "ee";
                        break;

                    case "fa-IR":
                        Identifier = "ef";
                        break;
                    }
                    month = currentDateTime.Month;
                    break;

                case "fa-IR":
                    switch (CurrentLangID)
                    {
                    case "en-US":
                        Identifier = "fe";
                        break;

                    case "fa-IR":
                        Identifier = "ff";
                        break;
                    }
                    PersianCalendar pCal = new PersianCalendar();
                    month = pCal.GetMonth(currentDateTime);
                    break;
                }
                switch (LS)
                {
                case LoadState.Manager:
                    break;

                case LoadState.Personnel:
                    PersonnelID = BUser.CurrentUser.Person.ID;
                    break;
                }
                //DateRangeHelper drh = new DateRangeHelper();
                //IList<DateRangeHelper.DateRangeOrderProxy> DateRangeOrderProxyList = drh.GetDateRangeOrder(Year);
                BPersonMonthlyWorkedTime    MonthlyOperationBusiness = new BPersonMonthlyWorkedTime(PersonnelID);
                IList <DateRangeOrderProxy> DateRangeOrderProxyList  = MonthlyOperationBusiness.GetDateRangeOrder(Year);
                DateRangeDetails            dateRangeDetails         = new DateRangeDetails();
                for (int i = 1; i <= DateRangeOrderProxyList.Count; i++)
                {
                    dateRangeDetails.FromDate = DateRangeOrderProxyList[i - 1].FromDate;
                    dateRangeDetails.ToDate   = DateRangeOrderProxyList[i - 1].ToDate;
                    dateRangeDetails.Order    = DateRangeOrderProxyList[i - 1].Order.ToString();

                    ComboBoxItem cmbItemMonth = new ComboBoxItem(GetLocalResourceObject("Month" + i + "" + Identifier + "").ToString());
                    cmbItemMonth.Value = this.JsSerializer.Serialize(dateRangeDetails);
                    this.cmbMonth_MasterMonthlyOperation.Items.Add(cmbItemMonth);
                    if (DateRangeOrderProxyList[i - 1].Selected && Session["CurrentOperationMonth"] == null)
                    {
                        this.cmbMonth_MasterMonthlyOperation.SelectedIndex = i - 1;
                        this.hfCurrentMonth_MasterMonthlyOperation.Value   = cmbItemMonth.Value;
                    }
                }
                if (Session["CurrentOperationMonth"] != null)
                {
                    OperationYearMonthProvider.OperationMonthObj operationMonthObj = (OperationYearMonthProvider.OperationMonthObj)Session["CurrentOperationMonth"];
                    dateRangeDetails.FromDate = DateRangeOrderProxyList[operationMonthObj.Index].FromDate;
                    dateRangeDetails.ToDate   = DateRangeOrderProxyList[operationMonthObj.Index].ToDate;
                    dateRangeDetails.Order    = DateRangeOrderProxyList[operationMonthObj.Index].Order.ToString();
                    this.cmbMonth_MasterMonthlyOperation.Items[operationMonthObj.Index].Value = this.JsSerializer.Serialize(dateRangeDetails);
                    this.hfCurrentMonth_MasterMonthlyOperation.Value   = this.cmbMonth_MasterMonthlyOperation.Items[operationMonthObj.Index].Value;
                    this.cmbMonth_MasterMonthlyOperation.SelectedIndex = operationMonthObj.Index;
                }
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                this.ErrorHiddenField_Months_MasterMonthlyOperation.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                this.ErrorHiddenField_Months_MasterMonthlyOperation.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                this.ErrorHiddenField_Months_MasterMonthlyOperation.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            }
        }