Ejemplo n.º 1
0
    public string[] GetDashboards_MainViewPage(string s)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            DashboardSettings    dashboardSetting    = UserSettingBusiness.GetDashboardSetting();
            DashboardSettingsObj dashboardSettingObj = new DashboardSettingsObj();

            if (dashboardSetting.Dashboard1 != null)
            {
                dashboardSettingObj.DashboardName1 = dashboardSetting.Dashboard1.Name;
            }
            if (dashboardSetting.Dashboard2 != null)
            {
                dashboardSettingObj.DashboardName2 = dashboardSetting.Dashboard2.Name;
            }
            if (dashboardSetting.Dashboard3 != null)
            {
                dashboardSettingObj.DashboardName3 = dashboardSetting.Dashboard3.Name;
            }
            if (dashboardSetting.Dashboard4 != null)
            {
                dashboardSettingObj.DashboardName4 = dashboardSetting.Dashboard4.Name;
            }
            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            retMessage[1] = GetLocalResourceObject("OperationCompleted").ToString();
            retMessage[2] = "success";
            retMessage[3] = this.JsSerializer.Serialize(dashboardSettingObj);
            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);
        }
    }
Ejemplo n.º 2
0
    public string[] UpdateSettings_UserSettingsPage(string caller, string settingsState, string personnelLoadState, string personnelCountState, string PersonnelID, string PersonnelSearchTerms, string SettingsTerms)
    {
        this.InitializeCulture();

        string[]            retMessage    = new string[4];
        Caller              settingCaller = (Caller)Enum.Parse(typeof(Caller), this.StringBuilder.CreateString(caller));
        SettingsState       SS            = (SettingsState)Enum.Parse(typeof(SettingsState), this.StringBuilder.CreateString(settingsState));
        LoadState           PLS           = (LoadState)Enum.Parse(typeof(LoadState), this.StringBuilder.CreateString(personnelLoadState));
        PersonnelCountState PCS           = (PersonnelCountState)Enum.Parse(typeof(PersonnelCountState), this.StringBuilder.CreateString(personnelCountState));
        decimal             personnelID   = decimal.Parse(this.StringBuilder.CreateString(PersonnelID), CultureInfo.InvariantCulture);

        PersonnelSearchTerms = this.StringBuilder.CreateString(PersonnelSearchTerms);
        SettingsTerms        = this.StringBuilder.CreateString(SettingsTerms);


        try
        {
            AttackDefender.CSRFDefender(this.Page);
            switch (SS)
            {
            case SettingsState.EmailSMS:
                EmailSMSSettingsObj emailSMSSettingsObj = this.JsSerializer.Deserialize <EmailSMSSettingsObj>(SettingsTerms);
                bool IsSendEmail = bool.Parse(emailSMSSettingsObj.IsSendEmail);
                bool IsSendSMS   = bool.Parse(emailSMSSettingsObj.IsSendSMS);
                EmailSMSTransferState SendEmailState = (EmailSMSTransferState)Enum.Parse(typeof(EmailSMSTransferState), emailSMSSettingsObj.SendEmailState);
                EmailSMSTransferState SendSMSState   = (EmailSMSTransferState)Enum.Parse(typeof(EmailSMSTransferState), emailSMSSettingsObj.SendSMSState);
                int    EmailDay        = int.Parse(emailSMSSettingsObj.DailyEmailDay, CultureInfo.InvariantCulture);
                string DailyEmailTime  = emailSMSSettingsObj.DailyEmailHour + ":" + emailSMSSettingsObj.DailyEmailMinute;
                string HourlyEmailTime = emailSMSSettingsObj.HourlyEmailHour + ":" + emailSMSSettingsObj.HourlyEmailMinute;
                int    SMSDay          = int.Parse(emailSMSSettingsObj.DailySMSDay, CultureInfo.InvariantCulture);
                string DailySMSTime    = emailSMSSettingsObj.DailySMSHour + ":" + emailSMSSettingsObj.DailySMSMinute;
                string HourlySMSTime   = emailSMSSettingsObj.HourlySMSHour + ":" + emailSMSSettingsObj.HourlySMSMinute;

                EmailSettings emailSettings = new EmailSettings();
                emailSettings.Active = IsSendEmail;
                switch (SendEmailState)
                {
                case EmailSMSTransferState.Daily:
                    emailSettings.SendByDay = true;
                    break;

                case EmailSMSTransferState.Hourly:
                    emailSettings.SendByDay = false;
                    break;
                }
                emailSettings.DayCount   = EmailDay;
                emailSettings.TheDayHour = DailyEmailTime;
                emailSettings.TheHour    = HourlyEmailTime;

                SMSSettings smsSettings = new SMSSettings();
                smsSettings.Active = IsSendSMS;
                switch (SendSMSState)
                {
                case EmailSMSTransferState.Daily:
                    smsSettings.SendByDay = true;
                    break;

                case EmailSMSTransferState.Hourly:
                    smsSettings.SendByDay = false;
                    break;
                }
                smsSettings.DayCount   = SMSDay;
                smsSettings.TheDayHour = DailySMSTime;
                smsSettings.TheHour    = HourlySMSTime;


                switch (PCS)
                {
                case PersonnelCountState.Single:
                    switch (settingCaller)
                    {
                    case Caller.Personal:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings);
                        break;

                    case Caller.Management:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, personnelID);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, personnelID);
                        break;

                    default:
                        break;
                    }
                    break;

                case PersonnelCountState.Group:
                    switch (PLS)
                    {
                    case LoadState.Normal:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, personnelID);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, personnelID);
                        break;

                    case LoadState.Search:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, PersonnelSearchTerms);
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, PersonnelSearchTerms);
                        break;

                    case LoadState.AdvancedSearch:
                        this.UserSettingsBusiness.SaveEmailSetting(emailSettings, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));
                        this.UserSettingsBusiness.SaveSMSSetting(smsSettings, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));
                        break;
                    }
                    break;
                }
                break;

            case SettingsState.Dashboard:
                DashboardSettingsObj dashboardSettingsObj = this.JsSerializer.Deserialize <DashboardSettingsObj>(SettingsTerms);
                IList <Dashboards>   dashboardList        = DashboardBusiness.GetAll();

                decimal dashboardID1 = dashboardSettingsObj.DashboardID1 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID1, CultureInfo.InvariantCulture);
                decimal dashboardID2 = dashboardSettingsObj.DashboardID2 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID2, CultureInfo.InvariantCulture);
                decimal dashboardID3 = dashboardSettingsObj.DashboardID3 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID3, CultureInfo.InvariantCulture);
                decimal dashboardID4 = dashboardSettingsObj.DashboardID4 == "" ? 0 : Convert.ToDecimal(dashboardSettingsObj.DashboardID4, CultureInfo.InvariantCulture);

                DashboardSettings dashboardObj = new DashboardSettings();
                dashboardObj.Dashboard1 = dashboardList.SingleOrDefault(d => d.ID == dashboardID1);
                dashboardObj.Dashboard2 = dashboardList.SingleOrDefault(d => d.ID == dashboardID2);
                dashboardObj.Dashboard3 = dashboardList.SingleOrDefault(d => d.ID == dashboardID3);
                dashboardObj.Dashboard4 = dashboardList.SingleOrDefault(d => d.ID == dashboardID4);

                switch (PCS)
                {
                case PersonnelCountState.Single:
                    switch (settingCaller)
                    {
                    case Caller.Personal:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj);

                        break;

                    case Caller.Management:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, personnelID);

                        break;

                    default:
                        break;
                    }
                    break;

                case PersonnelCountState.Group:
                    switch (PLS)
                    {
                    case LoadState.Normal:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, personnelID);

                        break;

                    case LoadState.Search:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, PersonnelSearchTerms);

                        break;

                    case LoadState.AdvancedSearch:
                        this.UserSettingsBusiness.SaveDashboardSetting(dashboardObj, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));

                        break;
                    }
                    break;
                }
                break;

            case SettingsState.CollectiveRequestRegistType:
                OperatorCollectiveRequestRegistType operatorCollectiveRequestTypeObj = this.JsSerializer.Deserialize <OperatorCollectiveRequestRegistType>(SettingsTerms);
                CollectiveRequestRegistType         collectiveRequestRegistTypeObj   = (CollectiveRequestRegistType)Enum.Parse(typeof(CollectiveRequestRegistType), operatorCollectiveRequestTypeObj.CollectiveRequestRegistType);

                switch (PCS)
                {
                case PersonnelCountState.Single:
                    switch (settingCaller)
                    {
                    case Caller.Personal:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj);

                        break;

                    case Caller.Management:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, personnelID);

                        break;

                    default:
                        break;
                    }
                    break;

                case PersonnelCountState.Group:
                    switch (PLS)
                    {
                    case LoadState.Normal:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, personnelID);

                        break;

                    case LoadState.Search:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, PersonnelSearchTerms);

                        break;

                    case LoadState.AdvancedSearch:
                        this.UserSettingsBusiness.SaveOperatorCollectiveRequestRegistType(collectiveRequestRegistTypeObj, this.APSProv.CreateAdvancedPersonnelSearchProxy(PersonnelSearchTerms));

                        break;
                    }
                    break;
                }
                break;
            }
            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            retMessage[1] = GetLocalResourceObject("OperationCompleted").ToString();
            retMessage[2] = "success";
            retMessage[3] = SS.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);
        }
    }
