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 PopulateVehicleBooking(int vehicleBookingId) { VehicleBookingBL vBl = new VehicleBookingBL(); var vclBooking = vBl.GetVehicleBooking(vehicleBookingId); _vehicleEnquiryId = vclBooking.VehicleEnquiryID ?? 0; //Assign EnquiryInformation to form txtCustomerName.Text = vclBooking.CustomerName; txtCustomerId.Text = vclBooking.CustomerID.ToString(); txtReferenceBy.Text = vclBooking.ReferenceBy; //Employees ComboboxItem empItem = new ComboboxItem(); empItem.Text = vclBooking.SalesExecutiveName; empItem.Value = vclBooking.SalesExecutiveId; ddlEmployees.Text = empItem.Text; //Model1 if (vclBooking.ModelID != 0) { ComboboxItem model1item = new ComboboxItem(); model1item.Text = vclBooking.ModelName; model1item.Value = vclBooking.ModelID; ddlModel.Text = model1item.Text; } //Bind Colors ddlColor1.Text = vclBooking.Color1; ddlColor2.Text = vclBooking.Color2; ddlColor3.Text = vclBooking.Color3; txtCustomerRemark.Text = vclBooking.CustomerRemark; //Advance Amount assigning string advAmount = ""; if (vclBooking.AdvanceAmount != null || vclBooking.AdvanceAmount != 0) { advAmount = vclBooking.AdvanceAmount.ToString(); } txtAdvanceAmount.Text = advAmount; //Advance Mode if (vclBooking.AdvanceMode) { rdnAdvCash.Checked = true; rdnAdvCheque.Checked = false; } else { rdnAdvCash.Checked = false; rdnAdvCheque.Checked = true; } //Advance Cheque no assigning string cheqNo = ""; if (vclBooking.AdvanceChequeNo != null || vclBooking.AdvanceChequeNo != 0) { cheqNo = vclBooking.AdvanceChequeNo.ToString(); } txtChequeNo.Text = cheqNo; //Payment if (vclBooking.IsCash) { rdnPayCash.Checked = true; rdnPayFinance.Checked = false; } else { rdnPayCash.Checked = false; rdnPayFinance.Checked = true; } //Financier if (vclBooking.FinancierInfoId != 0) { ComboboxItem financeItem = new ComboboxItem(); financeItem.Text = vclBooking.FinancierName; financeItem.Value = vclBooking.FinancierInfoId; ddlFinance.Text = financeItem.Text; } txtFinanceRemark.Text = vclBooking.FinancierRemark; if (vclBooking.ReadyToDeliver ?? false) { rdnRtoDYes.Checked = true; } else { rdnRToDNo.Checked = true; } //Status ComboboxItem statusItem = new ComboboxItem(); statusItem.Text = vclBooking.StatusDescription; statusItem.Value = vclBooking.StatusId; ddlStatus.Text = statusItem.Text; dtCommittedDate.Text = vclBooking.CommittedDate.ToString(); //Populate followup records VehicleBookingFollowUpBL vbfBL = new VehicleBookingFollowUpBL(); var bookingFollowup = vbfBL.GetVehicleBookingFollowupbyId(vehicleBookingId); lblPrevRemark1.Text = bookingFollowup.Description; dtFollowupDate.Text = bookingFollowup.FollowUpDate.ToString(); //Populate Allotments if (vclBooking.VehicleBookingAllotmentId != 0) { if (vclBooking.VehicleBookingAllotmentId.ToString() != "") { VehicleAllotmentBL bl = new VehicleAllotmentBL(); int inventoryId = bl.GeInventoryId(vclBooking.VehicleBookingAllotmentId ?? 0); if (inventoryId != 0) { txtVehicleAltInventoryId.Text = inventoryId.ToString(); } EnableEditForVehicleAllotment(); } } ////Populate Finance Allotment if (vclBooking.FinanceAllotmentId != 0) { txtFinanceAllotmentId.Text = vclBooking.FinanceAllotmentId.ToString(); if (txtFinanceAllotmentId.Text != "") { EnableEditForFinanceAllotment(); } } //Populate Insurance Allotment if (vclBooking.InsuranceAllotmentId != 0) { txtInsuranceAllotmentId.Text = vclBooking.InsuranceAllotmentId.ToString(); if (txtInsuranceAllotmentId.Text != "") { EnableEditForInsuranceAllotment(); } } // Populate RTO Allotment if (vclBooking.RTOAllotmentId != 0) { txtIRTOAllotmentId.Text = vclBooking.RTOAllotmentId.ToString(); if (txtIRTOAllotmentId.Text != "") { EnableEditForRTOAllotment(); } } //Populate Spare Parts Allotment SparePartsAllotmentBL obj = new SparePartsAllotmentBL(); var lst = obj.GetSparePartsAllotmentbyBookingId(vehicleBookingId); lstSPaltid = new List <int>(); if (lst.Count > 0) { string spAltId = ""; foreach (var alt in lst) { lstSPaltid.Add(alt.SparePartsBookingAllotmentID); spAltId = spAltId + alt.SparePartsBookingAllotmentID + "__" + alt.SparePartsInventoryID + "&&"; } txtIRTOAllotmentId.Text = spAltId; EnableEditForSPAllotment(); } }
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; } }