コード例 #1
0
 public void Create(Retrieval ret)
 {
     if (ret.RetrievalID == 0)
     {
         db.Retrievals.Add(ret);
     }
     db.SaveChanges();
 }
コード例 #2
0
        public void deleteRequisitionItem(int reqId, int itemId)
        {
            RequisitionItem item = db.RequisitionItems.Where(s => s.ReqID == reqId && s.SupplierItemID == itemId).First();


            if (item != null)
            {
                db.RequisitionItems.Remove(item);
            }
            db.SaveChanges();
        }
コード例 #3
0
        public void approveAdjustmentItem(int adjustmentId, int itemId)
        {
            StockAdjustmentItem item = db.StockAdjustmentItems.Where(x => x.StockAdjustmentID == adjustmentId && x.ItemID == itemId).FirstOrDefault();

            item.Status = AdjustmentStatus.Approved.ToString();
            db.StockAdjustmentItems.Attach(item);
            var entry = db.Entry(item);

            entry.Property(e => e.Status).IsModified = true;
            db.SaveChanges();
        }
コード例 #4
0
        public bool CreatePO(POBatch poBactch, PurchaseOrder Order)
        {
            bool result           = false;
            LogicUniStoreModel db = new LogicUniStoreModel();

            db.POBatches.Add(poBactch);
            db.SaveChanges();
            Order.POBatchID = poBactch.POBatchID;
            db.PurchaseOrders.Add(Order);
            result = db.SaveChanges() > 0 ? true : false;
            return(result);
        }
コード例 #5
0
        internal void SaveDOForPOItems(int poItemId, int receivedQuantity)
        {
            PurchaseOrderItem poItm = db.PurchaseOrderItems.Where(p => p.PurchaeOrderItemID == poItemId).FirstOrDefault();

            poItm.ReceivedQuantity = receivedQuantity;
            db.SaveChanges();
        }
コード例 #6
0
        internal void SaveDOInPO(int currentPOId, string doNumber)
        {
            PurchaseOrder po = db.PurchaseOrders.Where(t => t.PurchaseOrderID == currentPOId).FirstOrDefault();

            po.DONumber = doNumber;
            po.POStatus = PurchaseOrderStatus.Delivered.ToString();
            db.SaveChanges();
        }
コード例 #7
0
 public void CreateNotification(Notification objNot)
 {
     db.Notifications.Add(objNot);
     try
     {
         db.SaveChanges();
     }catch (DbEntityValidationException ex)
     {
         foreach (var entityValidationErrors in ex.EntityValidationErrors)
         {
             foreach (var validationError in entityValidationErrors.ValidationErrors)
             {
                 string s = ("Property: " + validationError.PropertyName + " Error: " + validationError.ErrorMessage);
             }
         }
     }
 }
コード例 #8
0
        public bool UpdateUserRole(int userId, string roleCode)
        {
            bool   result = false;
            LUUser emp    = db.LUUsers.Where(user => user.UserID == userId).FirstOrDefault();

            emp.RoleID = db.Roles.Where(role => role.RoleCode == roleCode).FirstOrDefault().RoleID;
            if (db.SaveChanges() > 0)
            {
                result = true;
            }
            return(result);
        }
コード例 #9
0
        public bool AcceptDisbursement(int disbId, int receivedBy)
        {
            Disbursement dsb = db.Disbursements.Where(db => db.DisbursementID == disbId).FirstOrDefault();

            dsb.Requisition.Status      = RequisitionStatus.Delivered.ToString();
            dsb.Requisition.RecieveByID = receivedBy;
            return(db.SaveChanges() > 0 ? true : false);
        }
コード例 #10
0
        public int GetProductCountInStock(int itemID)
        {
            StockCard card = db.StockCards.Where(s => s.ItemID == itemID).FirstOrDefault();

            if (card == null)
            {
                Item item = db.Items.Find(itemID);
                if (item != null)
                {
                    StockCard c = new StockCard();
                    c.ItemID         = itemID;
                    c.OnHandQuantity = 0;
                    c.Remarks        = "Valid";
                    db.StockCards.Add(c);
                    db.SaveChanges();
                }
                else
                {
                    throw new ArgumentException("Item Id  is not Valid");
                }
            }
            return(card.OnHandQuantity.Value);
        }
コード例 #11
0
 public void Create(Requisition requistion)
 {
     db.Requisitions.Add(requistion);
     db.SaveChanges();
 }
コード例 #12
0
 public void CreateAdjustment(StockAdjustment adjustment)
 {
     db.StockAdjustments.Add(adjustment);
     db.SaveChanges();
 }