private void btnUpdate_Click(object sender, EventArgs e) { FillChequeDetailsDB brdb = new FillChequeDetailsDB(); Boolean status = true; try { List <chequedet> brlist = getChequeDetails(); if (brdb.updateChequeDetailpay(brlist)) { MessageBox.Show(update + "\n" + updatefailed); } else { MessageBox.Show("Failed to update"); } ListFilteredBR(); btnUpdate.Visible = false; } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); return; } }
private void ListFilteredBR() { try { grdList.Rows.Clear(); FillChequeDetailsDB brdb = new FillChequeDetailsDB(); string docid = "BANKPAYMENTVOUCHER"; List <chequedet> BREList = brdb.getFilteredchequedet(dtFromDate.Value, dtToDate.Value, txtBankAccountCode.Text, docid); foreach (chequedet br in BREList) { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["bRowID"].Value = br.rowid; grdList.Rows[grdList.RowCount - 1].Cells["bSerialNo"].Value = grdList.RowCount; grdList.Rows[grdList.RowCount - 1].Cells["gDocumentID"].Value = br.DocumentID; grdList.Rows[grdList.RowCount - 1].Cells["bPartyName"].Value = br.PartyName; grdList.Rows[grdList.RowCount - 1].Cells["bAmountReceived"].Value = br.AmountRecieved; grdList.Rows[grdList.RowCount - 1].Cells["bAmountPaid"].Value = br.AmountPaid; grdList.Rows[grdList.RowCount - 1].Cells["bChequeNo"].Value = br.ChequeNo; grdList.Rows[grdList.RowCount - 1].Cells["bChequeDate"].Value = br.ChequeDate; grdList.Rows[grdList.RowCount - 1].Cells["bVoucherNo"].Value = br.VoucherNo; grdList.Rows[grdList.RowCount - 1].Cells["bVoucherDate"].Value = br.VoucherDate; grdList.Rows[grdList.RowCount - 1].Cells["bAccountName"].Value = br.BankAccountName; grdList.Rows[grdList.RowCount - 1].Cells["bTemporaryNo"].Value = br.TemporaryNo; grdList.Rows[grdList.RowCount - 1].Cells["bTemporaryDate"].Value = br.TemporaryDate; if (br.BankDate == DateTime.Parse("01-01-1900")) { grdList.Rows[grdList.RowCount - 1].Cells["bBankDate"].Value = "NULL"; } else { grdList.Rows[grdList.RowCount - 1].Cells["bBankDate"].Value = br.BankDate;//.ToString("dd-MM-yyyy"); } } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } setButtonVisibility("init"); pnlList.Visible = true; }