private void AddTransaction() { var newTrans = new Transaction(); var frm = new FrmAction(null, ref newTrans); frm.ShowDialog(); if (newTrans.TransactionId.Length > 0) { _businessManager.Insert(newTrans); btnSave.Enabled = true; } }
private void withdrawToolStripMenuItem_Click(object sender, EventArgs e) { this.Hide(); using (FrmAction frm = new FrmAction(Ultity.Action.Withdraw, new DateTime(Year, Month, Day))) { if (frm.ShowDialog() == DialogResult.Cancel) { this.Show(); LoadData(); } } }
private void UpdateTransaction() { DataGridViewSelectedRowCollection drArr = dataGridView_Main.SelectedRows; if (drArr.Count > 0) { var newTrans = new Transaction(); var oldTrans = new Transaction { TransactionId = drArr[0].Cells[TransactionId.Name].Value.ToString(), Action = (Ultity.Action) drArr[0].Cells[Action.Name].Value, Amount = (int) drArr[0].Cells[Amount.Name].Value, Date = (DateTime) drArr[0].Cells[Date.Name].Value, ActionDate = (DateTime) drArr[0].Cells[ActionDate.Name].Value, Note = drArr[0].Cells[Note.Name].Value.ToString() }; var frm = new FrmAction(oldTrans, ref newTrans); frm.ShowDialog(); drArr[0].Cells[TransactionId.Name].Value = newTrans.TransactionId; drArr[0].Cells[Action.Name].Value = newTrans.Action; var language = GetLanguage.Instance(PublicVariables.Language); switch ((int)newTrans.Action) { case 1: drArr[0].Cells[ActionShow.Name].Value = language.GetString(LanguageId.Deposit); break; case 2: drArr[0].Cells[ActionShow.Name].Value = language.GetString(LanguageId.Withdraw); break; case 3: drArr[0].Cells[ActionShow.Name].Value = language.GetString(LanguageId.Lend); break; default: drArr[0].Cells[ActionShow.Name].Value = language.GetString(LanguageId.Borrow); break; } drArr[0].Cells[Amount.Name].Value = newTrans.Amount; drArr[0].Cells[Date.Name].Value = newTrans.Date; drArr[0].Cells[ActionDate.Name].Value = newTrans.ActionDate; drArr[0].Cells[Note.Name].Value = newTrans.Note; } }