void edit_elementBudget() { arxDs.ds = dataSet1; if (dataGridView1.CurrentRow == null) return; Class_element.BudgetCheck = Convert.ToBoolean(dataGridView2.CurrentRow.Cells[0].Value); Class_element.InOut = dataGridView2.CurrentRow.Cells[1].Value.ToString(); Class_element.Category = dataGridView2.CurrentRow.Cells[2].Value.ToString(); Class_element.Date = DateTime.ParseExact(dataGridView2.CurrentRow.Cells[3].Value.ToString(), "dd.MM.yyyy H:mm:ss", CultureInfo.CreateSpecificCulture("ru-RU")); Class_element.Sum = Convert.ToDouble(dataGridView2.CurrentRow.Cells[4].Value); Class_element.Comment = dataGridView2.CurrentRow.Cells[5].Value.ToString(); using (var aeb = new Form_AddEditBudget("Редактирование элемента")) { aeb.ShowDialog(); if (aeb.DialogResult == DialogResult.OK) { var customerRow = ((DataRowView)dataGridView2.CurrentRow.DataBoundItem).Row; customerRow["Check"] = Class_element.BudgetCheck; customerRow["InOut"] = Class_element.InOut; customerRow["Category"] = Class_element.Category; customerRow["DateTime"] = Class_element.Date; customerRow["Sum"] = Class_element.Sum; customerRow["Comment"] = Class_element.Comment; } saveData(); } }
void add_elementBudget() { arxDs.ds = dataSet1; using (var aeb = new Form_AddEditBudget("Новый элемент")) { aeb.ShowDialog(); if (aeb.DialogResult == DialogResult.OK) { dataSet1.Tables["Budget"].Rows.Add(Class_element.BudgetCheck, Class_element.InOut, Class_element.Category, Class_element.Date, Class_element.Sum, Class_element.Comment); } saveData(); } }