Пример #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            FinanceAllotmentBL obj = new FinanceAllotmentBL();
            //FinancierId

            int financierId = 0;

            if (ddlFinance.SelectedIndex != -1)
            {
                var financeItem = (ComboboxItem)ddlFinance.SelectedItem;
                financierId = Convert.ToInt32(financeItem.Value);
            }

            int _loanNo = 0;

            if (txtLoanNo.Text != "")
            {
                _loanNo = Convert.ToInt32(txtLoanNo.Text);
            }

            int _financeAmt = 0;

            if (txtFinanceamt.Text != "")
            {
                _financeAmt = Convert.ToInt32(txtFinanceamt.Text);
            }

            int _otherAmt = 0;

            if (txtOtherChargesAmt.Text != "")
            {
                _otherAmt = Convert.ToInt32(txtOtherChargesAmt.Text);
            }

            //Populate dto
            FinanceAllotmentDTO dto = new FinanceAllotmentDTO()
            {
                VehicleBookingId        = Convert.ToInt32(lblVehicleBookingId.Text),
                FinancierID             = financierId,
                LoanNumber              = _loanNo,
                FinanceDate             = Convert.ToDateTime(dtFinanceDate.Text),
                FinanceAmount           = _financeAmt,
                OtherChargesDescription = txtOtherChargesDesc.Text,
                OtherAmount             = _otherAmt,
                CreatedBy    = GlobalSetup.Userid,
                CreatedDate  = DateTime.Now,
                ModifiedBy   = GlobalSetup.Userid,
                ModifiedDate = DateTime.Now
            };

            if (_mode == "EDIT")
            {
                dto.VehicleBookingFinanceAllotmentID = _financeAllotmentId;
            }

            int financeAllotmentId = obj.SaveFinanceAllotment(dto, _mode);

            lblFinanceAllotmentId.Text = financeAllotmentId.ToString();
            this.Close();
        }
Пример #2
0
        private void PopulateFinance()
        {
            FinanceAllotmentBL bl = new FinanceAllotmentBL();
            var fAllot            = bl.GetFinanceAllotment(_financeAllotmentId);

            //Financier
            if (fAllot.FinancierID != 0)
            {
                ComboboxItem financeItem = new ComboboxItem();
                financeItem.Text  = fAllot.FinancierName;
                financeItem.Value = fAllot.FinancierID;
                ddlFinance.Text   = financeItem.Text;
            }
            lblVehicleBookingId.Text = _vehicleBookingId.ToString();
            txtLoanNo.Text           = (fAllot.LoanNumber ?? 0).ToString();
            dtFinanceDate.Text       = fAllot.FinanceDate.ToString();
            txtFinanceamt.Text       = (fAllot.FinanceAmount ?? 0).ToString();
            txtOtherChargesDesc.Text = fAllot.OtherChargesDescription;
            txtOtherChargesAmt.Text  = (fAllot.OtherAmount ?? 0).ToString();
        }
Пример #3
0
        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);
        }