Esempio n. 1
0
    protected void CallBack_GridMonthlyExceptionShifts_MonthlyExceptionShifts_onCallBack(object sender, CallBackEventArgs e)
    {
        int Year               = int.Parse(this.StringBuilder.CreateString(e.Parameters[0]));
        int Month              = int.Parse(this.StringBuilder.CreateString(e.Parameters[1]));
        int PageSize           = int.Parse(this.StringBuilder.CreateString(e.Parameters[2]));
        int PageIndex          = int.Parse(this.StringBuilder.CreateString(e.Parameters[3]));
        PersonnelLoadState PLS = (PersonnelLoadState)Enum.Parse(typeof(PersonnelLoadState), this.StringBuilder.CreateString(e.Parameters[4]));
        string             PersonnelSearchTerm = this.StringBuilder.CreateString(e.Parameters[5]);

        this.CustomizeGridMonthlyExceptionShifts_MonthlyExceptionShifts(Year, Month);
        this.SetMonthlyExceptionShiftsPageCount_MonthlyExceptionShifts(Year, Month, PLS, PersonnelSearchTerm, PageSize);
        this.Fill_GridMonthlyExceptionShifts_MonthlyExceptionShifts(Year, Month, PLS, PersonnelSearchTerm, PageSize, PageIndex);
        this.hfMonthlyExceptionShiftsPageCount_MonthlyExceptionShifts.RenderControl(e.Output);
        this.ErrorHiddenField_MonthlyExceptionShifts.RenderControl(e.Output);
        this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.RenderControl(e.Output);
    }
    private void Fill_cmbPersonnel_UpdateCalculationResult(PersonnelLoadState Ls, int pageSize, int pageIndex, string SearchTerm)
    {
        string[] retMessage = new string[4];
        try
        {
            IList <Person> PersonnelList = null;
            switch (Ls)
            {
            case PersonnelLoadState.Normal:
                PersonnelList = this.PersonSearchBusiness.GetAllPerson(pageIndex, pageSize);
                break;

            case PersonnelLoadState.Search:
                PersonnelList = this.PersonSearchBusiness.QuickSearchByPage(pageIndex, pageSize, SearchTerm);
                break;

            case PersonnelLoadState.AdvancedSearch:
                PersonnelList = this.PersonSearchBusiness.GetPersonInAdvanceSearch(this.APSProv.CreateAdvancedPersonnelSearchProxy(SearchTerm), pageIndex, pageSize);
                break;
            }
            foreach (Person personItem in PersonnelList)
            {
                ComboBoxItem personCmbItem = new ComboBoxItem(personItem.FirstName + " " + personItem.LastName);
                personCmbItem["BarCode"] = personItem.BarCode;
                personCmbItem["CardNum"] = personItem.CardNum;
                personCmbItem.Id         = personItem.ID.ToString();
                this.cmbPersonnel_UpdateCalculationResult.Items.Add(personCmbItem);
            }
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_Personnel_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_Personnel_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_Personnel_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
    private void SetPersonnelPageCount_cmbPersonnel_UpdateCalculationResult(PersonnelLoadState Ls, int pageSize, string SearchTerm)
    {
        string[] retMessage     = new string[4];
        int      PersonnelCount = 0;

        try
        {
            switch (Ls)
            {
            case PersonnelLoadState.Normal:
                PersonnelCount = this.PersonSearchBusiness.GetPersonCount();
                break;

            case PersonnelLoadState.Search:
                PersonnelCount = this.PersonSearchBusiness.GetPersonInQuickSearchCount(SearchTerm);
                break;

            case PersonnelLoadState.AdvancedSearch:
                PersonnelCount = this.PersonSearchBusiness.GetPersonInAdvanceSearchCount(this.APSProv.CreateAdvancedPersonnelSearchProxy(SearchTerm));
                break;

            default:
                break;
            }
            this.hfPersonnelCount_UpdateCalculationResult.Value     = PersonnelCount.ToString();
            this.hfPersonnelPageCount_UpdateCalculationResult.Value = Utility.GetPageCount(PersonnelCount, pageSize).ToString();
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_Personnel_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_Personnel_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_Personnel_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
    protected void CallBack_GridUpdateCalculationResult_UpdateCalculationResult_onCallBack(object sender, CallBackEventArgs e)
    {
        AttackDefender.CSRFDefender(this.Page);
        string[]           retMessage          = new string[4];
        int                Year                = int.Parse(this.StringBuilder.CreateString(e.Parameters[0]), CultureInfo.InvariantCulture);
        int                Month               = int.Parse(this.StringBuilder.CreateString(e.Parameters[1]), CultureInfo.InvariantCulture);
        int                PageSize            = int.Parse(this.StringBuilder.CreateString(e.Parameters[2]), CultureInfo.InvariantCulture);
        int                PageIndex           = int.Parse(this.StringBuilder.CreateString(e.Parameters[3]), CultureInfo.InvariantCulture);
        PersonnelLoadState PLS                 = (PersonnelLoadState)Enum.Parse(typeof(PersonnelLoadState), this.StringBuilder.CreateString(e.Parameters[4]));
        string             PersonnelSearchTerm = this.StringBuilder.CreateString(e.Parameters[5]);

        try
        {
            this.BuildGrid_UpdateCalculationResult(this.GridUpdateCalculationResult_UpdateCalculationResult);
            this.SetCalculationResultPageCount_UpdateCalculationResult(Year, Month, PLS, PersonnelSearchTerm, PageSize);
            this.Fill_GridUpdateCalculationResult_UpdateCalculationResult(Year, Month, PLS, PersonnelSearchTerm, PageIndex, PageSize);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            this.ErrorHiddenField_UpdateCalculationResult.RenderControl(e.Output);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            this.ErrorHiddenField_UpdateCalculationResult.RenderControl(e.Output);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_UpdateCalculationResult.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
            this.ErrorHiddenField_UpdateCalculationResult.RenderControl(e.Output);
        }
        this.hfCalculationResultPageCount_UpdateCalculationResult.RenderControl(e.Output);
        this.ErrorHiddenField_UpdateCalculationResult.RenderControl(e.Output);
        this.GridUpdateCalculationResult_UpdateCalculationResult.RenderControl(e.Output);
    }
    public string[] ArchiveCalculationResult_UpdateCalculationResultPage(string Year, string Month, string PersonnelID, string personnelLoadState, string PersonnelSearchTerm, string IsForceArchiveCalculationResult, string IsForceOverrideArchiveCalculationResult)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            AttackDefender.CSRFDefender(this.Page);
            int year  = int.Parse(this.StringBuilder.CreateString(Year), CultureInfo.InvariantCulture);
            int month = int.Parse(this.StringBuilder.CreateString(Month), CultureInfo.InvariantCulture);
            PersonnelLoadState PLS         = (PersonnelLoadState)Enum.Parse(typeof(PersonnelLoadState), this.StringBuilder.CreateString(personnelLoadState));
            decimal            personnelID = decimal.Parse(this.StringBuilder.CreateString(PersonnelID), CultureInfo.InvariantCulture);
            PersonnelSearchTerm = this.StringBuilder.CreateString(PersonnelSearchTerm);
            bool isForceArchiveCalculationResult         = bool.Parse(this.StringBuilder.CreateString(IsForceArchiveCalculationResult));
            bool isForceOverrideArchiveCalculationResult = bool.Parse(this.StringBuilder.CreateString(IsForceOverrideArchiveCalculationResult));

            this.UpdateCalculationResultBusiness.CheckArchiveDataAccess();

            if (!isForceArchiveCalculationResult)
            {
                if (personnelID != 0)
                {
                    switch (this.UpdateCalculationResultBusiness.IsArchiveExsits(year, month, personnelID))
                    {
                    case ArchiveExistsConditions.NotExists:
                        this.UpdateCalculationResultBusiness.ArchiveData(year, month, personnelID, true);
                        retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                        retMessage[1] = GetLocalResourceObject("ArchiveComplete").ToString();
                        retMessage[2] = "success";
                        retMessage[3] = ArchiveExistsConditions.NotExists.ToString();
                        break;

                    case ArchiveExistsConditions.SomeExists:
                        retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                        retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.SomeExists.ToString()).ToString();
                        retMessage[2] = "warning";
                        retMessage[3] = ArchiveExistsConditions.SomeExists.ToString();
                        break;

                    case ArchiveExistsConditions.AllExists:
                        retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                        retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.AllExists.ToString()).ToString();
                        retMessage[2] = "warning";
                        retMessage[3] = ArchiveExistsConditions.AllExists.ToString();
                        break;
                    }
                }
                else
                {
                    switch (PLS)
                    {
                    case PersonnelLoadState.Normal:
                        switch (this.UpdateCalculationResultBusiness.IsArchiveExsits(year, month, string.Empty))
                        {
                        case ArchiveExistsConditions.NotExists:
                            this.UpdateCalculationResultBusiness.ArchiveData(year, month, string.Empty, true);
                            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                            retMessage[1] = GetLocalResourceObject("ArchiveComplete").ToString();
                            retMessage[2] = "success";
                            retMessage[3] = ArchiveExistsConditions.NotExists.ToString();
                            break;

                        case ArchiveExistsConditions.SomeExists:
                            retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                            retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.SomeExists.ToString()).ToString();
                            retMessage[2] = "warning";
                            retMessage[3] = ArchiveExistsConditions.SomeExists.ToString();
                            break;

                        case ArchiveExistsConditions.AllExists:
                            retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                            retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.AllExists.ToString()).ToString();
                            retMessage[2] = "warning";
                            retMessage[3] = ArchiveExistsConditions.AllExists.ToString();
                            break;
                        }
                        break;

                    case PersonnelLoadState.Search:
                        switch (this.UpdateCalculationResultBusiness.IsArchiveExsits(year, month, PersonnelSearchTerm))
                        {
                        case ArchiveExistsConditions.NotExists:
                            this.UpdateCalculationResultBusiness.ArchiveData(year, month, PersonnelSearchTerm, true);
                            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                            retMessage[1] = GetLocalResourceObject("ArchiveComplete").ToString();
                            retMessage[2] = "success";
                            retMessage[3] = ArchiveExistsConditions.NotExists.ToString();
                            break;

                        case ArchiveExistsConditions.SomeExists:
                            retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                            retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.SomeExists.ToString()).ToString();
                            retMessage[2] = "warning";
                            retMessage[3] = ArchiveExistsConditions.SomeExists.ToString();
                            break;

                        case ArchiveExistsConditions.AllExists:
                            retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                            retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.AllExists.ToString()).ToString();
                            retMessage[2] = "warning";
                            retMessage[3] = ArchiveExistsConditions.AllExists.ToString();
                            break;
                        }
                        break;

                    case PersonnelLoadState.AdvancedSearch:
                        PersonAdvanceSearchProxy personAdvanceSearchProxy = this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerm);
                        switch (this.UpdateCalculationResultBusiness.IsArchiveExsits(year, month, personAdvanceSearchProxy))
                        {
                        case ArchiveExistsConditions.NotExists:
                            this.UpdateCalculationResultBusiness.ArchiveData(year, month, personAdvanceSearchProxy, true);
                            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                            retMessage[1] = GetLocalResourceObject("ArchiveComplete").ToString();
                            retMessage[2] = "success";
                            retMessage[3] = ArchiveExistsConditions.NotExists.ToString();
                            break;

                        case ArchiveExistsConditions.SomeExists:
                            retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                            retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.SomeExists.ToString()).ToString();
                            retMessage[2] = "warning";
                            retMessage[3] = ArchiveExistsConditions.SomeExists.ToString();
                            break;

                        case ArchiveExistsConditions.AllExists:
                            retMessage[0] = GetLocalResourceObject("RetWarningType").ToString();
                            retMessage[1] = GetLocalResourceObject(ArchiveExistsConditions.AllExists.ToString()).ToString();
                            retMessage[2] = "warning";
                            retMessage[3] = ArchiveExistsConditions.AllExists.ToString();
                            break;
                        }
                        break;
                    }
                }
            }
            else
            {
                if (personnelID != 0)
                {
                    this.UpdateCalculationResultBusiness.ArchiveData(year, month, personnelID, isForceOverrideArchiveCalculationResult);
                }
                else
                {
                    switch (PLS)
                    {
                    case PersonnelLoadState.Normal:
                        this.UpdateCalculationResultBusiness.ArchiveData(year, month, string.Empty, isForceOverrideArchiveCalculationResult);
                        break;

                    case PersonnelLoadState.Search:
                        this.UpdateCalculationResultBusiness.ArchiveData(year, month, PersonnelSearchTerm, isForceOverrideArchiveCalculationResult);
                        break;

                    case PersonnelLoadState.AdvancedSearch:
                        this.UpdateCalculationResultBusiness.ArchiveData(year, month, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerm), isForceOverrideArchiveCalculationResult);
                        break;
                    }
                }
                retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                retMessage[1] = GetLocalResourceObject("ArchiveComplete").ToString();
                retMessage[2] = "success";
                retMessage[3] = ArchiveExistsConditions.NotExists.ToString();
            }
            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
    private void Fill_GridUpdateCalculationResult_UpdateCalculationResult(int Year, int Month, PersonnelLoadState PLS, string PersonnelSearchTerm, int PageIndex, int PageSize)
    {
        string[] retMessage = new string[4];
        this.InitializeCulture();

        IList <ArchiveCalcValuesProxy> ArchiveCalcValuesProxyLst = null;

        switch (PLS)
        {
        case PersonnelLoadState.Normal:
            ArchiveCalcValuesProxyLst = this.UpdateCalculationResultBusiness.GetArchiveValues(Year, Month, string.Empty, PageIndex, PageSize);
            break;

        case PersonnelLoadState.Search:
            ArchiveCalcValuesProxyLst = this.UpdateCalculationResultBusiness.GetArchiveValues(Year, Month, PersonnelSearchTerm, PageIndex, PageSize);
            break;

        case PersonnelLoadState.AdvancedSearch:
            ArchiveCalcValuesProxyLst = this.UpdateCalculationResultBusiness.GetArchiveValues(Year, Month, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerm), PageIndex, PageSize);
            break;
        }
        this.GridUpdateCalculationResult_UpdateCalculationResult.DataSource = ArchiveCalcValuesProxyLst;
        this.GridUpdateCalculationResult_UpdateCalculationResult.DataBind();
    }
    private void SetCalculationResultPageCount_UpdateCalculationResult(int Year, int Month, PersonnelLoadState PLS, string PersonnelSearchTerm, int PageSize)
    {
        int PersonnelCount = 0;

        switch (PLS)
        {
        case PersonnelLoadState.Normal:
            PersonnelCount = this.UpdateCalculationResultBusiness.GetSearchCount(string.Empty, Year, Month);
            break;

        case PersonnelLoadState.Search:
            PersonnelCount = this.UpdateCalculationResultBusiness.GetSearchCount(PersonnelSearchTerm, Year, Month);
            break;

        case PersonnelLoadState.AdvancedSearch:
            PersonnelCount = this.UpdateCalculationResultBusiness.GetSearchCount(this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerm), Year, Month);
            break;
        }
        this.hfCalculationResultCount_UpdateCalculationResult.Value     = PersonnelCount.ToString();
        this.hfCalculationResultPageCount_UpdateCalculationResult.Value = Utility.GetPageCount(PersonnelCount, this.GridUpdateCalculationResult_UpdateCalculationResult.PageSize).ToString();
    }
