Exemple #1
0
        /** end by ashwin
         * */



        /** added by lee
         * */

        public static bool acknowledgeCollectItems(List <ConsolidatedRequisitionListDetail> detailsList)
        {
            List <int> listIDs = new List <int>();

            foreach (ConsolidatedRequisitionListDetail detailItem in detailsList)
            {
                ConsolidatedRequisitionListDetail item = ConsolidatedRequisitionListEFFacade.getItemWithMatchingListIDAndItemCode(detailItem.ConsolidatedListID, detailItem.ItemNumber);

                if (detailItem.ActualQuantity < item.ActualQuantity)
                {
                    int difference = (int)item.ActualQuantity - (int)detailItem.ActualQuantity;
                    ConsolidatedRequisitionListEFFacade.setActualQuantityForItem(detailItem.ConsolidatedListID, detailItem.ItemNumber, (int)detailItem.ActualQuantity);

                    //raise voucher and update unfulfilled here

                    //1. update unfulfilled items table
                    updateUnfulfilledList(detailItem, difference);

                    //2. raise adjustment voucher
                    raiseNewAdjustmentVoucher(detailItem, difference);

                    //3. update stock
                    ProductDAO.UpdateStock(detailItem.ItemNumber, difference);
                }

                if (!listIDs.Contains(detailItem.ConsolidatedListID))
                {
                    listIDs.Add(detailItem.ConsolidatedListID);
                }
            }

            foreach (int id in listIDs)
            {
                ConsolidatedRequisitionListEFFacade.setListStatusToClosed(id);
            }

            return(true);
        }
Exemple #2
0
        public static void updateStationaryCollection(string itemNum, int[] actualQty, string[] depCode)
        {
            List <string>  itemList = new List <string>();
            List <Product> plist    = ConsolidatedRequisitionListEFFacade.getAllProductsToCollect();

            foreach (Product p in plist)
            {
                itemList.Add(p.ItemNumber);
            }
            List <string> depCodeList = depCode.ToList <string>();

            List <int> qtyList = ConsolidatedRequisitionListEFFacade.getQtyNeedeOfDep(depCodeList, itemNum);

            if (itemList.Contains(itemNum))
            {
                for (int j = 0; j < actualQty.Length; j++)
                {
                    int i = ConsolidatedRequisitionListEFFacade.getDepOpenConsolidatedIDfromProd(itemNum, depCode[j]);
                    ConsolidatedRequisitionListEFFacade.updateStationaryCollection(i, itemNum, actualQty[j]);
                    int deff = qtyList[j] - actualQty[j];
                    if (deff > 0)
                    {
                        UnfulfilledDAO.raiseAdjustmentFromCollection(itemNum, depCode[j], deff);
                    }
                }
            }



            int stockRed = 0;

            for (int i = 0; i < actualQty.Length; i++)
            {
                stockRed = actualQty[i] + stockRed;
            }

            ProductDAO.UpdateStockReduce(itemNum, stockRed);
        }
Exemple #3
0
        public static void approveVoucherDetailItemsBySupervisor(List <AdjustmentVoucherDetail> list)
        {
            UniversityStoreEntities CONTEXT = new UniversityStoreEntities();

            foreach (AdjustmentVoucherDetail detail in list)
            {
                var query = from x in CONTEXT.AdjustmentVoucherDetails
                            where x.VoucherNumber == detail.VoucherNumber && detail.ItemNumber == x.ItemNumber && x.ApprovalStatus == detail.ApprovalStatus
                            select x;

                AdjustmentVoucherDetail voucherDetailObject = query.First();
                int qnty = Convert.ToInt32(voucherDetailObject.Quantity);
                voucherDetailObject.ApprovalStatus = APPROVAL_STATUS_APPROVED;
                var q = from x in CONTEXT.Products
                        where x.ItemNumber == detail.ItemNumber
                        select x;
                Product prod = q.First <Product>();
                if (voucherDetailObject.Status == STATUS_INCREASE)
                {
                    ProductDAO.UpdateStock(prod.ItemNumber, qnty);
                }
                else
                {
                    ProductDAO.UpdateStockReduce(prod.ItemNumber, qnty);
                }

                CONTEXT.SaveChanges();
            }

            //foreach (AdjustmentVoucherDetail detail in itemsApproved)
            //{
            //    AdjustmentVoucherDetail d = CONTEXT.AdjustmentVoucherDetails.Where(x => x.VoucherNumber == detail.VoucherNumber).First();
            //    d.ApprovalStatus = APPROVAL_STATUS_APPROVED;
            //    CONTEXT.SaveChanges();
            //}
        }
Exemple #4
0
        //public static UniversityStoreEntities context = new UniversityStoreEntities();

        public static List <Product> ProductWithLowStock()
        {
            List <Product> pr = ProductDAO.StockIsLow();

            return(pr);
        }
Exemple #5
0
 public static List <Object> populateAll()
 {
     return(ProductDAO.selectAll());
 }
Exemple #6
0
        //////****************Sreeja********************///////

        public static List <object> findStockByDescp(string descp)
        {
            return(ProductDAO.populateStockByDescp(descp));
        }
Exemple #7
0
 public static List <object> findStock(string cat)
 {
     return(ProductDAO.populateStock(cat));
 }
Exemple #8
0
 public static List <Object> acceptAllProducts()
 {
     return(ProductDAO.populateAllProduct());
 }
Exemple #9
0
 public static List <Object> displaySerachResults(string searchString)
 {
     return(ProductDAO.getSearchResultbyname(searchString));
 }
Exemple #10
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>());
        }
Exemple #11
0
 public static void UpdatePositiveStock(String Pid, int qnt)
 {
     ProductDAO.UpdateStock(Pid, qnt);
 }
Exemple #12
0
 public static void UpdatenegativeStock(String Pid, int qnt)
 {
     ProductDAO.UpdateStockReduce(Pid, qnt);
 }