Пример #1
0
        public void SaveSMSSettings_ByAdvanceSearchSearch()
        {
            SMSSettings smsSet = new SMSSettings();

            smsSet.Active     = true;
            smsSet.SendByDay  = true;
            smsSet.TheDayHour = "13:10";
            smsSet.TheHour    = "10:10";
            smsSet.DayCount   = 5;
            ClearSession();
            PersonAdvanceSearchProxy proxy = new PersonAdvanceSearchProxy();

            proxy.DepartmentId          = ADORoot.ID;
            proxy.IncludeSubDepartments = true;
            busUserSettings.SaveSMSSetting(smsSet, proxy);
            ClearSession();
            smsSet = busUserSettings.GetSMSSetting(ADOPerson1.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);

            smsSet = busUserSettings.GetSMSSetting(ADOPerson2.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);

            smsSet = busUserSettings.GetSMSSetting(ADOPerson3.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);
        }
Пример #2
0
 /// <summary>
 /// Constructor for dependency injection
 /// </summary>
 /// <param name="dataService">DI Database service</param>
 /// <param name="smsSender">DI SMS service</param>
 /// <param name="emailSender">DI Email service</param>
 /// <param name="emailSender">DI SMS Settings options</param>
 public CovidNotifier(IDataService dataService, SMSService smsService, EmailService emailService, IOptions <SMSSettings> settings)
 {
     _dataService  = dataService;
     _smsService   = smsService;
     _emailService = emailService;
     _smsSettings  = settings.Value;
 }
Пример #3
0
 private SMSSettings GetSMSSettings(UserSettings userSettings)
 {
     if (userSettings != null && userSettings.ID > 0)
     {
         if (userSettings.SMSSettings != null && userSettings.SMSSettings.ID > 0)
         {
             return(userSettings.SMSSettings);
         }
         else
         {
             IList <SMSSettings> smsSettingList = smsSettingRep.GetByCriteria(new CriteriaStruct(Utility.GetPropertyName(() => new SMSSettings().UserSetting), new UserSettings()
             {
                 ID = userSettings.ID
             }));
             if (smsSettingList != null && smsSettingList.Count > 0)
             {
                 return(smsSettingList.First());
             }
             else
             {
                 SMSSettings obj = new SMSSettings();
                 obj.ID          = userSettings.ID;
                 obj.UserSetting = userSettings;
                 obj.Active      = false;
                 smsSettingRep.Save(obj);
                 return(obj);
             }
         }
     }
     return(null);
 }
Пример #4
0
        public void SaveSMSSetting(SMSSettings setting, PersonAdvanceSearchProxy proxy)
        {
            try
            {
                ISearchPerson  searchTool = new BPerson();
                IList <Person> list;

                //don't select count
                if (proxy.PersonId > 0)
                {
                    list = searchTool.GetPersonInAdvanceSearch(proxy, 0, 1, PersonCategory.Public);
                }
                else
                {
                    list = searchTool.GetPersonInAdvanceSearch(proxy);
                }
                var l = from o in list
                        select o;
                list = l.ToList <Person>();

                foreach (Person prs in list)
                {
                    this.SaveSMSSetting(setting, prs.User);
                }
            }
            catch (Exception ex)
            {
                LogException(ex, "BUserSettings", "SaveSMSSettingsAdvanceSearch");
                throw ex;
            }
        }
Пример #5
0
        public bool PutSettings(SMSSettings o)
        {
            bool ret = SMSSettings.RebootNeeded(Settings, o);

            Settings = o;
            return(ret);
        }
Пример #6
0
        public void SaveSMSSettings_ByQuickSearch()
        {
            SMSSettings smsSet = new SMSSettings();

            smsSet.Active     = true;
            smsSet.SendByDay  = true;
            smsSet.TheDayHour = "13:10";
            smsSet.TheHour    = "10:10";
            smsSet.DayCount   = 5;
            ClearSession();
            busUserSettings.SaveSMSSetting(smsSet, "TestAli");
            ClearSession();
            smsSet = busUserSettings.GetSMSSetting(ADOPerson1.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);

            smsSet = busUserSettings.GetSMSSetting(ADOPerson2.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);

            smsSet = busUserSettings.GetSMSSetting(ADOPerson3.ID);
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
            Assert.AreEqual(5, smsSet.DayCount);
        }
Пример #7
0
 public void SetUp()
 {
     settings              = new SMSSettings();
     settings.CountryCode  = "+7";
     settings.NumberLength = 10;
     formatter             = new PhoneNumberFormatter(settings);
 }
Пример #8
0
        public bool PutSettings(object o)
        {
            SMSSettings n   = (SMSSettings)o;
            bool        ret = SMSSettings.RebootNeeded(Settings, n);

            Settings = n;
            return(ret);
        }
