Esempio n. 1
0
        public static RetrievalForm getRetrivalData(string productNum)
        {
            RetrievalForm rf = new RetrievalForm();
            Product       p  = ProductDAO.getSearchProductbyid(productNum);

            rf.productDescription = p.Description.ToString();
            rf.availableQty       = Convert.ToInt32(p.Stock.TotalInventoryBalance);
            rf.needeQty           = ConsolidatedRequisitionListEFFacade.getNeededQty(productNum);
            List <string> depList = ConsolidatedRequisitionListEFFacade.getAllDepInvolved(productNum);
            List <int>    qtyList = ConsolidatedRequisitionListEFFacade.getQtyNeedeOfDep(depList, productNum);

            rf.departments  = depList;
            rf.depNeededQty = qtyList;
            List <int> tempDistList = new List <int>();
            int        tempStock    = rf.availableQty;

            for (int i = 0; i < depList.Count(); i++)
            {
                if (tempStock < rf.depNeededQty[i])
                {
                    tempDistList.Add(tempStock);
                    tempStock = 0;
                }

                if (tempStock > rf.depNeededQty[i])
                {
                    tempDistList.Add(rf.depNeededQty[i]);
                    tempStock = tempStock - rf.depNeededQty[i];
                }
            }
            rf.depAvailQty = tempDistList;

            return(rf);
        }
        public static void makeNewAdjustmentVoucher(List <MakeAdjustmentItem> adjustmentList)
        {
            AdjustmentVoucher adjustmentVoucher = new AdjustmentVoucher();

            adjustmentVoucher.DateCreated = DateTime.Now;
            EntityCollection <AdjustmentVoucherDetail> voucherDetailsCollection = new EntityCollection <AdjustmentVoucherDetail>();

            foreach (MakeAdjustmentItem item in adjustmentList)
            {
                Product p                   = ProductDAO.getSearchProductbyid(item.ItemNumber);
                double  totalPrice          = (double)p.AdjustmentVoucherPrice * item.Quantity;
                AdjustmentVoucherDetail avd = new AdjustmentVoucherDetail();
                avd.ItemNumber     = item.ItemNumber;
                avd.Status         = item.Status.Equals("Excess") ? AdjustmentVoucherEFFacade.STATUS_DECREASE : AdjustmentVoucherEFFacade.STATUS_INCREASE;
                avd.TotalPrice     = totalPrice;
                avd.Comment        = item.Comment;
                avd.ApprovalStatus = AdjustmentVoucherEFFacade.APPROVAL_STATUS_PENDING;
                avd.Quantity       = item.Quantity;

                voucherDetailsCollection.Add(avd);
            }

            adjustmentVoucher.AdjustmentVoucherDetails = voucherDetailsCollection;

            AdjustmentVoucherEFFacade.addNewAdjustVoucherWithArrayVoucherDetails(adjustmentVoucher);
        }
Esempio n. 3
0
        public CartWCF[] viewCart(string empNum)
        {
            List <RequestStationaryCart> rlist = new List <RequestStationaryCart>();
            List <CartWCF> clist = new List <CartWCF>();

            rlist = RequestStationaryControler.viewCartW(empNum);
            foreach (RequestStationaryCart i in rlist)
            {
                CartWCF cf = new CartWCF();
                cf.ItemCode = i.ItemCode;
                cf.Qty      = i.Quantity;
                cf.EmpNum   = i.EmployeeNumber;
                cf.ItemDes  = ProductDAO.getSearchProductbyid(i.ItemCode).Description.ToString();
                cf.ItemUnit = ProductDAO.getSearchProductbyid(i.ItemCode).UnitOfMeasure.ToString();
                clist.Add(cf);
            }

            return(clist.ToArray <CartWCF>());
        }
Esempio n. 4
0
        public ProductWCF[] searchProduct(string searchTerm)
        {
            List <Product> searchResults = new List <Product>();

            Product idSearchResult = null;

            try
            {
                idSearchResult = ProductDAO.getSearchProductbyid(searchTerm);
            }
            catch (InvalidOperationException ex)
            {
            }

            List <Product> nameSearchResults     = ProductDAO.getSearchProductbyname(searchTerm);
            List <Product> categorySearchResults = ProductDAO.getSearchProductbyCategory(searchTerm);

            if (idSearchResult != null)
            {
                searchResults.Add(idSearchResult);
            }

            foreach (Product p in nameSearchResults)
            {
                //searchResults.Add(p);

                if (searchResults.Count > 0)
                {
                    bool isrepeat = false;

                    foreach (Product p1 in searchResults)
                    {
                        if (p.ItemNumber.Equals(p1.ItemNumber))
                        {
                            isrepeat = true;
                        }
                    }

                    if (!isrepeat)
                    {
                        searchResults.Add(p);
                    }
                }
                else
                {
                    searchResults.Add(p);
                }
            }

            foreach (Product p in categorySearchResults)
            {
                if (searchResults.Count > 0)
                {
                    bool isrepeat = false;
                    foreach (Product p1 in searchResults)
                    {
                        if (!p.ItemNumber.Equals(p1.ItemNumber))
                        {
                            isrepeat = true;
                        }
                    }

                    if (!isrepeat)
                    {
                        searchResults.Add(p);
                    }
                }
                else
                {
                    searchResults.Add(p);
                }
            }



            List <ProductWCF> searchResultWCF = new List <ProductWCF>();

            foreach (Product p in searchResults)
            {
                Console.WriteLine(p.ItemNumber);
                Console.WriteLine(p.Description);
                Console.WriteLine("------");

                ProductWCF pwcf = new ProductWCF();
                pwcf.ItemNumber             = p.ItemNumber;
                pwcf.Description            = p.Description;
                pwcf.Category               = p.Category;
                pwcf.ReorderLevel           = p.ReorderLevel != null ? (int)p.ReorderLevel : 0;
                pwcf.ReorderQuantity        = p.ReorderQuantity != null ? (int)p.ReorderQuantity : 0;
                pwcf.UnitofMeasure          = p.UnitOfMeasure;
                pwcf.Bin                    = p.Bin != null ? (int)p.Bin : 0;
                pwcf.Supplier1ID            = p.Supplier1ID;
                pwcf.Supplier2ID            = p.Supplier2ID;
                pwcf.Supplier3ID            = p.Supplier3ID;
                pwcf.AdjustmentVoucherPrice = p.AdjustmentVoucherPrice != null ? (double)p.AdjustmentVoucherPrice : 0.0;
                pwcf.Stock                  = p.Stock.TotalInventoryBalance != null ? (int)p.Stock.TotalInventoryBalance : 0;

                pwcf.ConsolidatedListID     = 0;
                pwcf.ActualQuantityAccepted = 0;
                pwcf.QuantityRequested      = 0;

                searchResultWCF.Add(pwcf);
            }

            return(searchResultWCF.ToArray <ProductWCF>());
        }