private void tspSaveAndClose_Click(object sender, EventArgs e) { if (cboAccount.Text == "") { MessageBox.Show("Pilih rekening terlebih dahulu", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (txtAmount.Text == "") { MessageBox.Show("Jumlah tidak boleh kosong", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtAmount.Focus(); } else if (decimal.Parse(txtAmount.Text.Replace(".", string.Empty)) > forBalance) { MessageBox.Show("Pembayaran tidak mencukupi. " + lblForBalance.Text, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); txtAmount.Focus(); } else { Model.Transaction transaction = new Model.Transaction(); transaction.Type = TransactionType.Payment.ToString(); transaction.Date = dtpDate.Value; transaction.Amount = decimal.Parse(txtAmount.Text.Replace(".", string.Empty)); transaction.Description = "Bayar " + this.accountName + " dengan " + cboAccount.Text; transaction.CategoryId = new Guid(lblCategoryId.Text); transaction.AccountId = new Guid(lblAccountId.Text); transaction.Notes = txtNotes.Text; transactionRepository.Save(transaction); frmMain.LoadAccountByType(frmMain.CboFilterText); frmMain.DisableEditDelete(); frmMain.DisableAction(); frmMain.DrawChart(frmMain.CboChart); this.Close(); } }