Пример #1
0
        private void SearchEvent()
        {
            var customerName                     = txtName.Text;
            var mobileNo                         = txtMobileNo.Text;
            var followUpDate                     = Convert.ToDateTime(dtStartDate.Text);
            var status                           = ddlStatus.Text;
            var statusItem                       = (ComboboxItem)ddlStatus.SelectedItem;
            int statusId                         = Convert.ToInt32(statusItem.Value);
            VehicleBookingFollowUpBL ef          = new VehicleBookingFollowUpBL();
            InvoiceBL iBL                        = new InvoiceBL();
            List <VehicleBookingFollowupDTO> lst = new List <VehicleBookingFollowupDTO>();

            if (_mode == "MARGIN")
            {
                var marginLst = iBL.GetInvoiceMarginDTOList(Convert.ToDateTime(dtStartDate.Text), Convert.ToDateTime(dtEndDate.Text), ddlInvoiceType.Text)
                                .Where(
                    efu => efu.CustomerName.ToUpper().Contains(customerName.ToUpper())
                    &&
                    efu.CustomerMobileNo.ToUpper().Contains(mobileNo.ToUpper())
                    ).ToList();
                dgFollowup.DataSource = null;
                dgFollowup.DataSource = marginLst;
            }
            else if (_mode == "REPORTDELIVERY")
            {
                lst = ef.GetVehicleBookingFollowUp(Convert.ToDateTime(dtStartDate.Text), Convert.ToDateTime(dtEndDate.Text), statusId, "REPORTDELIVERY")
                      .Where(
                    efu => efu.CustomerName.ToUpper().Contains(customerName.ToUpper())
                    &&
                    efu.CustomerMobileNo.ToUpper().Contains(mobileNo.ToUpper())
                    &&
                    efu.StatusDescription.ToUpper().Contains(status.ToUpper())
                    ).ToList();
                dgFollowup.DataSource = lst;
            }
            else
            {
                lst = ef.GetVehicleBookingFollowUp(Convert.ToDateTime(dtStartDate.Text), Convert.ToDateTime(dtEndDate.Text), statusId)
                      .Where(
                    efu => efu.CustomerName.ToUpper().Contains(customerName.ToUpper())
                    &&
                    efu.CustomerMobileNo.ToUpper().Contains(mobileNo.ToUpper())
                    &&
                    efu.StatusDescription.ToUpper().Contains(status.ToUpper())
                    ).ToList();
                dgFollowup.DataSource = lst;
            }

            if (dgFollowup.RowCount > 0)
            {
                btnEDIT.Enabled = true;
            }
            else
            {
                btnEDIT.Enabled = false;
            }
        }