public void Create(Retrieval ret) { if (ret.RetrievalID == 0) { db.Retrievals.Add(ret); } db.SaveChanges(); }
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(); }
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(); }
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); }
internal void SaveDOForPOItems(int poItemId, int receivedQuantity) { PurchaseOrderItem poItm = db.PurchaseOrderItems.Where(p => p.PurchaeOrderItemID == poItemId).FirstOrDefault(); poItm.ReceivedQuantity = receivedQuantity; db.SaveChanges(); }
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(); }
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); } } } }
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); }
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); }
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); }
public void Create(Requisition requistion) { db.Requisitions.Add(requistion); db.SaveChanges(); }
public void CreateAdjustment(StockAdjustment adjustment) { db.StockAdjustments.Add(adjustment); db.SaveChanges(); }