Esempio n. 8
0
    private void Fill_GridMonthlyExceptionShifts_MonthlyExceptionShifts(int Year, int Month, PersonnelLoadState PLS, string PersonnelSearchTerm, int PageSize, int PageIndex)
    {
        string[] retMessage = new string[4];
        IList <MonthlyExceptionShiftProxy> MonthlyExceptionShiftProxyList = null;

        try
        {
            this.InitializeCulture();
            switch (PLS)
            {
            case PersonnelLoadState.Normal:
                MonthlyExceptionShiftProxyList = this.ExceptionShiftsBusiness.GetMonthlyExceptionShiftsList(Year, Month, PageIndex, PageSize);
                break;

            case PersonnelLoadState.Search:
                MonthlyExceptionShiftProxyList = this.ExceptionShiftsBusiness.GetMonthlyExceptionShiftsListByQuickSerch(Year, Month, PersonnelSearchTerm, PageIndex, PageSize);
                break;

            case PersonnelLoadState.AdvancedSearch:
                MonthlyExceptionShiftProxyList = this.ExceptionShiftsBusiness.GetMonthlyExceptionShiftsListByAdvancedSearch(Year, Month, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerm), PageIndex, PageSize);
                break;
            }
            this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.DataSource = MonthlyExceptionShiftProxyList;
            this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.DataBind();
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            this.ErrorHiddenField_MonthlyExceptionShifts.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            this.ErrorHiddenField_MonthlyExceptionShifts.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (OutOfExpectedRangeException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ex, retMessage);
            this.ErrorHiddenField_MonthlyExceptionShifts.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            this.ErrorHiddenField_MonthlyExceptionShifts.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
        }
    }
Esempio n. 9
0
    private void SetMonthlyExceptionShiftsPageCount_MonthlyExceptionShifts(int Year, int Month, PersonnelLoadState PLS, string PersonnelSearchTerm, int PageSize)
    {
        int PersonnelCount = 0;

        switch (PLS)
        {
        case PersonnelLoadState.Normal:
            PersonnelCount = this.PersonSearchBusiness.GetPersonCount();
            break;

        case PersonnelLoadState.Search:
            PersonnelCount = this.PersonSearchBusiness.GetPersonInQuickSearchCount(PersonnelSearchTerm);
            break;

        case PersonnelLoadState.AdvancedSearch:
            PersonnelCount = this.PersonSearchBusiness.GetPersonInAdvanceSearchCount(this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerm));
            break;
        }
        this.hfMonthlyExceptionShiftsCount_MonthlyExceptionShifts.Value     = PersonnelCount.ToString();
        this.hfMonthlyExceptionShiftsPageCount_MonthlyExceptionShifts.Value = Utility.GetPageCount(PersonnelCount, this.GridMonthlyExceptionShifts_MonthlyExceptionShifts.PageSize).ToString();
    }