public bool InformationSystemInsert(InformationSystemModel models) { try { if (models == null) { return(false); } using (var db = new PORTALEntities()) { var item = new InformationSystem { MasterId = models.MasterId, System = models.System, Seriousness = models.Seriousness, Explanation = models.Explanation //EmpId = models.EmpIp }; db.InformationSystems.Add(item); db.SaveChanges(); return(true); } } catch (Exception ex) { LogHelper.Error("ApplicationMasterRepository InformationSystemInsert Insert: " + ex.Message + " Inner exception: " + ex.InnerException.Message); return(false); } }
public async Task <IActionResult> Edit(int id, [Bind("id,ListSystem,lvrol")] InformationSystem informationSystem) { if (id != informationSystem.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(informationSystem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InformationSystemExists(informationSystem.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(informationSystem)); }
public void GenerateNewDataSet() { IDataGenerator dataGenerator = Bootstrapper.ServiceLocator.GetService <IDataGenerator>(viewModel.UseBinaryGenerator ? GeneratorType.Binary : GeneratorType.Numeric); // ProfileManager.Provider.GetPropertyValues if (ApplicationModel.System != null) { var sys = InformationSystem.CreateFromGenerator(dataGenerator, viewModel.NumberOfAttributes, viewModel.NumberOfObjects); ApplicationModel.System.Rows = sys.Rows; } else { ApplicationModel.System = InformationSystem.CreateFromGenerator(dataGenerator, viewModel.NumberOfAttributes, viewModel.NumberOfObjects); } IMainFormViewPresenter mainForm; #if WEB mainForm = HttpContext.Current.Session["presenter"] as IMainFormViewPresenter; #else mainForm = Bootstrapper.ServiceLocator.GetService <IMainFormViewPresenter>(); #endif mainForm.ViewModel.DataSetName = "zbiór wygenerowany"; mainForm.ViewModel.AttributesQuantity = ViewModel.NumberOfAttributes; mainForm.ViewModel.ObjectsQuantity = ViewModel.NumberOfObjects; }
public async Task <IActionResult> Create([Bind("id,ListSystem,lvrol")] InformationSystem informationSystem) { if (ModelState.IsValid) { _context.Add(informationSystem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(informationSystem)); }
private void menuItemCreateAthlete_Click(object sender, EventArgs e) { var formSystem = new FormSystem(); var currentSystem = (InformationSystem)bindingSource.Current; if (currentSystem == null) { currentSystem = new InformationSystem(); } formSystem.InformationSystem = currentSystem; formSystem.ShowDialog(); }
public void Execute() { var filename = GlobalAppSettings.DataFileName; if (filename == null) { Status = LoadStatus.FileNameIsEmpty; throw new ArgumentException("Не указан путь к файлу для загрузки"); } if (!File.Exists(filename)) { Status = LoadStatus.FileNotExists; throw new ArgumentException("Указанный файл не существует"); } try { var lines = File.ReadAllLines(filename); Systems.Clear(); foreach (var line in lines) { var arr = line.Split('|'); var item = new InformationSystem { OperationSystem = arr[0], Database = arr[1], RamAmount = int.Parse(arr[2]), MemoryAmount = int.Parse(arr[3]), Cost = int.Parse(arr[4]) }; Systems.Add(item); } Status = LoadStatus.Success; } catch (Exception e) { Status = LoadStatus.GeneralError; Logger.Log(e); throw; } }
/// <summary> /// Created dataset from uploaded file. /// </summary> /// <param name="fileName">Uploaded file name.</param> /// <param name="file">Stream which contains uploaed file.</param> public void ProcessUploadedFile(string fileName, Stream file) { if (file == null) { try { file = new FileStream(fileName, FileMode.Open); } catch (IOException) { View.NotifyAboutNoPermissionsToFile(); return; } } FileManager manager = null; try { manager = new FileManager(file, fileName); } catch (PartialAssociationRulesException ex) { if (ex.Exception == ExceptionsList.UnsuportedFileSelected) { View.NotifyAboutUnsupportedFileSelected(); } return; } IDataFileParser parser = Bootstrapper.ServiceLocator.GetService <IDataFileParser>(manager.Type); if (ApplicationModel.System != null) { InformationSystem sys = null; try { sys = InformationSystem.CreateFromFile(parser, manager); } catch (PartialAssociationRulesException ex) { switch (ex.Exception) { case ExceptionsList.ArgumentCountIncorrect: View.NotifyAboutArgumentCountIncorrect(); break; case ExceptionsList.RowsNotParsedCorrectly: View.NotifyAboutRowsNotParsedCorrectly(); break; case ExceptionsList.IncorrectNumberOfFilesInArchive: View.NotifyAboutIncorrectNumberOfFilesInArchive(); break; case ExceptionsList.IncorrectArchive: View.NotifyAboutIncorrectArchive(); break; } return; } ApplicationModel.System.Rows = sys.Rows; View.SetStartupValues(); } else { //TODO. Find out why I've added this else statement.. ApplicationModel.System = InformationSystem.CreateFromFile(parser, manager); } viewModel.DataSetName = manager.FileName; viewModel.ObjectsQuantity = ApplicationModel.System.Rows.Count; viewModel.AttributesQuantity = ApplicationModel.System.Rows[0].Attributes.Count; #if WEB //Thread.Sleep(2000); // UpdateSummaryUP(); viewModel.UpdateSummaryUP = true; #endif }