private void Note_Load(object sender, EventArgs e) { _paramsList = new ParamsList(_type); List <Params> list = _paramsList.GetNameList(); int i = 0; foreach (var l in list) { dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells["Number"].Value = i + 1; dataGridView1.Rows[i].Cells["Code"].Value = l.Code; dataGridView1.Rows[i].Cells["PName"].Value = l.Name; i++; } if (_isCreating) { comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; } else { comboBox1.SelectedText = _interval.Period; comboBox2.SelectedText = _interval.Year.ToString(); comboBox1.Enabled = false; comboBox2.Enabled = false; _dataList = new DataList(_type, _paramsList); _dataList.Year = _interval.Year; _dataList.Period = _interval.Period; _dataList.ReadData(); for (int j = 0; j < list.Count; j++) { dataGridView1.Rows[j].Cells["Data"].Value = _dataList.Data[j]; } } }
private void LoadData() { _intervals = new Intervals(_type); List <Intervals.IntervalStruct> intervalsList = _intervals.GetIntervals(); int i = 0; dataGridView1.Rows.Clear(); foreach (var l in intervalsList) { dataGridView1.Rows.Add(); dataGridView1.Rows[i].Cells["Number"].Value = i + 1; dataGridView1.Rows[i].Cells["Year"].Value = l.Year; dataGridView1.Rows[i].Cells["Period"].Value = l.Period; dataGridView1.Rows[i].Cells["Check"].Value = false; i++; } dataGridView2.Rows.Add(2); dataGridView2.Rows[0].Cells["N"].Value = ""; dataGridView2.Rows[0].Cells["Code"].Value = "Year"; dataGridView2.Rows[0].Cells["PName"].Value = "Год"; dataGridView2.Rows[1].Cells["N"].Value = ""; dataGridView2.Rows[1].Cells["Code"].Value = "Period"; dataGridView2.Rows[1].Cells["PName"].Value = "Период"; _paramsList = new ParamsList(_type); List <Params> paramsList = _paramsList.GetNameList(); i = 2; foreach (var l in paramsList) { dataGridView2.Rows.Add(); dataGridView2.Rows[i].Cells["N"].Value = i - 1; dataGridView2.Rows[i].Cells["Code"].Value = l.Code; dataGridView2.Rows[i].Cells["PName"].Value = l.Name; i++; } }
public DataList(int type, ParamsList paramsList) { _type = type; _paramsList = paramsList; }