private void editTransfer() { arxDs.ds = dataSet1; using (var fTransfer = new Form_AddEditTransfer("Редактирование перевода")) { var array = dataGridView1.CurrentRow.Cells[1].Value.ToString().Split( new string[] { "->" }, StringSplitOptions.None); var inOut = array[0]; var category = array[1]; Class_element.InOut = inOut; Class_element.Category = category; Class_element.Date = DateTime.ParseExact(dataGridView1.CurrentRow.Cells[2].Value.ToString(), "dd.MM.yyyy H:mm:ss", CultureInfo.CreateSpecificCulture("ru-RU")); Class_element.Sum = Convert.ToDouble(dataGridView1.CurrentRow.Cells[3].Value); Class_element.Comment = dataGridView1.CurrentRow.Cells[4].Value.ToString(); fTransfer.ShowDialog(); if (fTransfer.DialogResult == DialogResult.OK) { var editRow = ((DataRowView)dataGridView1.CurrentRow.DataBoundItem).Row; editRow["InOut"] = Class_element.InOut; editRow["Category"] = Class_element.Category; editRow["DateTime"] = Class_element.Date; editRow["Sum"] = Class_element.Sum; editRow["Comment"] = Class_element.Comment; } saveData(); } }
private void add_transfer() { arxDs.ds = dataSet1; using (var fTransfer = new Form_AddEditTransfer("Новый перевод")) { Class_element.InOut = "Основной"; Class_element.Category = "Основной"; Class_element.Date = DateTime.Now.Date; Class_element.Sum = 0; Class_element.Comment = ""; fTransfer.ShowDialog(); if (fTransfer.DialogResult == DialogResult.OK) { dataSet1.Tables["CashInOut"].Rows.Add(Class_element.InOut, Class_element.Category, Class_element.Date, Class_element.Sum, Class_element.Comment); } saveData(); } }