Пример #9
0
        public IActionResult SMS()
        {
            SMSSettings model = new SMSSettings();
            Dictionary <string, string> dic = settingService.GetConfigByGroupId((int)SettingEnum.SMS);

            if (dic != null)
            {
                model          = new SMSSettings(dic);
                model.Password = desEncrypt.Decrypt(model.Password);
            }
            return(View(model));
        }
Пример #10
0
 public void SaveSMSSetting(SMSSettings setting)
 {
     try
     {
         this.SaveSMSSetting(setting, BUser.CurrentUser);
     }
     catch (Exception ex)
     {
         LogException(ex, "BUserSettings", "SaveSMSSettings");
         throw ex;
     }
 }
Пример #11
0
        /// <summary>
        /// Install plugin
        /// </summary>
        public override void Install()
        {
            var settings = new SMSSettings
            {
                ProviderName    = "Twilio",
                Active          = true,
                BaseURL         = "https://api.infobip.com", //NOP 3.821
                Resource        = "sms/1/text/single",       //NOP 3.821
                CountryCode     = "90",                      //NOP 3.821
                PhoneNumber     = "5327801742",
                UserName        = "******",
                Password        = "******",
                AccountSid      = "your_account_sid",
                AuthToken       = "your_auth_token",
                MessageTemplate = "Your activation code is"
            };

            _settingService.SaveSetting(settings);

            _objectContext.Install();

            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.ProviderName", "Provide Name");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.Active", "Active");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.BaseURL", "API Url");         //NOP 3.821
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.Resource", "API Endpoint");   //NOP 3.821
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.CountryCode", "CountryCode"); //NOP 3.821
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.PhoneNumber", "Phone Number to send sms from");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.UserName", "UserName");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.Password", "Password");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.AccountSid", "AccountSid");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.AuthToken", "AuthToken");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.MessageTemplate", "MessageTemplate");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.PhoneNumberFormat", "Please specify phone number in format XXXXXXXXXX");

            //BUGFIX 3.812
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.ProviderNameTr", "Sağlayıcı İsmi");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.ActiveTr", "Aktif/Pasif");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.BaseURLTr", "API Url");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.ResourceTr", "API Endpoint");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.CountryCodeTr", "Ülke Kodu");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.PhoneNumberTr", "SMS Numarası");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.UserNameTr", "Kullanıcı Adı");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.PasswordTr", "Şifre");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.AccountSidTr", "AccountSid");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.AuthTokenTr", "AuthToken");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.MessageTemplateTr", "Mesaj şablonu");
            this.AddOrUpdatePluginLocaleResource("Plugins.Misc.SMS.PhoneNumberFormatTr", "Lütfen +XXXXXXXXXXX formatında giriniz");


            PluginManager.MarkPluginAsInstalled(this.PluginDescriptor.SystemName);
            base.Install();
        }
Пример #12
0
 public UserController(ISmsSender smsSender,
                       AppDbContext appDbContext,
                       IOptions <TokenSettings> tokenSettings,
                       IOptions <SMSSettings> smsSettings,
                       JwtSettings jwtSettings)
 {
     _smsSender     = smsSender;
     _dbContext     = appDbContext;
     _tokenSettings = tokenSettings.Value;
     _jwtSettings   = jwtSettings;
     _SMSSettings   = smsSettings.Value;
     hotp           = new Hotp(Encoding.ASCII.GetBytes(_SMSSettings.OTPSecretKey), mode: OtpHashMode.Sha256, hotpSize: 6);
 }
Пример #13
0
        /// <summary>
        /// Constructor for SMS Service. Takes dependency injected services to
        /// send SMS notifications.
        /// </summary>
        /// <param name="smsSender">The <see cref="ISMSSender"/> implementation to use in this SMS Service</param>
        /// <param name="logger">The <see cref="ILogger"/> to be used in logging</param>
        /// <param name="dataService">The <see cref="IDataService"/> used for data access</param>
        /// <param name="settings">DI <see cref="SMSSettings"/> for the application.</param>
        public SMSService(ISMSSender smsSender, ILogger <SMSService> logger, IDataService dataService, IOptions <SMSSettings> settings)
        {
            _smsSender   = smsSender;
            _logger      = logger;
            _dataService = dataService;
            _smsSettings = settings.Value;
            var maxDelay = TimeSpan.FromSeconds(36);
            var delay    = Backoff.DecorrelatedJitterBackoffV2(medianFirstRetryDelay: TimeSpan.FromSeconds(1), retryCount: 50)
                           .Select(s => TimeSpan.FromTicks(Math.Min(s.Ticks, maxDelay.Ticks)));

            _retryPolicy = Policy
                           .Handle <Exception>()
                           .WaitAndRetryAsync(delay);
        }
