private void setValuesToFormsElements(HandModifiedDataState state) { if (state.unicSoftwareNames.Count() > 0) { if (form.DataGridView4Elem.Rows.Count == 1) { form.DataGridView4Elem.Rows.Add(state.unicSoftwareNames.Count() - 1); form.DataGridView6Elem.Rows.Add(state.unicSoftwareNames.Count() - 1); } for (int i = 0; i < state.unicSoftwareNames.Count(); i++) { form.DataGridView4Elem.Rows[i].Cells[0].Value = state.unicSoftwareNames[i]; form.DataGridView6Elem.Rows[i].Cells[0].Value = state.unicSoftwareNames[i]; } for (int i = 0; i < state.unicSoftwareNames.Count(); i++) { form.DataGridView4Elem.Rows[i].Cells[1].Value = state.numberOfPurcharedLicenses[i]; } for (int i = 0; i < state.unicSoftwareNames.Count(); i++) { form.DataGridView6Elem.Rows[i].Cells[1].Value = state.percents[i]; } form.label7Elem.Text = "Сумма долей: " + state.sumOfParts.ToString() + "/1.0"; } }
public HandModifiedDataState loadData() { HandModifiedDataState state = new HandModifiedDataState(); //Получение уникальных имен лицензий DataConverter <DataSet, string[]> unucNamesConverter = new DistinctSoftwareNamesConverter(); DataSet ds = configProxyForLoadDataFromBDAndExecute( MsSqlServersQueryConfigurator.getUnicLicensesName()); state.unicSoftwareNames = unucNamesConverter.convert(ds); //Число закупленных лицензий читается из таблицы PurchasedLicenses ds = configProxyForLoadDataFromBDAndExecute( MsSqlServersQueryConfigurator.getNumberOfPurchasedLicenses()); DataTable table = ds.Tables[0]; state.numberOfPurcharedLicenses = new double[state.unicSoftwareNames.Count()]; for (int i = 0; i < state.unicSoftwareNames.Count(); i++) { state.numberOfPurcharedLicenses[i] = int.Parse(table.Rows[i][1].ToString()); } //Распределение в процентах закупленных лицензий ds = configProxyForLoadDataFromBDAndExecute( MsSqlServersQueryConfigurator.getPartsInPersentOfPurchasedLicenses()); table = ds.Tables[0]; state.percents = new double[state.unicSoftwareNames.Count()]; for (int i = 0; i < state.unicSoftwareNames.Count(); i++) { state.percents[i] = double.Parse(table.Rows[i][1].ToString()); } return(state); }
public HandModifiedDataState copy() { HandModifiedDataState copy = new HandModifiedDataState(); copy.numberOfPurcharedLicenses = (double[])numberOfPurcharedLicenses.Clone(); copy.unicSoftwareNames = (string[])unicSoftwareNames.Clone(); copy.percents = (double[])percents.Clone(); copy.sumOfParts = sumOfParts; return(copy); }