Example #1
0
 private void ViewMeterBillInvoice_Load(object sender, EventArgs e)
 {
     gvmeterbillinvoice.AutoGenerateColumns = false;
     if (isPassedByCalculateForm)
     {
         dtpFromDate.Value = fromDate;
         dtptoDate.Value   = toDate;
         this.bindQuarterData();
         this.bindTransformerData();
         cbotransformer.SelectedValue  = TransformerID;
         cboQuarter.SelectedValue      = QuarterID;
         gvmeterbillinvoice.DataSource = meterBillCalculateServices.GetmeterBillInvoices(fromDate, toDate, TransformerID, QuarterID, string.Empty, string.Empty);
     }
     BidnigData();
 }
Example #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            data = new List <MeterBillInvoiceVM>();
            this.gvmeterbillinvoice.DataSource          = null;
            this.gvmeterbillinvoice.AutoGenerateColumns = false;
            string Customerid = string.Empty;
            string quarterid  = string.Empty;
            string townshipid = string.Empty;

            if (cboQuarter.Text != "Select One")
            {
                quarterid = cboQuarter.SelectedValue.ToString();
            }
            if (cboTownship.Text != "Select One")
            {
                townshipid = cboTownship.SelectedValue.ToString();
            }
            if (!string.IsNullOrEmpty(txtCustomerName.Text))
            {
                Customer c = mBMSEntities.Customers.Where(x => x.Active == true && x.CustomerNameInEng.Equals(txtCustomerName.Text)).SingleOrDefault();
                if (c == null)
                {
                    MessageBox.Show("There is no data.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    Customerid = c.CustomerID;
                }
            }
            else if (!string.IsNullOrEmpty(txtCustomerCode.Text))
            {
                Customer c = mBMSEntities.Customers.Where(x => x.Active == true && x.CustomerCode == txtCustomerCode.Text).SingleOrDefault();
                if (c == null)
                {
                    MessageBox.Show("There is no data.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    Customerid = c.CustomerID;
                }
            }
            data = meterbillcalculateservice.GetmeterBillInvoices(dtpFromDate.Value,
                                                                  dtptoDate.Value,
                                                                  townshipid,
                                                                  quarterid,
                                                                  Customerid,
                                                                  txtBillCodeNo.Text);
            if (data.Count == 0)
            {
                MessageBox.Show("There is no data.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            this.gvmeterbillinvoice.DataSource = data;
        }