Ejemplo n.º 3
0
    public string[] GetSettings_UserSettingsPage(string caller, string PersonnelID)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        Caller        SettingsCaller       = (Caller)Enum.Parse(typeof(Caller), this.StringBuilder.CreateString(caller));
        decimal       personnelID          = decimal.Parse(this.StringBuilder.CreateString(PersonnelID), CultureInfo.InvariantCulture);
        List <object> SettingsBatchObjList = new List <object>();

        try
        {
            AttackDefender.CSRFDefender(this.Page);
            EmailSettings       emailSettings        = null;
            SMSSettings         smsSettings          = null;
            DashboardSettings   dashboardSettingsObj = null;
            EmailSMSSettingsObj emailSMSSettingsObj  = new EmailSMSSettingsObj();
            emailSMSSettingsObj.SettingType = "EmailSMS";
            CollectiveRequestRegistType collectiveRequestRegistTypeObj = CollectiveRequestRegistType.Business;
            switch (SettingsCaller)
            {
            case Caller.Personal:
                emailSettings                  = this.UserSettingsBusiness.GetEmailSetting();
                smsSettings                    = this.UserSettingsBusiness.GetSMSSetting();
                dashboardSettingsObj           = this.UserSettingsBusiness.GetDashboardSetting();
                collectiveRequestRegistTypeObj = this.UserSettingsBusiness.GetOperatorCollectiveRequestRegistTypeSetting();
                break;

            case Caller.Management:
                if (personnelID != 0)
                {
                    emailSettings                  = this.UserSettingsBusiness.GetEmailSetting(personnelID);
                    smsSettings                    = this.UserSettingsBusiness.GetSMSSetting(personnelID);
                    dashboardSettingsObj           = this.UserSettingsBusiness.GetDashboardSetting(personnelID);
                    collectiveRequestRegistTypeObj = this.UserSettingsBusiness.GetOperatorCollectiveRequestRegistTypeSetting(personnelID);
                }
                break;
            }

            emailSMSSettingsObj.IsSendEmail = emailSettings != null?emailSettings.Active.ToString().ToLower() : false.ToString().ToLower();

            emailSMSSettingsObj.SendEmailState = emailSettings != null?emailSettings.SendByDay?EmailSMSTransferState.Daily.ToString() : EmailSMSTransferState.Hourly.ToString() : EmailSMSTransferState.Daily.ToString();

            emailSMSSettingsObj.DailyEmailDay = emailSettings != null ? emailSettings.DayCount > 0 ? emailSettings.DayCount.ToString() : this.objEmailSMSSettingsDefaultTime.DailyDay : this.objEmailSMSSettingsDefaultTime.DailyDay;
            string DailyEmailTime  = emailSettings != null ? emailSettings.TheDayHour != string.Empty ? emailSettings.TheDayHour : this.objEmailSMSSettingsDefaultTime.DailyTime : this.objEmailSMSSettingsDefaultTime.DailyTime;
            string HourlyEmailTime = emailSettings != null ? emailSettings.TheHour != string.Empty ? emailSettings.TheHour : this.objEmailSMSSettingsDefaultTime.HourlyTime : this.objEmailSMSSettingsDefaultTime.HourlyTime;
            Dictionary <string, string> DailyEmailTimeDic  = this.GetTimeParts_UserSettings(DailyEmailTime);
            Dictionary <string, string> HourlyEmailTimeDic = this.GetTimeParts_UserSettings(HourlyEmailTime);
            emailSMSSettingsObj.DailyEmailHour    = DailyEmailTimeDic["Hour"];
            emailSMSSettingsObj.DailyEmailMinute  = DailyEmailTimeDic["Minute"];
            emailSMSSettingsObj.HourlyEmailHour   = HourlyEmailTimeDic["Hour"];
            emailSMSSettingsObj.HourlyEmailMinute = HourlyEmailTimeDic["Minute"];

            emailSMSSettingsObj.IsSendSMS = smsSettings != null?smsSettings.Active.ToString().ToLower() : false.ToString().ToLower();

            emailSMSSettingsObj.SendSMSState = smsSettings != null?smsSettings.SendByDay?EmailSMSTransferState.Daily.ToString() : EmailSMSTransferState.Hourly.ToString() : EmailSMSTransferState.Daily.ToString();

            emailSMSSettingsObj.DailySMSDay = smsSettings != null ? smsSettings.DayCount > 0 ? smsSettings.DayCount.ToString() : this.objEmailSMSSettingsDefaultTime.DailyDay : this.objEmailSMSSettingsDefaultTime.DailyDay;
            string DailySMSTime  = smsSettings != null ? smsSettings.TheDayHour != string.Empty ? smsSettings.TheDayHour : this.objEmailSMSSettingsDefaultTime.DailyTime : this.objEmailSMSSettingsDefaultTime.DailyTime;
            string HourlySMSTime = smsSettings != null ? smsSettings.TheHour != string.Empty ? smsSettings.TheHour : this.objEmailSMSSettingsDefaultTime.HourlyTime : this.objEmailSMSSettingsDefaultTime.HourlyTime;
            Dictionary <string, string> DailySMSTimeDic  = this.GetTimeParts_UserSettings(DailySMSTime);
            Dictionary <string, string> HourlySMSTimeDic = this.GetTimeParts_UserSettings(HourlySMSTime);
            emailSMSSettingsObj.DailySMSHour    = DailySMSTimeDic["Hour"];
            emailSMSSettingsObj.DailySMSMinute  = DailySMSTimeDic["Minute"];
            emailSMSSettingsObj.HourlySMSHour   = HourlySMSTimeDic["Hour"];
            emailSMSSettingsObj.HourlySMSMinute = HourlySMSTimeDic["Minute"];

            SettingsBatchObjList.Add(emailSMSSettingsObj);

            DashboardSettingsObj dashboardObj = new DashboardSettingsObj();
            dashboardObj.SettingType = "Dashboard";
            if (dashboardSettingsObj != null)
            {
                dashboardObj.DashboardID1 = dashboardSettingsObj.Dashboard1 != null?dashboardSettingsObj.Dashboard1.ID.ToString() : "0";

                dashboardObj.DashboardTitle1 = dashboardSettingsObj.Dashboard1 != null ? dashboardSettingsObj.Dashboard1.Title : "";

                dashboardObj.DashboardID2 = dashboardSettingsObj.Dashboard2 != null?dashboardSettingsObj.Dashboard2.ID.ToString() : "0";

                dashboardObj.DashboardTitle2 = dashboardSettingsObj.Dashboard2 != null ? dashboardSettingsObj.Dashboard2.Title : "";

                dashboardObj.DashboardID3 = dashboardSettingsObj.Dashboard3 != null?dashboardSettingsObj.Dashboard3.ID.ToString() : "0";

                dashboardObj.DashboardTitle3 = dashboardSettingsObj.Dashboard3 != null ? dashboardSettingsObj.Dashboard3.Title : "";

                dashboardObj.DashboardID4 = dashboardSettingsObj.Dashboard4 != null?dashboardSettingsObj.Dashboard4.ID.ToString() : "0";

                dashboardObj.DashboardTitle4 = dashboardSettingsObj.Dashboard4 != null ? dashboardSettingsObj.Dashboard4.Title : "";
            }
            else
            {
                dashboardObj.DashboardID1    = "0";
                dashboardObj.DashboardTitle1 = "";

                dashboardObj.DashboardID2    = "0";
                dashboardObj.DashboardTitle2 = "";

                dashboardObj.DashboardID3    = "0";
                dashboardObj.DashboardTitle3 = "";

                dashboardObj.DashboardID4    = "0";
                dashboardObj.DashboardTitle4 = "";
            }
            SettingsBatchObjList.Add(dashboardObj);
            MonthlyOperationSchemaObj monthlyOperationSchemaObj = new MonthlyOperationSchemaObj();
            monthlyOperationSchemaObj.Schema = ((MonthlyOperationSchema)MonthlyOperationSchemaHelper.InitializeMonthlyOperationSchema(this.Page)).ToString();
            SettingsBatchObjList.Add(monthlyOperationSchemaObj);
            OperatorCollectiveRequestRegistType collectiveRequestTypeObj = new OperatorCollectiveRequestRegistType();
            collectiveRequestTypeObj.SettingType = "CollectiveRequestRegistType";
            collectiveRequestTypeObj.CollectiveRequestRegistType = collectiveRequestRegistTypeObj.ToString();
            SettingsBatchObjList.Add(collectiveRequestTypeObj);
            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            retMessage[1] = GetLocalResourceObject("OperationCompleted").ToString();
            retMessage[2] = "success";
            retMessage[3] = this.JsSerializer.Serialize(SettingsBatchObjList);
            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);
        }
    }