Пример #14
0
 public IActionResult SMS(SMSSettings model)
 {
     if (model != null)
     {
         model.Password = desEncrypt.Encrypt(model.Password);
         bool result = settingService.SaveSMS(model);
         messages.Msg     = result ? "保存成功" : "保存失败";
         messages.Success = result;
     }
     else
     {
         messages.Msg = "请填写完整";
     }
     return(Json(messages));
 }
Пример #15
0
        protected void userSettingSaveBtn_Click(object sender, EventArgs e)
        {
            BUserSettings bus     = new BUserSettings();
            EmailSettings setting = new EmailSettings()
            {
                Active = true, SendByDay = false, TheHour = "10:00"
            };
            SMSSettings setting1 = new SMSSettings()
            {
                Active = true, SendByDay = true, TheDayHour = "10:00"
            };

            bus.SaveEmailSetting(setting);
            bus.SaveSMSSetting(setting1);
        }
Пример #16
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

            SMSSettings smsSettings = new SMSSettings();

            Configuration.GetSection("SMSSettings").Bind(smsSettings);
            services.AddSingleton <SMSSettings>(smsSettings);

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
        }
Пример #17
0
 public SMSSettings GetSMSSetting()
 {
     try
     {
         UserSettings userSetting = this.GetUserSettings(BUser.CurrentUser);
         SMSSettings  settings    = this.GetSMSSettings(userSetting);
         settings.TheDayHour = Utility.IntTimeToRealTime(settings.DayHour);
         settings.TheHour    = Utility.IntTimeToRealTime(settings.Hour);
         return(settings);
     }
     catch (Exception ex)
     {
         LogException(ex, "BUserSettings", "GetSMSSetting");
         throw ex;
     }
 }
Пример #18
0
 public void SaveSMSSetting(SMSSettings setting, decimal personId)
 {
     try
     {
         ISearchPerson            searchTool = new BPerson();
         PersonAdvanceSearchProxy proxy      = new PersonAdvanceSearchProxy()
         {
             PersonId = personId
         };
         this.SaveSMSSetting(setting, proxy);
     }
     catch (Exception ex)
     {
         LogException(ex, "BUserSettings", "SaveSMSSettings");
         throw ex;
     }
 }
Пример #19
0
        public SMSSettings GetSMSSetting(decimal personID)
        {
            try
            {
                Person       person      = new BPerson().GetByID(personID);
                UserSettings userSetting = this.GetUserSettings(person.User);
                SMSSettings  settings    = this.GetSMSSettings(userSetting);

                settings.TheDayHour = Utility.IntTimeToRealTime(settings.DayHour);
                settings.TheHour    = Utility.IntTimeToRealTime(settings.Hour);
                return(settings);
            }
            catch (Exception ex)
            {
                LogException(ex, "BUserSettings", "GetSMSSetting");
                throw ex;
            }
        }
Пример #20
0
 public void SaveSMSSettings_MinTimeValidation_Test()
 {
     try
     {
         SMSSettings emailSet = new SMSSettings();
         emailSet           = busUserSettings.GetSMSSetting(ADOPerson1.ID);
         emailSet.Active    = true;
         emailSet.SendByDay = false;
         emailSet.TheHour   = "00:03";
         ClearSession();
         busUserSettings.SaveSMSSetting(emailSet, ADOPerson1.ID);
         Assert.Fail();
     }
     catch (UIValidationExceptions ex)
     {
         Assert.IsTrue(ex.Exists(ExceptionResourceKeys.UserSet_SMSTimeLessThanMin));
     }
 }
Пример #21
0
        public void SaveSMSSettings_CurrentUSer()
        {
            base.UpdateCurrentUserPersonId(ADOPerson1.ID);
            SMSSettings smsSet = new SMSSettings();

            smsSet            = busUserSettings.GetSMSSetting();
            smsSet.Active     = true;
            smsSet.SendByDay  = true;
            smsSet.TheDayHour = "13:10";
            smsSet.TheHour    = "10:10";
            smsSet.DayCount   = 5;
            ClearSession();
            busUserSettings.SaveSMSSetting(smsSet);
            ClearSession();
            smsSet = busUserSettings.GetSMSSetting();
            Assert.IsTrue(smsSet.SendByDay);
            Assert.IsTrue(smsSet.Active);
            Assert.AreEqual(790, smsSet.DayHour);
        }
