/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblPurchaseOrderRegister = new DataTable(); PurchaseOrderMasterSP spPurchaseOrderMaster = new PurchaseOrderMasterSP(); if (txtOrderNo.Text.Trim() == string.Empty) { strInvoiceNo = string.Empty; } else { strInvoiceNo = txtOrderNo.Text; } if (cmbCashOrParty.SelectedIndex == 0 || cmbCashOrParty.SelectedIndex == -1) { decLedgerId = -1; } else { decLedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); } if (rbtnAll.Checked) { strCondition = "All"; } if (rbtnPendingOrder.Checked) { strCondition = "Pending"; } if (rbtnOverdue.Checked) { strCondition = "Due"; } if (rbtnCancelled.Checked) { strCondition = "Cancelled"; } DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; dtblPurchaseOrderRegister = spPurchaseOrderMaster.PurchaseOrderMasterViewAll(strInvoiceNo, decLedgerId, FromDate, ToDate, strCondition); dgvPurchaseOrderRegister.DataSource = dtblPurchaseOrderRegister; if (dgvPurchaseOrderRegister.Columns.Count > 0) { dgvPurchaseOrderRegister.Columns["dgvtxtBillAmount"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; } } catch (Exception ex) { MessageBox.Show("POREG2:" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public List <DataTable> PurchaseOrderMasterViewAll(string strInvoiceNo, decimal decLedgerId, DateTime FromDate, DateTime ToDate, string strCondition) { PurchaseOrderMasterSP SPPurchaseOrderMaster = new PurchaseOrderMasterSP(); List <DataTable> ListObj = new List <DataTable>(); try { ListObj = SPPurchaseOrderMaster.PurchaseOrderMasterViewAll(strInvoiceNo, decLedgerId, FromDate, ToDate, strCondition); } catch (Exception ex) { MessageBox.Show("PoBll 25:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(ListObj); }