Example #1
0
        public ActionResult NotificationSetting(NotificationSettingsViewModel model)
        {
            try
            {

                _agrimanagrSettingsViewModelBuilder.SaveNotificationSettings(model);
                ValidationSummary.DomainValidationErrors("Settings Successfully Saved", ModelState);
                return View(model);
            }
            catch (DomainValidationException ve)
            {
                ValidationSummary.DomainValidationErrors(ve, ModelState);
                TempData["msg"] = "Validation Errors, Unable to save settings\n" + ve.Message;
            }
            return View(model);
        }
Example #2
0
        public ActionResult NotificationSetting()
        {
            var model = new NotificationSettingsViewModel();
            var smtphost = _settingsRepository.GetByKey(SettingsKeys.SmtpHost);
            if (smtphost != null) model.SmtpHost = smtphost.Value;

            var smtpport = _settingsRepository.GetByKey(SettingsKeys.SmptPort);
            if (smtpport != null) model.SmtpPort = smtpport.Value;

            var smtpemail = _settingsRepository.GetByKey(SettingsKeys.SmptEmail);
            if (smtpemail != null) model.SmtpCompanyEmail = smtpemail.Value;

            var smtpusername = _settingsRepository.GetByKey(SettingsKeys.SmptUsername);
            if (smtpusername != null) model.SmtpUsername = smtpusername.Value;

            var smtppassword = _settingsRepository.GetByKey(SettingsKeys.SmptPassword);
            if (smtppassword != null) model.SmtpPassword = VCEncryption.DecryptString(smtppassword.Value);

            var smsuri = _settingsRepository.GetByKey(SettingsKeys.SmsUri);
            if (smsuri != null) model.SmsUri = smsuri.Value;

            var allowEmail = _settingsRepository.GetByKey(SettingsKeys.AllowSendEmail);
            if (allowEmail != null)
            {
                bool cansendemail = false;
                bool.TryParse(allowEmail.Value, out cansendemail);
                model.SendEmail = cansendemail;
            }
            var allowSms = _settingsRepository.GetByKey(SettingsKeys.AllowSendSms);
            if (allowSms != null)
            {
                bool cansendsms = false;
                bool.TryParse(allowSms.Value, out cansendsms);
                model.SendSms = cansendsms;
            }

            var allowOrdersale = _settingsRepository.GetByKey(SettingsKeys.AllowOrderSaleNotification);
            if (allowOrdersale != null)
            {
                bool allow = false;
                bool.TryParse(allowOrdersale.Value, out allow);
                model.AllowOrderSale = allow;
            }
            var allowreceipt = _settingsRepository.GetByKey(SettingsKeys.AllowReceiptNotification);
            if (allowreceipt != null)
            {
                bool allow = false;
                bool.TryParse(allowreceipt.Value, out allow);
                model.AllowReceipt = allow;
            }
            var allowInvoice = _settingsRepository.GetByKey(SettingsKeys.AllowInvoiceNotification);
            if (allowInvoice != null)
            {
                bool allow = false;
                bool.TryParse(allowInvoice.Value, out allow);
                model.AllowInvoice = allow;
            }
            var allowDispatch = _settingsRepository.GetByKey(SettingsKeys.AllowDispatchNotification);
            if (allowDispatch != null)
            {
                bool allow = false;
                bool.TryParse(allowDispatch.Value, out allow);
                model.AllowDispatch = allow;
            }
            var allowDelivery = _settingsRepository.GetByKey(SettingsKeys.AllowDeliveryNotification);
            if (allowDelivery != null)
            {
                bool allow = false;
                bool.TryParse(allowDelivery.Value, out allow);
                model.AllowDelivery = allow;
            }

            return View(model);
        }