예제 #1
0
        public List <int> FindTrashQtyList(CustomerTrash rowTrashQtyList)
        {
            List <int> finalQtyList = new List <int>();

            List <int> qtyList = QtyListWithNullValues(rowTrashQtyList);

            for (int i = 0; i < qtyList.Count(); i++)
            {
                if (qtyList[i] >= 0)
                {
                    finalQtyList.Add(qtyList[i]);
                }
            }

            return(finalQtyList);
        }
예제 #2
0
        private List <int> QtyListWithNullValues(CustomerTrash rowTrashQtyList)
        {
            List <int> qtyList = new List <int>();

            qtyList.Add(rowTrashQtyList.QtyItem1);
            qtyList.Add(rowTrashQtyList.QtyItem2);
            qtyList.Add(rowTrashQtyList.QtyItem3);
            qtyList.Add(rowTrashQtyList.QtyItem4);
            qtyList.Add(rowTrashQtyList.QtyItem5);
            qtyList.Add(rowTrashQtyList.QtyItem6);
            qtyList.Add(rowTrashQtyList.QtyItem7);
            qtyList.Add(rowTrashQtyList.QtyItem8);
            qtyList.Add(rowTrashQtyList.QtyItem9);
            qtyList.Add(rowTrashQtyList.QtyItem10);
            qtyList.Add(rowTrashQtyList.QtyItem11);
            qtyList.Add(rowTrashQtyList.QtyItem12);
            qtyList.Add(rowTrashQtyList.QtyItem13);
            qtyList.Add(rowTrashQtyList.QtyItem14);
            qtyList.Add(rowTrashQtyList.QtyItem15);
            return(qtyList);
        }
예제 #3
0
        private void UpdateFinalTotalQty(string[] finalTotalQtyList, UserModel um)
        {
            var totalTrashQtyLists = db.customerTrashModel.Where(c => c.CompanyName == um.CompanyName).Where(t => t.CollectingStatus == "Requested");
            var i = 0;

            foreach (var totalTrashQty in totalTrashQtyLists)
            {
                var customerTrash = new CustomerTrash()
                {
                    TableID  = totalTrashQty.TableID,
                    TotalQty = Convert.ToDouble(finalTotalQtyList[i++])
                };

                using (DataContext db = new DataContext())
                {
                    db.customerTrashModel.Attach(customerTrash);
                    db.Entry(customerTrash).Property(x => x.TotalQty).IsModified = true;
                    db.SaveChanges();
                }
            }
        }