예제 #1
0
        public ProductWCF[] getAwaitingItemsForDept(string deptCode)
        {
            List <ConsolidatedRequisitionListDetail> detailList = DeliverRequestController.getAllAwaitingItemsForDept(deptCode);
            List <ProductWCF> pWCFList = new List <ProductWCF>();

            foreach (ConsolidatedRequisitionListDetail detail in detailList)
            {
                Product    p    = detail.Product;
                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     = detail.ConsolidatedListID;
                pWCF.QuantityRequested      = detail.QuantityRequested != null ? (int)detail.QuantityRequested : 0;
                pWCF.ActualQuantityAccepted = detail.ActualQuantity != null ? (int)detail.ActualQuantity : 0;

                pWCFList.Add(pWCF);
            }
            return(pWCFList.ToArray <ProductWCF>());
        }
예제 #2
0
        public ProductWCF getProductFromName(string pname)
        {
            List <ProductWCF> pppl  = new List <ProductWCF>();
            List <Product>    plist = new List <Product>();

            plist.Add(ProductDAO.gethProductbyName(pname));
            foreach (Product p in plist)
            {
                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;

                pppl.Add(pwcf);
            }
            return(pppl[0]);
        }
예제 #3
0
        public ProductWCF[] getAllConsoOpen()
        {
            RetreiveStationaryController.generateDisbursementList();
            RetreiveStationaryController.generateConsolidatedListFromUnfullfilled();

            List <ConsolidatedRequisitionListDetail> list = RetreiveStationaryController.getConsolidatedItemsForOpenNoDuplicates();
            List <ProductWCF> resultsList = new List <ProductWCF>();

            foreach (ConsolidatedRequisitionListDetail detail in list)
            {
                Product    p    = detail.Product;
                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     = detail.ConsolidatedListID;
                pWCF.QuantityRequested      = detail.QuantityRequested != null ? (int)detail.QuantityRequested : 0;
                pWCF.ActualQuantityAccepted = detail.ActualQuantity != null ? (int)detail.ActualQuantity : 0;

                resultsList.Add(pWCF);
            }
            return(resultsList.ToArray <ProductWCF>());
        }
예제 #4
0
        public ProductWCF[] getAllProducts()
        {
            List <Product>    allProductsList = ProductDAO.selectAllProductList();
            List <ProductWCF> productWCFList  = new List <ProductWCF>();

            foreach (Product p in allProductsList)
            {
                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;

                productWCFList.Add(pwcf);
            }

            return(productWCFList.ToArray <ProductWCF>());
        }
예제 #5
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>());
        }