private void PopulateSelectedAllotment(int vehicleAllotmentId) { VehicleAllotmentBL vaBl = new VehicleAllotmentBL(); int vehicleInventoryId = vaBl.GeInventoryId(vehicleAllotmentId); VehicleInventoryBL obj = new VehicleInventoryBL(); var filterefInfo = obj.GetAllVehicleInventory() .Where( i => i.VehicleInventoryID == vehicleInventoryId ).ToList(); dgVehicleInventory.DataSource = filterefInfo; }
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(); } }
public InvoiceDTO GetInvoiceDetails(int VehicleBookingId) { var Invoicedto = new InvoiceDTO(); var vBL = new VehicleBookingBL(); var viBL = new VehicleInventoryBL(); var vABL = new VehicleAllotmentBL(); var spABL = new SparePartsAllotmentBL(); var spInventory = new SparePartsInventoryBL(); var fABL = new FinanceAllotmentBL(); var vehicleBooking = vBL.GetVehicleBooking(VehicleBookingId); //Customer Information var ctmrDTO = new CustomerDTO(); //VehicleInventory var vIDTO = new VehicleInventoryDTO(); //VehicleBooking var vBDTO = new VehicleBookingDTO(); //SpareParts Inventory var spInvDTOlist = new List <SparePartsInventoryDTO>(); //Finance Allotment var fDTO = new FinanceAllotmentDTO(); if (vehicleBooking != null) { vBDTO = vehicleBooking; Invoicedto.VclBooking = vBDTO; ctmrDTO.CustomerID = vehicleBooking.CustomerID; ctmrDTO.Name = vehicleBooking.CustomerName; Invoicedto.Customer = ctmrDTO; //Get Vehicle Inventory ID from VehicleAllotment Id int vInventoryId = vABL.GeInventoryId(vehicleBooking.VehicleBookingAllotmentId ?? 0); if (vInventoryId != 0) { var invDTO = viBL.GetVehicleInventory(vInventoryId); vIDTO.EngineNo = invDTO.EngineNo; vIDTO.ChasisNo = invDTO.ChasisNo; vIDTO.VehicleModelName = invDTO.VehicleModelName; vIDTO.ExShowRoomPrice = invDTO.ExShowRoomPrice; vIDTO.LT_RT_OtherExp = invDTO.LT_RT_OtherExp; vIDTO.InsurancePrice = invDTO.InsurancePrice; vIDTO.OnRoadPrice = invDTO.OnRoadPrice; vIDTO.WarrantyPrice = invDTO.WarrantyPrice; vIDTO.VehicleInventoryID = vInventoryId; if (invDTO.Is70PerMarginPrice) { vIDTO.MarginPrice = invDTO.Margin70; } if (invDTO.Is50PerMarginPrice) { vIDTO.MarginPrice = invDTO.Margin50; } Invoicedto.VehicleInventory = vIDTO; } //Get SpareParts Allotment Details var sPAltList = spABL.GetSparePartsAllotmentbyBookingId(VehicleBookingId); if (sPAltList.Count > 0) { foreach (var sp in sPAltList) { var spIDTO = new SparePartsInventoryDTO(); if (sp.SparePartsInventoryID != 0) { var spI = spInventory.GetSparePartsInventory(sp.SparePartsInventoryID); //SpareParts Inventory SparePartsInventoryDTO spidto = new SparePartsInventoryDTO(); spidto.SparePartsInventoryID = sp.SparePartsInventoryID; spidto.ShowRoomPrice = spI.ShowRoomPrice; spidto.MarginPrice = spI.MarginPrice; spidto.SparePartsModelName = spI.SparePartsModelName; spidto.SparePartsInfoID = spI.SparePartsInfoID; spInvDTOlist.Add(spidto); } } Invoicedto.lstSparePartsInventory = spInvDTOlist; } //Finance Allotment if (vehicleBooking.FinanceAllotmentId != null && vehicleBooking.FinanceAllotmentId != 0) { fDTO = fABL.GetFinanceAllotment(vehicleBooking.FinanceAllotmentId ?? 0); Invoicedto.FinanceAllotment = fDTO; } } return(Invoicedto); }