Esempio n. 1
0
        public List <string> GetVoucher(string id)
        {
            List <string> result = new List <string>();
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            StationeryRetrievalList        ad     = source.Where(s => s.ItemNumber == id).ToList().First();

            if (ad == null)
            {
                return(null);
            }
            else
            {
                BizLogic  k    = new BizLogic();
                Catalogue cata = _context.Catalogue.Where(s => s.ItemName == ad.ItemName).ToList().First();
                result.Add(cata.Category);
                result.Add(ad.ItemName);
                result.Add(ad.Quantity.ToString());
                result.Add(ad.QuantityRetrieved.ToString());
                //this part in fact is price
                if (ad.Quantity == ad.QuantityRetrieved)
                {
                    result.Add("finished");
                }
                else
                {
                    result.Add("Unfinished");
                }
                return(result);
            }
        }
Esempio n. 2
0
        public List <string> GetRetrieveDetail(string id, string mode)
        {
            List <string> result = new List <string>();
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            StationeryRetrievalList        temp   = source.Where(s => s.ItemNumber == id).ToList().First();
            Catalogue cata = _context.Catalogue.Where(s => s.ItemNumber == id).ToList().First();

            result.Add(cata.Category);
            result.Add(cata.ItemName);
            if (mode.Equals("summary"))
            {
                result.Add(cata.Out.ToString());
            }
            else
            {
                result.Add(temp.Quantity.ToString());
            }
            if (temp.QuantityRetrieved == temp.Quantity)
            {
                result.Add("finished");
            }
            else
            {
                result.Add("waiting");
            }
            return(result);
        }
Esempio n. 3
0
        public async Task <string> PFitemAsync(string amount, string rdid)
        {
            List <StationeryRetrievalList> source = new BizLogic().GetStationeryRetrievalLists();
            StationeryRetrievalList        temp   = source.Where(s => s.ItemName.Contains(rdid)).ToList().First();

            //this part input change out
            //temp.QuantityDelivered = int.Parse(amount);
            //_context.Update(temp);
            //await _context.SaveChangesAsync();
            new BizLogic().UpdateCatalogueOutAndStockAfterRetrieval(temp.ItemNumber, int.Parse(amount));
            return("123");
        }
Esempio n. 4
0
        //Generate Stationery Retrieval List for a department
        public List <StationeryRetrievalList> GetStationeryRetrievalLists()
        {
            List <StationeryRetrievalList> result = new List <StationeryRetrievalList>();

            //get pending delivery disbursement list
            List <DisbursementList> dlList = _context.DisbursementList.Where(x => x.Status == "Pending Delivery").ToList();

            //Find all needed Disbursement List ID, add to a list
            List <string> dlidList = new List <string>();

            foreach (DisbursementList dl in dlList)
            {
                dlidList.Add(dl.Dlid);
            }

            //Get all RecordDetails
            List <RecordDetails> rdList = _context.RecordDetails.ToList();

            //Select out needed Disbursement List Record details
            List <RecordDetails> selecteddlList = new List <RecordDetails>();

            foreach (RecordDetails r in rdList)
            {
                if (dlidList.Contains(r.Rrid))
                {
                    selecteddlList.Add(r);
                }
            }


            var q = from x in selecteddlList
                    group x by x.ItemNumber into g
                    select new { g.Key, Quantiy = g.Sum(y => y.Quantity) };

            foreach (var i in q.ToList())
            {
                StationeryRetrievalList srl = new StationeryRetrievalList();
                srl.ItemNumber = i.Key;
                srl.ItemName   = _context.Catalogue.Find(i.Key).ItemName;
                srl.Quantity   = i.Quantiy;

                result.Add(srl);
            }

            return(result);
        }