public void SaveReportSettings(AgrimanagrReportSettingViewModel setting)
        {
            var reporturl = _settingsRepository.GetByKey(SettingsKeys.ReportServerUrl);
            if (reporturl == null) reporturl = new AppSettings(Guid.NewGuid());
            reporturl.Key = SettingsKeys.ReportServerUrl;
            reporturl.Value = setting.Server;
            _settingsRepository.Save(reporturl);

            var reportusername = _settingsRepository.GetByKey(SettingsKeys.ReportServerUsername);
            if (reportusername == null) reportusername = new AppSettings(Guid.NewGuid());
            reportusername.Key = SettingsKeys.ReportServerUsername;
            reportusername.Value = setting.ReportUsername;
            _settingsRepository.Save(reportusername);

            var reportpassword = _settingsRepository.GetByKey(SettingsKeys.ReportServerPassword);
            if (reportpassword == null) reportpassword = new AppSettings(Guid.NewGuid());
            reportpassword.Key = SettingsKeys.ReportServerPassword;
            reportpassword.Value = VCEncryption.EncryptString(setting.ReportPassword);
            _settingsRepository.Save(reportpassword);

            var reportfolder = _settingsRepository.GetByKey(SettingsKeys.ReportServerFolder);
            if (reportfolder == null) reportfolder = new AppSettings(Guid.NewGuid());
            reportfolder.Key = SettingsKeys.ReportServerFolder;
            reportfolder.Value = setting.ReportFolder;
            _settingsRepository.Save(reportfolder);
        }
Example #2
0
 public ActionResult ReportSetting()
 {
     var setting = new AgrimanagrReportSettingViewModel();
     var server = _settingsRepository.GetByKey(SettingsKeys.ReportServerUrl);
     if (server != null) setting.Server = server.Value;
     var username = _settingsRepository.GetByKey(SettingsKeys.ReportServerUsername);
     if (username != null) setting.ReportUsername = username.Value;
     return View(setting);
 }
Example #3
0
 public ActionResult ReportSetting(AgrimanagrReportSettingViewModel model)
 {
     try
     {
         _settingsViewModelBuilder.SaveReportSettings(model);
         ValidationSummary.DomainValidationErrors("Settings Successfully Saved", ModelState);
         return View("ReportSetting", model);
     }
     catch (DomainValidationException ve)
     {
         ValidationSummary.DomainValidationErrors(ve, ModelState);
         TempData["msg"] = "Validation Errors, Unable to save settings\n" + ve.Message;
     }
     return View("ReportSetting",model);
 }