Exemplo n.º 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var SparePartsInventoryID = Convert.ToInt32(dgSparePartsInventory.CurrentRow.Cells["SparePartsInventoryID"].Value.ToString());

            if (SparePartsInventoryID == 0)
            {
                MyMessageBox.ShowBox("Please select a value from the SpareParts Invetory!!!");
            }
            else
            {
                var retStr = MyMessageBoxYesorNo.ShowBox("Are you Sure You want to Delete??");
                if (retStr == "1")
                {
                    SparePartsInventoryBL obj = new SparePartsInventoryBL();
                    var flag = obj.DeleteSparePartsInventory(SparePartsInventoryID);
                    LoadDefaultValues();
                    if (flag)
                    {
                        MyMessageBox.ShowBox("SpareParts Inventory Deleted");
                    }
                    else
                    {
                        MyMessageBox.ShowBox("SpareParts Inventory Failed to Delete.");
                    }
                }
            }
        }
        private void LoadDefaultValues()
        {
            //Load All Model Name
            SparePartsInfoBL viBL = new SparePartsInfoBL();

            foreach (var SparePartsInfo in viBL.GetAllSparePartsInfo())
            {
                ComboboxItem obj = new ComboboxItem();
                obj.Text  = SparePartsInfo.ModelName;
                obj.Value = SparePartsInfo.SparePartsInfoID;
                ddlModelName.Items.Add(obj);
            }

            //Load Inventory Status
            ddlInvStatus.Items.Clear();
            SparePartsInventoryBL obj2 = new SparePartsInventoryBL();

            foreach (var status in obj2.GetInventoryStatusType())
            {
                ComboboxItem itemInventoryStatus = new ComboboxItem();
                itemInventoryStatus.Text  = status.Description;
                itemInventoryStatus.Value = status.SparePartsInventoryStatusTypeID;
                ddlInvStatus.Items.Add(itemInventoryStatus);
            }
        }
Exemplo n.º 3
0
        private void PopulateSelectedAllotment(List <int> spAllotmentID)
        {
            List <int>            lstSPInventory = new List <int>();
            SparePartsAllotmentBL vaBl           = new SparePartsAllotmentBL();
            SparePartsInventoryBL obj            = new SparePartsInventoryBL();
            var allinventory = obj.GetAllSparePartsInventory();
            var filterefInfo = allinventory.Where(i => i.SparePartsInventoryStatusTypeID == 1).ToList();//.Where(x => lstSPInventory.Contains(x.SparePartsInventoryID));

            dgSparePartsInventory.DataSource = filterefInfo;
            foreach (var spaltid in spAllotmentID)
            {
                ComboboxItem item        = new ComboboxItem();
                var          inventoryId = vaBl.GetSPInventoryId(spaltid);
                item.Value = inventoryId;
                var inventorydto = allinventory.Where(x => x.SparePartsInventoryID == inventoryId).FirstOrDefault();
                item.Text = inventorydto.SparePartsModelName;
                lstBoxSPInvlist.Items.Add(item);
            }
        }
        private void PopulateInventorySpareParts(int SparePartsInventoryID)
        {
            SparePartsInventoryBL obj = new SparePartsInventoryBL();
            var          vehInv       = obj.GetAllSparePartsInventory().Where(v => v.SparePartsInventoryID == SparePartsInventoryID).FirstOrDefault();
            ComboboxItem selitem      = new ComboboxItem();

            selitem.Text             = vehInv.SparePartsModelName;
            selitem.Value            = vehInv.SparePartsInfoID;
            ddlModelName.Text        = selitem.Text;
            txtIdentificationNo.Text = vehInv.IdentificationNo;
            txtOtherDescription.Text = vehInv.OtherDescription;
            txtShowRoomPrice.Text    = vehInv.ShowRoomPrice.ToString();
            txtMarginPrice.Text      = vehInv.MarginPrice.ToString();
            //InventoryStatus Populate
            var          vehInvStatus = obj.GetInventoryStatusType().Where(iv => iv.SparePartsInventoryStatusTypeID == vehInv.SparePartsInventoryStatusTypeID).FirstOrDefault();
            ComboboxItem selInvitem   = new ComboboxItem();

            selInvitem.Text           = vehInvStatus.Description;
            selInvitem.Value          = vehInvStatus.SparePartsInventoryStatusTypeID;
            ddlInvStatus.Text         = selInvitem.Text;
            ddlQuantity.SelectedIndex = 0;
        }
