public async Task<bool> SendRequest() { try { var config = new ConfigurationViewModel(); var uri = new Uri(config.Uri + _path); var filter = new HttpBaseProtocolFilter(); if (config.IsSelfSigned == true) { filter.IgnorableServerCertificateErrors.Add(ChainValidationResult.Untrusted); filter.IgnorableServerCertificateErrors.Add(ChainValidationResult.InvalidName); } var httpClient = new HttpClient(filter); httpClient.DefaultRequestHeaders.Accept.Clear(); httpClient.DefaultRequestHeaders.Accept.Add(new HttpMediaTypeWithQualityHeaderValue("text/plain")); httpClient.DefaultRequestHeaders.UserAgent.Add(new HttpProductInfoHeaderValue(new HttpProductHeaderValue("Mozilla", "5.0").ToString())); httpClient.DefaultRequestHeaders.UserAgent.Add(new HttpProductInfoHeaderValue(new HttpProductHeaderValue("Firefox", "26.0").ToString())); var reponse = await httpClient.GetAsync(uri); httpClient.Dispose(); return reponse.IsSuccessStatusCode; } catch (Exception) { return false; } }
private ConfigurationViewModel GetConfigurationViewModel() { var configurationViewModel = new ConfigurationViewModel(); var bgImageUrlBase64 = Request.Cookies[DemoCookies.BgImageKey]; var logoImageUrlBase64 = Request.Cookies[DemoCookies.LogoImageKey]; var defaultSusiPolicy = Request.Cookies[DemoCookies.DefaultSigninPolicyKey]; var industry = Request.Cookies[DemoCookies.IndustryKey]; if (!string.IsNullOrEmpty(bgImageUrlBase64)) { configurationViewModel.BgImageUrl = bgImageUrlBase64.ToBase64Decode(); } if (!string.IsNullOrEmpty(logoImageUrlBase64)) { configurationViewModel.LogoImageUrl = logoImageUrlBase64.ToBase64Decode(); } if (!string.IsNullOrEmpty(defaultSusiPolicy)) { configurationViewModel.DefaultSUSIPolicy = defaultSusiPolicy.ToBase64Decode(); } configurationViewModel.PolicyList = _policyManager.PolicyList; configurationViewModel.IndustryList = _industryManager.IndustryList; configurationViewModel.Industry = industry?.ToBase64Decode() ?? _industryManager.IndustryList.First(); return(configurationViewModel); }
public ctlConfigurationDocWriter() { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel ViewModel = new ConfigurationViewModel(); }
public ctlConfigurationBookLibrary() { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel ViewModel = new ConfigurationViewModel(); }
public ActionResult Index() { try { ConfigurationViewModel smartTrack = new ConfigurationViewModel(); EmployeeDAL employeeDAL = new EmployeeDAL(); smartTrack.SearchedUserDetails = new SearchedUserDetails(); ViewBag.AsciiKey = Session["SecurityKey"].ToString(); string employeeCode = Membership.GetUser().UserName; int employeeId = employeeDAL.GetEmployeeID(employeeCode); string[] role = Roles.GetRolesForUser(employeeCode); if (employeeCode != null) { smartTrack.SearchedUserDetails.EmployeeId = employeeId; smartTrack.SearchedUserDetails.EmployeeCode = employeeCode; smartTrack.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role); } return(View(smartTrack)); } catch { throw; } }
public ctlConfigurationDevConferences() { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel ViewModel = new ConfigurationViewModel(); }
public ConfigurationView() { InitializeComponent(); ConfigurationViewModel configurationView = new ConfigurationViewModel(); DataContext = configurationView; }
public ctlConfigurationSourceEditor() { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel ViewModel = new ConfigurationViewModel(); }
public Guid Order(ConfigurationViewModel configurationViewModel) { var configurationBo = configurationViewModel.MapToBusinessObject(_dbContext); configurationBo.ConfigurationId = Guid.NewGuid(); var user = _dbContext.Users.SingleOrDefault(_ => _.Email == configurationViewModel.Email) ?? new User { UserId = Guid.NewGuid(), Email = configurationViewModel?.Email }; var order = new Order { OrderId = Guid.NewGuid(), Created = DateTime.Now, Configuration = configurationBo, User = user, Price = configurationViewModel?.Price }; configurationBo.Order = order; _dbContext.Configurations.Add(configurationBo); _dbContext.Users.AddOrUpdate(user); _dbContext.Orders.Add(order); _dbContext.SaveChanges(); return(order.OrderId); }
public ActionResult Edit(int id, ConfigurationViewModel viewModel) { try { if (!ModelState.IsValid) { return(View()); } else { var entity = new ConfigurationEntity(); entity.Id = viewModel.Id; entity.ApplicationId = viewModel.ApplicationId; entity.DataType = viewModel.DataType; entity.IsActive = viewModel.IsActive; entity.Key = viewModel.Key; entity.Value = viewModel.Value; entity.IsNew = viewModel.IsNew; entity.IsProcessed = viewModel.IsProcessed; this.configurationRepository.Edit(id, entity); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ItemSetGenerator(ConfigurationViewModel config, Action <string> logHandler, Action <double> updateProgressHandler) { BuildSourceName = typeof(T).Name; Configuration = config; LogHandler = logHandler; UpdateProgressHandler = updateProgressHandler; }
public static void AddDocuments() { _globalVM = new GlobalViewModel(VM); _configVM = new ConfigurationViewModel(VM); _clearConfigButton.Command = new RelayCommand(_configVM.ClearConfig, ReturnTrue); _loadXmlConfigButton.Command = new RelayCommand(_configVM.LoadXmlConfig, _configVM.ReturnTrue); _saveXmlConfigButton.Command = new RelayCommand(_configVM.SaveXmlConfig, _configVM.ReturnTrue); _loadIniConfigButton.Command = new RelayCommand(_configVM.LoadIniConfig, _configVM.ReturnTrue); _saveIniConfigButton.Command = new RelayCommand(_configVM.SaveIniConfig, _configVM.ReturnTrue); _dbVM = new DatabaseViewModel(VM); _httpVM = new HttpServerViewModel(VM); _tcpVM = new TcpServerViewModel(VM); _reportingVM = new ReportingViewModel(VM); _propertyVM = new PropertyViewModel(VM); VM.Documents.Add(_globalVM); VM.Documents.Add(_configVM); VM.Documents.Add(_dbVM); VM.Documents.Add(_httpVM); VM.Documents.Add(_tcpVM); VM.Documents.Add(_reportingVM); VM.Tools.Add(_propertyVM); }
// // GET: /Configuration/ public ActionResult Index() { try { ConfigurationViewModel configviewmodel = new ConfigurationViewModel(); CommonMethodsDAL Commondal = new CommonMethodsDAL(); EmployeeDAL employeeDAL = new EmployeeDAL(); configviewmodel.SearchedUserDetails = new SearchedUserDetails(); ViewBag.AsciiKey = Session["SecurityKey"].ToString(); string employeeCode = Membership.GetUser().UserName; int employeeId = employeeDAL.GetEmployeeID(employeeCode); string[] role = Roles.GetRolesForUser(employeeCode); if (employeeCode != null) { configviewmodel.SearchedUserDetails.EmployeeId = employeeId; configviewmodel.SearchedUserDetails.EmployeeCode = employeeCode; configviewmodel.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role); } return(View(configviewmodel)); } catch (Exception) { throw; } }
private void SaveConfiguration() { if (File.Exists(_pathFileFormState)) { File.Delete(_pathFileFormState); } var configuration = GetConfiguration(); var configurationViewModel = new ConfigurationViewModel { Directory = configuration.ProjectDirectory.Path, Filters = txtFilters.Text }; foreach (var subs in configuration.Substitutions) { configurationViewModel.Substitutions.Add( new ReplacementViewModel { Find = subs.Find, ReplaceWith = subs.ReplaceWith }); } var serializeService = new SerializeService <ConfigurationViewModel>(); serializeService.Serialize(configurationViewModel, _pathFileFormState); }
public ActionResult Index(ConfigurationViewModel model) { if (ModelState.IsValid) { var appSetting = _cfgSvc.GetSingle(d => d.Id == model.Id); if (appSetting == null) { ModelState.AddModelError("", $"Cannot find app settings for Id {model.Id}"); } else { var hasChanged = !appSetting.Value.Equals(model.Value, StringComparison.OrdinalIgnoreCase); if (hasChanged) { appSetting.Value = model.Value; _cfgSvc.Update(appSetting); TempData["SuccessMessage"] = "Changes have been successfully saved"; return(RedirectToAction("Index", new { id = "" })); } TempData["WarningMessage"] = "There were no changes saved"; return(RedirectToAction("Index", new { id = "" })); } } return(View("Edit", model)); }
public ActionResult Index() { try { ConfigurationViewModel orbit = new ConfigurationViewModel(); EmployeeDAL employeeDAL = new EmployeeDAL(); orbit.SearchedUserDetails = new SearchedUserDetails(); ViewBag.AsciiKey = Session["SecurityKey"].ToString(); string employeeCode = Membership.GetUser().UserName; int employeeId = employeeDAL.GetEmployeeID(employeeCode); string[] role = Roles.GetRolesForUser(employeeCode); if (employeeCode != null) { orbit.SearchedUserDetails.EmployeeId = employeeId; SemDAL semdal = new SemDAL(); int employeeid = semdal.geteEmployeeIDFromSEMDatabase(employeeCode); orbit.SearchedUserDetails.IsProjectReviewer = semdal.CheckIfEmployeeisReviewer(employeeid); orbit.SearchedUserDetails.EmployeeCode = employeeCode; orbit.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role); } return(View(orbit)); } catch { throw; } }
public ctlConfigurationBlogReader(ConfigurationViewModel viewModel) { // Inicializa los componentes InitializeComponent(); // Inicializa el ViewModel DataContext = ViewModel = viewModel; }
public EditAdditionalApplicationCommand(ConfigurationViewModel viewModel, INavigator navigator) { Ensure.NotNull(viewModel, "viewModel"); Ensure.NotNull(navigator, "navigator"); this.viewModel = viewModel; this.navigator = navigator; }
public ActionResult Detail(long id) { if (CurrentUser.UserRole == Enums.UserRole.Viewer) { AddMessageInfo("Operation not allow", Enums.MessageInfoType.Error); return(RedirectToAction("Index")); } var model = new ConfigurationViewModel(); var data = configService.GetConfigDataByID(id); var changeHistoryList = _changesHistoryBll.GetByFormTypeAndFormId(Enums.MenuList.Configuration, id.ToString()); var typeList = configService.GetAllType().Select(item => new ConfigurationCreateViewModel() { ConfigType = item.SYS_REFFERENCES_TYPE1, ConfigText = item.SYS_REFFERENCES_TEXT }); try { model = Mapper.Map <ConfigurationViewModel>(data); model.ChangesHistoryList = Mapper.Map <List <ChangesHistoryItemModel> >(changeHistoryList); model.TypeList = GenericHelpers <ConfigurationCreateViewModel> .GenerateList(typeList, item => item.ConfigType, item => item.ConfigText); } catch (Exception ex) { AddMessageInfo(ex.Message, Enums.MessageInfoType.Error); } model.MainMenu = _mainMenu; model.CurrentMenu = PageInfo; model.IsNotViewer = (CurrentUser.UserRole != Enums.UserRole.Viewer); return(View("Detail", model)); }
public ActionResult Create(ConfigurationViewModel viewModel) { try { if (!ModelState.IsValid) { return(View()); } else { ConfigurationEntity entity = new ConfigurationEntity(); entity.ApplicationId = viewModel.ApplicationId; entity.DataType = viewModel.DataType; entity.Value = viewModel.Value; entity.Key = viewModel.Key; entity.IsActive = false; entity.IsNew = false; OperationResult <bool> result = this.configurationRepository.Save(entity); } return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult <ConfigurationViewModel> Get(string id) { ConfigurationViewModel result = null; try { if (string.IsNullOrEmpty(id)) { return(BadRequest("bad request..")); } var config = new ConfigurationViewModelParam() { ConfigGUID = id }; result = _businessAccess.GetConfiguration(config); if (string.IsNullOrEmpty(result.SiteConfiguration.WebsiteConfigurationName)) { return(NotFound(id)); } } catch (Exception ex) { _log.Write("Exception in ConfigurationController; Message: " + ex.Message); } finally { } return(Ok(result)); }
public void SetConfiguration() { var siteSetting = _siteSettingRepository.Single(); var mailSetting = _mailSettingRepository.Single(); var ssoSetting = _ssoSettingRepository.Single(); var configuration = new ConfigurationViewModel() { MailSetting = new MailSettingViewModel(), SSOSetting = new SSOSettingViewModel(), SiteSetting = new SiteSettingViewModel() }; if (siteSetting != null) { PropertyCopy.Copy(siteSetting, configuration.SiteSetting); } if (mailSetting != null) { PropertyCopy.Copy(mailSetting, configuration.MailSetting); } if (ssoSetting != null) { PropertyCopy.Copy(ssoSetting, configuration.SSOSetting); } SetConfiguration(configuration); }
public ActionResult Index() { try { Session["SearchEmpFullName"] = null; // to hide emp search Session["SearchEmpCode"] = null; Session["SearchEmpID"] = null; ConfigurationViewModel pms = new ConfigurationViewModel(); EmployeeDAL employeeDAL = new EmployeeDAL(); pms.SearchedUserDetails = new SearchedUserDetails(); ViewBag.AsciiKey = Session["SecurityKey"].ToString(); string employeeCode = Membership.GetUser().UserName; int employeeId = employeeDAL.GetEmployeeID(employeeCode); string[] role = Roles.GetRolesForUser(employeeCode); if (employeeCode != null) { pms.SearchedUserDetails.EmployeeId = employeeId; pms.SearchedUserDetails.EmployeeCode = employeeCode; pms.SearchedUserDetails.UserRole = Commondal.GetMaxRoleForUser(role); } return(View(pms)); } catch { throw; } }
public CreateAdditionalApplicationCommand(ConfigurationViewModel viewModel, INavigator navigator) { Ensure.NotNull(viewModel, "viewModel"); Ensure.NotNull(navigator, "navigator"); this.viewModel = viewModel; this.navigator = navigator; }
public void Update(ConfigurationViewModel configuration, string propertyName, object newValue) { switch (propertyName) { case nameof(ConfigurationViewModel.EquipmentValues): if (newValue is IEnumerable <string> array) { configuration.EquipmentValues = array.Select(int.Parse).ToList(); } else { configuration.EquipmentValues.Clear(); } break; default: var propertyInfo = configuration?.GetType().GetProperty(propertyName); if (configuration == null || propertyInfo == null) { throw new ArgumentException("Current configuration and updated property must not be null"); } typeof(UpdateService).CallGeneric(nameof(UpdateGeneric), new[] { configuration.GetType(), propertyInfo.PropertyType }, new[] { configuration, propertyInfo.AsLambdaExpression(), ((Array)newValue)?.GetValue(0) }); break; } }
public CloseSettingsCommand(PageViewModel pageViewModel, ConfigurationViewModel configurationViewModel, BuildsOverviewViewModel buildsOverviewViewModel, IConfigManager configManager) { _pageViewModel = pageViewModel; _configurationViewModel = configurationViewModel; _buildsOverviewViewModel = buildsOverviewViewModel; _configManager = configManager; }
public ActionResult Upload(string configType) { var viewModel = new ConfigurationViewModel(); viewModel.ConfigType = configType; return(PartialView("_Upload", viewModel)); }
public ActionResult ConfigureApplication(ConfigurationViewModel model) { // Double Check - If the Application is alread configured, redirect to home if (new MasterPasswordManager().Exists()) { return(Redirect("~/")); } // ViewModel Validation if (!ModelState.IsValid) { return(View(model)); } // Do Configuration MasterPasswordManager mpManager = new MasterPasswordManager(); // Generate string mp = mpManager.Generate(model.Username, model.Password); // Save mpManager.Save(mp); return(Redirect("~/Account/ConfigureApplicationSuccess")); }
public IActionResult DataReaderConfig(ConfigurationViewModel configuration) { if (string.IsNullOrEmpty(configuration.SelectedInputType)) { return(View("Error", "You have selected nothing")); } else { var randomView = new RandomInputViewModel(); var fileView = new FileInputViewModel(); var k = configuration.SelectedInputType; switch (k) { case "Random": return(RedirectToAction("RandomInput", randomView)); case "Manually": return(RedirectToAction("NumInput", fileView)); case "FromFile": return(RedirectToAction("FileInput", fileView)); default: break; } return(RedirectToAction("Error")); } }
/// <summary> /// Inicializa el viewModel /// </summary> public void Initialize() { // Carga la configuración ConfigurationViewModel.Load(); // Arranca el procesador de descargas BlogDownloadProcess.Start(); }
public async Task <IActionResult> EditConfiguration(string id, ConfigurationViewModel ttsConfiguration) { if (ModelState.IsValid) { try { var result = await ttsConfiguration.SaveModelAsync().ConfigureAwait(false); //_repo.EditModelAsync(ttsConfiguration.ParseModel()); if (result.IsSucceed) { GlobalConfigurationService.Instance.RefreshConfigurations(); } } catch (DbUpdateConcurrencyException) { if (!ConfigurationViewModel.Repository.CheckIsExists(c => c.Specificulture == ttsConfiguration.Specificulture)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Configurations")); } return(View(ttsConfiguration)); }
[SuppressMessage("ReSharper", "SuggestBaseTypeForParameter")]// needed for DI public MainViewModel( Configuration config, ShortcutManager shortcutManager, // manually injecting all tabs for now, SourcesViewModel sourcesVm, // might want to replace this if more tabs get added ConfigurationViewModel configuration, DownloaderViewModel downloader, LibraryViewModel library) { DisplayName = WindowTitleBase; TabClosing = OnTabClosing; this.config = config; this.shortcutManager = shortcutManager; CreateShortcuts(); Items.AddRange(new TabViewModelBase[] { library, downloader, sourcesVm, configuration, }); library.ConductWith(this); downloader.ConductWith(this); sourcesVm.ConductWith(this); configuration.ConductWith(this); var tabId = config.State.ActiveTab ?? string.Empty; var tab = Items.FirstOrDefault(t => t.Id == tabId); if (tab != null) { ActivateItem(tab); } }
public ScriptViewModel(string iScriptName, int iID, int iOrdinal, int iConfigurationID) { ScriptName = iScriptName; IDScript = iID; Ordinal = iOrdinal; ConfigurationID = iConfigurationID; ConfigurationVM = new ConfigurationViewModel(); }
public MainPage() { var configFileLogic = new MetroConfigFileLogic(ApplicationData.Current.LocalFolder, "test.config"); _content = new ConfigurationViewModel(); _config = new ConfigurationManager(configFileLogic); this.InitializeComponent(); DataContext = this; }
public MainWindow() { var configPath = System.IO.Path.Combine(Environment.CurrentDirectory, "test.config"); var configFileLogic = new WpfConfigFileLogic(configPath); _content = new ConfigurationViewModel(); _config = new ConfigurationManager(configFileLogic); InitializeComponent(); DataContext = this; }
internal SaveConfigurationCommand(ConfigurationViewModel viewModel, Settings settings, IRunHotKeyService runHotKey, ShortcutService shortcutService) { Ensure.NotNull(viewModel, "viewModel"); Ensure.NotNull(settings, "settings"); Ensure.NotNull(runHotKey, "runHotKey"); Ensure.NotNull(shortcutService, "shortcutService"); this.viewModel = viewModel; this.settings = settings; this.runHotKey = runHotKey; this.shortcutService = shortcutService; }
public ActionResult Edit(ConfigurationViewModel model) { if (!this.ModelState.IsValid) { return this.View(model); } ConfigurationContract configuration = this.Services.Mapper.Map<ConfigurationContract, ConfigurationViewModel>(model); Response response = this.configurationService.Get(client => client.Save(configuration)); if (!response.Success) { this.ModelState.AddModelError("Error", "Hubo un problema guardando la configuración."); return this.View(model); } return this.RedirectToAction("Index", "Home"); }
public ConfigurationItemViewModel(ConfigurationViewModel configVM) { ConfigurationVM = configVM; Title = configVM.Title; }
public ScriptViewModel() { ConfigurationVM = new ConfigurationViewModel(); }