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; } }
private void LoadDefaultValues() { //Load Status VehicleInfoBL v = new VehicleInfoBL(); string searchMode = ""; if (_mode != "") { searchMode = "ALL"; } var slist = v.GetVehicleSalesStatus(searchMode); ddlStatus.Items.Clear(); foreach (var vl in slist) { ComboboxItem item = new ComboboxItem(); item.Text = vl.Description;; item.Value = vl.VehicleSalesStatusID; ddlStatus.Items.Add(item); } if (ddlStatus.Items.Count > 0) { ddlStatus.SelectedIndex = 0; } VehicleBookingFollowUpBL ef = new VehicleBookingFollowUpBL(); dgFollowup.DataSource = ef.GetVehicleBookingFollowUp(Convert.ToDateTime(dtStartDate.Text), Convert.ToDateTime(dtEndDate.Text), 1) //default status open .ToList(); if (dgFollowup.RowCount > 0) { btnEDIT.Enabled = true; } else { btnEDIT.Enabled = false; } if (_mode == "REPORTDELIVERY" || _mode == "REPORTBOOKING" || _mode == "INVOICE" || _mode == "MARGIN") { if (_mode == "REPORTDELIVERY" || _mode == "INVOICE" || _mode == "MARGIN") { ddlStatus.SelectedIndex = 4; //Delivery } else if (_mode == "REPORTBOOKING") { ddlStatus.SelectedIndex = 0; //OPen - Booking Status } label5.Visible = false; ddlStatus.Visible = false; SearchEvent(); btnEDIT.Visible = false; btnDownload.Visible = true; if (_mode == "MARGIN") { btnEDIT.Visible = true; lblInvoiceType.Visible = true; ddlInvoiceType.Visible = true; } } }
private void LoadDefaultValues() { //Get Current Month lblMonth.Text = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month).ToString(); lblTodayDate.Text = DateTime.Now.ToString("dd/MM/yyyy"); //VehicleBookingReport VehicleBookingReportBL bl = new VehicleBookingReportBL(); var allvehicleBookingList = bl.GetAllVehicleBooking(); int deliveredCount = allvehicleBookingList.Where(x => x.CommittedDate.Month == DateTime.Now.Month && x.StatusDescription.ToUpper() == "DELIVERED").Count(); lblNoDelivered.Text = deliveredCount.ToString(); int BookedCount = allvehicleBookingList.Where(x => x.StatusDescription.ToUpper() == "OPEN").Count(); lblNoBookings.Text = BookedCount.ToString(); //VehicleEnquiry CustomerEnquiryReportBL eBl = new CustomerEnquiryReportBL(); var enquiryLit = eBl.GetAllCustomerEnquiry(); //int allEnquiries = enquiryLit.Where(x => x.CreatedDate.Month == DateTime.Now.Month).Count(); lblNoofEnquiry.Text = enquiryLit.Where(x => x.VehicleStatusDescription.ToUpper() == "OPEN").Count().ToString(); int bookedEnquiries = enquiryLit.Where(x => x.VehicleStatusDescription.ToUpper() == "BOOKED").Count(); lblNoEnquiryToBookings.Text = bookedEnquiries.ToString(); int deliveredEnquiries = enquiryLit.Where(x => x.VehicleStatusDescription.ToUpper() == "DELIVERED").Count(); lblEnquiryToDelivery.Text = deliveredEnquiries.ToString(); //VehicleEnquiryFollowUpForToday CustomerEnquiryFollowupBL efBL = new CustomerEnquiryFollowupBL(); var todayEnquiryfollowup = efBL.GetCustomerEnquiryFollowup(Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()), 1); //Open Status id for today lblEnquiryFollowUpToday.Text = todayEnquiryfollowup.Count().ToString(); //VehicleEnquiryFollowUpForPastDays CustomerEnquiryFollowupBL efBLpast = new CustomerEnquiryFollowupBL(); var pastEnquiryfollowup = efBL.GetCustomerEnquiryFollowup(Convert.ToDateTime(DateTime.MinValue.ToShortDateString()), Convert.ToDateTime(DateTime.Now.AddDays(-1).ToShortDateString()), 1); //Open Status id for today lblPrevEnquiryFollowup.Text = pastEnquiryfollowup.Count().ToString(); //VehicleBookingFollowUpForToday VehicleBookingFollowUpBL vbfBL = new VehicleBookingFollowUpBL(); var todayBookingfollowup = vbfBL.GetVehicleBookingFollowUp(Convert.ToDateTime(DateTime.Now.ToShortDateString()), Convert.ToDateTime(DateTime.Now.ToShortDateString()), 1); lblBookingFollowUpToday.Text = todayBookingfollowup.Count().ToString(); //BookingFollowUpForPastDays var pastBookingfollowup = vbfBL.GetVehicleBookingFollowUp(Convert.ToDateTime(DateTime.MinValue.ToShortDateString()), Convert.ToDateTime(DateTime.Now.AddDays(-1).ToShortDateString()), 1); lblPrevBookingFollowup.Text = pastBookingfollowup.Count().ToString(); //Populate Invoice Generated MM.BusinessLayer.Admin.InvoiceBL iBL = new MM.BusinessLayer.Admin.InvoiceBL(); var invoiceGenerated = iBL.InvoiceMarginGenerated(); lblNoofMarginGen.Text = invoiceGenerated.ToString(); var invoiceGenerationPending = iBL.InvoiceMarginPending(); lblNoofMarginpending.Text = invoiceGenerationPending.ToString(); if (_userName != "") { lblUserName.Text = _userName; } if (_role != "ADMIN") { accountingToolStripMenuItem.Visible = false; expenseTypeToolStripMenuItem.Visible = false; accountingToolStripMenuItem1.Visible = false; invoiceToolStripMenuItem.Visible = false; vehicleMarginToolStripMenuItem.Visible = false; } }