Exemplo n.º 5
0
        private void LoadDefaultValues()
        {
            SparePartsInventoryBL obj = new SparePartsInventoryBL();
            var lst = obj.GetAllSparePartsInventory();

            if (_mode == "ADD")
            {
                lst = lst.Where(i => i.SparePartsInventoryStatusTypeID == 1).ToList();
            }
            dgSparePartsInventory.DataSource = lst;

            //Get All Model Name
            ddlModelName.Items.Clear();
            SparePartsInfoBL obj1 = new SparePartsInfoBL();
            var allVehInfo        = obj1.GetAllSparePartsInfo();

            foreach (var vehInfo in allVehInfo)
            {
                //Load Model Name
                ComboboxItem itemModelName = new ComboboxItem();
                itemModelName.Text  = vehInfo.ModelName;
                itemModelName.Value = vehInfo.SparePartsInfoID;
                ddlModelName.Items.Add(itemModelName);
            }


            //Load Inventory Status
            ddlInventoryStatus.Items.Clear();
            SparePartsInventoryBL obj2 = new SparePartsInventoryBL();

            foreach (var status in obj2.GetInventoryStatusType())
            {
                ComboboxItem itemInventoryStatus = new ComboboxItem();
                itemInventoryStatus.Text  = status.Description;
                itemInventoryStatus.Value = status.SparePartsInventoryStatusTypeID;
                ddlInventoryStatus.Items.Add(itemInventoryStatus);
            }
        }
Exemplo n.º 6
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            //var modelCode = txtModelCode.Text;
            var    modelName       = ddlModelName.SelectedText;
            string inventoryStatus = "";

            if (ddlInventoryStatus.SelectedItem != null)
            {
                inventoryStatus = ddlInventoryStatus.SelectedItem.ToString();
            }
            string identificationNo   = txtIdentificationNo.Text;
            SparePartsInventoryBL obj = new SparePartsInventoryBL();
            var filterefInfo          = obj.GetAllSparePartsInventory()
                                        .Where(
                i => i.SparePartsModelName.ToUpper().Contains(modelName.ToUpper())
                &&
                i.IdentificationNo.ToUpper().Contains(identificationNo.ToUpper())
                &&
                i.SparePartsInventoryStatusName.ToUpper().Contains(inventoryStatus.ToUpper())
                ).ToList();

            dgSparePartsInventory.DataSource = filterefInfo;
        }
Exemplo n.º 7
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);
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ddlModelName.SelectedIndex == -1 || txtIdentificationNo.Text == "" || txtOtherDescription.Text == "" || ddlQuantity.SelectedIndex == -1 || txtMarginPrice.Text == "" || txtShowRoomPrice.Text == "")
            {
                MyMessageBox.ShowBox("Please Select All Mandatory Fields !!!");
                return;
            }

            if (txtMarginPrice.Text == "0" || txtShowRoomPrice.Text == "0")
            {
                MyMessageBox.ShowBox("Price cannot be 0 !!!");
                return;
            }

            if (Convert.ToInt32(ddlQuantity.Text) > 5)
            {
                string ok = MyMessageBoxYesorNo.ShowBox("Are you sure you want to add " + ddlQuantity.Text + " Quantity");
                if (ok != "1")
                {
                    return;
                }
            }
            SparePartsInventoryDTO info = new SparePartsInventoryDTO();
            var selItem = (ComboboxItem)ddlModelName.SelectedItem;

            info.SparePartsInventoryID = _SparePartsInventoryID;
            info.SparePartsInfoID      = Convert.ToInt32(selItem.Value);
            info.IdentificationNo      = txtIdentificationNo.Text;
            info.OtherDescription      = txtOtherDescription.Text;
            info.CreatedDate           = System.DateTime.Now;
            info.CreatedBy             = GlobalSetup.Userid;
            info.ModifiedDate          = System.DateTime.Now;
            info.MarginPrice           = Convert.ToInt32(txtMarginPrice.Text);
            info.ShowRoomPrice         = Convert.ToInt32(txtShowRoomPrice.Text);
            var invSelitem = (ComboboxItem)ddlInvStatus.SelectedItem;

            info.SparePartsInventoryStatusTypeID = Convert.ToInt32(invSelitem.Value);
            int quantity = Convert.ToInt32(ddlQuantity.Text);
            SparePartsInventoryBL viBL = new SparePartsInventoryBL();
            var flag    = false;
            var identno = info.IdentificationNo;

            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    for (int i = 1; i <= quantity; i++)
                    {
                        info.IdentificationNo = identno + " --" + i.ToString() + " -" + System.DateTime.Now.ToShortDateString();
                        viBL.SaveInventorySpareParts(info, _mode);
                    }
                    flag = true;
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    flag = false;
                }
                if (flag)
                {
                    MyMessageBox.ShowBox("SpareParts Inventory Saved", "SpareParts Inventory");
                    Clear();
                }
                else
                {
                    MyMessageBox.ShowBox("SpareParts Inventory Failed to Save", "SpareParts Inventory");
                }
            }
            this.Close();
        }