Пример #22
0
 public void SaveSMSSettings_ZeroValidationByDay_Test()
 {
     try
     {
         SMSSettings emailSet = new SMSSettings();
         emailSet            = busUserSettings.GetSMSSetting(ADOPerson1.ID);
         emailSet.Active     = true;
         emailSet.SendByDay  = true;
         emailSet.TheDayHour = "00:00";
         emailSet.TheHour    = "10:10";
         emailSet.DayCount   = 5;
         ClearSession();
         busUserSettings.SaveSMSSetting(emailSet, ADOPerson1.ID);
         Assert.Fail();
     }
     catch (UIValidationExceptions ex)
     {
         Assert.IsTrue(ex.Exists(ExceptionResourceKeys.UserSet_SMSTimeIsNotValid));
     }
 }
Пример #23
0
        public void SaveSMSSetting(SMSSettings setting, string QuickSearch)
        {
            try
            {
                ISearchPerson  searchTool = new BPerson();
                IList <Person> list       = searchTool.QuickSearch(QuickSearch, PersonCategory.Public);
                var            l          = from o in list
                                            select o;
                list = l.ToList <Person>();

                foreach (Person prs in list)
                {
                    this.SaveSMSSetting(setting, prs.User);
                }
            }
            catch (Exception ex)
            {
                LogException(ex, "BUserSettings", "SaveSMSSettingsQuickSearch");
                throw ex;
            }
        }
Пример #24
0
        /// <summary>
        /// 添加短信配置数据
        /// </summary>
        /// <param name="model">短信配置Model</param>
        public bool SaveSMS(SMSSettings model)
        {
            int flag = (int)SettingEnum.SMS;

            using (DataTable dt = new DataTable())
            {
                dt.Columns.Add("S_GROUPID", typeof(string));
                dt.Columns.Add("S_NAME", typeof(string));
                dt.Columns.Add("S_VALUE", typeof(string));
                PropertyInfo[] properties = model.GetType().GetProperties();
                foreach (PropertyInfo property in properties)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = flag;
                    dr[1] = property.Name;
                    dr[2] = property.GetValue(model, null);
                    dt.Rows.Add(dr);
                }
                return(this.Save(dt, flag) > 0);
            }
        }
Пример #25
0
        public void SaveEmail_SMS_Settings_ByPersonId_checkConfilict()
        {
            EmailSettings emailSet = new EmailSettings();

            emailSet            = busUserSettings.GetEmailSetting(ADOPerson1.ID);
            emailSet.Active     = true;
            emailSet.SendByDay  = true;
            emailSet.TheDayHour = "13:10";
            emailSet.TheHour    = "10:10";
            emailSet.DayCount   = 5;
            ClearSession();
            busUserSettings.SaveEmailSetting(emailSet, ADOPerson1.ID);
            ClearSession();
            emailSet = busUserSettings.GetEmailSetting(ADOPerson1.ID);
            Assert.AreEqual(790, emailSet.DayHour);

            SMSSettings smsSet = new SMSSettings();

            smsSet            = busUserSettings.GetSMSSetting(ADOPerson1.ID);
            smsSet.Active     = true;
            smsSet.SendByDay  = true;
            smsSet.TheDayHour = "13:10";
            smsSet.TheHour    = "10:10";
            smsSet.DayCount   = 5;
            ClearSession();
            busUserSettings.SaveSMSSetting(smsSet, ADOPerson1.ID);
            ClearSession();
            smsSet = busUserSettings.GetSMSSetting(ADOPerson1.ID);
            Assert.AreEqual(790, smsSet.DayHour);

            ClearSession();
            emailSet = busUserSettings.GetEmailSetting(ADOPerson1.ID);
            Assert.AreEqual(790, emailSet.DayHour);
            ClearSession();
            smsSet = busUserSettings.GetSMSSetting(ADOPerson1.ID);
            Assert.AreEqual(790, smsSet.DayHour);
        }
Пример #26
0
 public static bool RebootNeeded(SMSSettings x, SMSSettings y)
 {
     return(false);
 }
Пример #27
0
 public SMS(SMSSettings _settings, SMSSecurity _security, SMSMessage _message)
 {
     settings = _settings;
     security = _security;
     message  = _message;
 }
Пример #28
0
 public SMS()
 {
     settings = new SMSSettings();
     security = new SMSSecurity();
     message  = new SMSMessage();
 }
Пример #29
0
 public SMSruSender(IHttpClientFactory clientFactory, IOptions <SMSSettings> SMSSettings)
 {
     _clientFactory = clientFactory;
     _SMSSettings   = SMSSettings.Value;
 }
Пример #30
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);
        }
    }
Пример #31
0
			public static bool RebootNeeded(SMSSettings x, SMSSettings y)
			{
				return false;
			}