private void AddItemToGrid(clsUnclaimedCash uc) { int rowidx = dgvUnclaimedCash.Rows.Add(); dgvUnclaimedCash.Rows[rowidx].Cells[0].Value = uc.SmartMoney; dgvUnclaimedCash.Rows[rowidx].Cells[1].Value = uc.RefNum; dgvUnclaimedCash.Rows[rowidx].Cells[2].Value = uc.Amount; dgvUnclaimedCash.Rows[rowidx].Cells[3].Value = uc.Timestamp; }
private void btnSaveUnclaimedCash_Click(object sender, EventArgs e) { if (txtUCSmartMoney.Text.Trim().Length != 16) { MessageBox.Show("Invalid SmartMoney format", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUCSmartMoney.Focus(); txtUCSmartMoney.SelectAll(); } else if (string.IsNullOrEmpty(txtUCAmount.Text) || Convert.ToInt32(txtUCAmount.Text) <= 0) { MessageBox.Show("Invalid Amount", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUCAmount.Focus(); txtUCAmount.SelectAll(); } else if (string.IsNullOrEmpty(txtUCRefNum.Text)) { MessageBox.Show("Reference Num is required", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Information); txtUCRefNum.Focus(); } else { clsUnclaimedCash uc = new clsUnclaimedCash(); uc.Amount = Convert.ToInt32(txtUCAmount.Text); uc.LoadAccountId = m_LoadAccount.LoadId; uc.RefNum = txtUCRefNum.Text.Trim(); uc.SmartMoney = txtUCSmartMoney.Text.Trim(); uc.UserId = myPosWide.m_user.UserId; uc.Timestamp = DateTime.Now; if (uc.Save()) { MessageBox.Show("Unclaimed cash added successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information); UpdateList(); RefreshAccount(); Clear(); } } }