private void GetFilteredCriteria(int id) { FileUser fileUser = new FileUser(Properties.Settings.Default.SoftwareTools, new SoftwareToolRepository()); SoftwareTool softwareTool = (SoftwareTool)fileUser.getElementById(id); fileUser = new FileUser(Properties.Settings.Default.Matrix, new CriteriaMatrixRepository()); DataSingleton.GetInstance(id, true); DataSingleton.GetInstance((int[])fileUser.getElementById(softwareTool.Id)); }
public static DataSingleton GetInstance(int[] priorities) { if (instance is null) { instance = new DataSingleton(); } instance.SetPriorities(priorities); return(instance); }
public static DataSingleton GetInstance(int idSt, bool st) { if (instance is null) { instance = new DataSingleton(); } instance.SetSt(idSt); return(instance); }
public static DataSingleton GetInstance(int idPhase) { if (instance is null) { instance = new DataSingleton(); } instance.SetPhase(idPhase); return(instance); }
private void MainForm_Load(object sender, EventArgs e) { DataSingleton instance = DataSingleton.GetInstance(); if (instance != null) { foreach (Control children in panel1.Controls) { if (Equals(children.Tag, instance.SoftwareTool.ToString())) { ((RadioButton)children).Checked = true; break; } } } }
private void ChoosePhase_Click(object sender, EventArgs e) { IndicatorsFilter indicatorsFilter = new IndicatorsFilter(); Indicator[] indicators = indicatorsFilter.FilterIndicators(); DataSingleton dataSingleton = DataSingleton.GetInstance(); SavePointSingleton savePointSingleton = SavePointSingleton.GetInstance(); int diff = indicators.Count(x => x.IdMethod > -1); if (dataSingleton.IdPhase == savePointSingleton.SavePoint.IdPhase && dataSingleton.SoftwareTool == savePointSingleton.SavePoint.IdSoftwareTool && indicators.Length == savePointSingleton.SavePoint.IndicatorsValues.Length + diff) { int count = 0; for (int i = 0; i < indicators.Length; ++i) { if (indicators[i].IdMethod > -1) { ++count; continue; } bool ok = float.TryParse(savePointSingleton.SavePoint.IndicatorsValues[i - count]?.Replace('.', ','), out float t); indicators[i].Value = ok ? t : -1; } } else { foreach (Indicator indicator in indicators) { indicator.Value = -1; } } Evaluation form = new Evaluation(indicators); form.Show(); closedByUser = false; Close(); }
private Result CalculateSoftwareTool(Result[] criterias) { float sum = 0; float count = 0; foreach (Result criteria in criterias) { sum += criteria.Assessment; ++count; } if (count == 0) { count = 1; } FileUser fileUser = new FileUser(Properties.Settings.Default.SoftwareTools, new SoftwareToolRepository()); SoftwareTool softwareTool = (SoftwareTool)fileUser.getElementById(DataSingleton.GetInstance().SoftwareTool); Result result = new Result(softwareTool, 1, sum / count); return(result); }
private void loadData_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.Filter = "xml files (*.xml)|*.xml"; if (ofd.ShowDialog() == DialogResult.OK) { try { FileUser fileUser = new FileUser(ofd.FileName, new SavePointRepository()); SavePoint savePoint = (SavePoint)fileUser.getElementById(0); EditSavePoint loader = new EditSavePoint(); loader.LoadSavePoint(savePoint); CheckRadioButton(savePoint.IdSoftwareTool); DataSingleton.GetInstance(savePoint.IdPhase, savePoint.IdSoftwareTool); SavePointSingleton.GetInstance(savePoint); } catch (Exception) { MessageBox.Show("Ошибка загрузки файла", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void GetPhase(int id) { FileUser fileUser = new FileUser(Properties.Settings.Default.Phases, new LifeCyclePhaseRepository()); DataSingleton.GetInstance(((Phase)fileUser.getElementById(id)).Id); }
public static DataSingleton GetInstance() { return(instance ?? (instance = new DataSingleton())); }