private void AddItemToGrid(clsEloadTransaction hist) { clsLoadAccount load = clsLoadAccount.GetLoadAccount(hist.Load_Id); int rowidx = dgvTrans.Rows.Add(); dgvTrans.Rows[rowidx].Cells[0].Value = hist.Timestamp; dgvTrans.Rows[rowidx].Cells[1].Value = load.MobileNum; dgvTrans.Rows[rowidx].Cells[2].Value = hist.Transaction_Amount; dgvTrans.Rows[rowidx].Cells[3].Value = hist.AmountDue; dgvTrans.Rows[rowidx].Cells[4].Value = hist.Remarks; dgvTrans.Rows[rowidx].Cells[5].Value = hist.UserName; }
private void btnLoad_Click(object sender, EventArgs e) { if (ValidateInput()) { clsEloadTransaction eload = new clsEloadTransaction(); eload.Load_Id = m_LoadAccount.LoadId; eload.Timestamp = DateTime.Now; eload.AmountDue = double.Parse(txtAmtDue.Text.Trim()); eload.Rebate = double.Parse(txtRebate.Text.Trim()); eload.Transaction_Amount = double.Parse(txtTransAmount.Text); eload.MobileNum = txtMobile.Text; eload.ELoadName = cmbLoadAmt.Text; eload.UserId = myPosWide.m_user.UserId; eload.Remarks = cmbLoadAmt.Text; frmInput input = new frmInput(); double amountdue = eload.AmountDue; input.Title = "Payment"; input.Value = amountdue.ToString("0.00"); input.Caption = "Enter Tendered Amount"; if (input.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (Convert.ToDouble(input.Value) >= amountdue) { eload.TenderedAmount = Convert.ToDouble(input.Value); if (eload.Save()) { Clear(); m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId); eload.PrintReceipt(); RefreshAccount(); } else { MessageBox.Show("Transaction not saved.", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Amount entered is less than the Amount Due", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }