public bool UpdateCollectionPt(string codeDepartment, int idCollectionPt) { Department model = null; using (SSISContext db = new SSISContext()) { model = db.Departments.OfType <Department>() .Where(x => x.CodeDepartment == codeDepartment) .FirstOrDefault(); if (model == null) { return(false); } CollectionPoint collectionPt = db.CollectionPoints.OfType <CollectionPoint>() .Where(x => x.IdCollectionPt == idCollectionPt) .FirstOrDefault(); if (collectionPt == null) { return(false); } model.IdCollectionPt = idCollectionPt; db.SaveChanges(); } return(true); }
public bool UpdateCollectionPt(int idDisbursement, int idCollectionPt) { Disbursement model = null; using (SSISContext db = new SSISContext()) { model = db.Disbursements.OfType <Disbursement>() .Where(x => x.IdDisbursement == idDisbursement) .FirstOrDefault(); if (model == null) { return(false); } CollectionPoint collectionPt = db.CollectionPoints .Include("CPClerks") .OfType <CollectionPoint>() .Where(x => x.IdCollectionPt == idCollectionPt) .FirstOrDefault(); if (collectionPt == null) { return(false); } model.IdCollectionPt = idCollectionPt; model.IdDisbursedBy = collectionPt.CPClerks.FirstOrDefault().IdStoreClerk; db.SaveChanges(); } return(true); }
public List <Delegation> FindAll() { using (SSISContext context = new SSISContext()) { return(context.Delegations.OfType <Delegation>().ToList <Delegation>()); } }
public List <Disbursement> GetReceivedDisbursements(string codeDepartment, string searchContext = "") { List <Disbursement> model = new List <Disbursement>(); using (SSISContext db = new SSISContext()) { if (string.IsNullOrEmpty(searchContext)) { model = db.Disbursements .Include("DisbursementItems.Item") .Include("Department") .Include("CollectedBy") .Include("DisbursedBy") .Include("CollectionPoint") .Include("Status") .Where(x => x.IdStatus == 11 && x.CodeDepartment == codeDepartment) .ToList(); } else { model = db.Disbursements .Include("DisbursementItems.Item") .Include("Department") .Include("CollectedBy") .Include("DisbursedBy") .Include("CollectionPoint") .Include("Status") .Where(x => x.IdStatus == 11 && x.CodeDepartment == codeDepartment && (x.Date.ToString().Contains(searchContext) || x.CollectionPoint.Location.ToString().Contains(searchContext) || x.DisbursedBy.Name.ToString().Contains(searchContext) || x.CollectedBy.Name.ToString().Contains(searchContext))) .ToList(); } } return(model); }
public PurchaseOrderDetail CreateOrAddAmount(Item i, PurchaseOrder po) { SSISContext context = new SSISContext(); //item and po into pod PurchaseOrderDetail pod = context.PurchaseOrderDetails.OfType <PurchaseOrderDetail>(). Where(x => x.Item.IdItem == i.IdItem && x.PurchaseOrder.IdPurchaseOrder == po.IdPurchaseOrder).FirstOrDefault(); if (pod == null) { pod = new PurchaseOrderDetail { IdItem = i.IdItem, IdPurchaseOrder = po.IdPurchaseOrder, OrderUnit = i.ReorderUnit, DeliveredUnit = 0, }; context.PurchaseOrderDetails.Add(pod); context.SaveChanges(); } else { pod.OrderUnit += i.ReorderUnit; context.SaveChanges(); } context.Dispose(); return(pod); }
public CollectionPoint Find(int id) { using (SSISContext context = new SSISContext()) { return(context.CollectionPoints.OfType <CollectionPoint>().Where(x => x.IdCollectionPt == id).FirstOrDefault()); } }
public PurchaseOrder FindIncompletePOWithSupplier(string codeSupplier) { SSISContext context = new SSISContext(); PurchaseOrder po = context.PurchaseOrders.OfType <PurchaseOrder>().Where(x => x.Status.Label.Equals("Incomplete") && x.IdSupplier.Equals(codeSupplier)).Include(b => b.Supplier).Include(b => b.StoreClerk).FirstOrDefault(); context.Dispose(); return(po); }
public void Create(Delegation d) { using (SSISContext context = new SSISContext()) { context.Delegations.Add(d); context.SaveChanges(); } }
public void Delete(Delegation d) { using (SSISContext context = new SSISContext()) { Delegation del = context.Delegations.OfType <Delegation>().Where(x => x.IdDelegation == d.IdDelegation).FirstOrDefault(); context.Delegations.Remove(del); context.SaveChanges(); } }
public void Update(Delegation d) { using (SSISContext context = new SSISContext()) { Delegation del = context.Delegations.OfType <Delegation>().Where(x => x.IdDelegation == d.IdDelegation).FirstOrDefault(); del.IdEmployee = d.IdEmployee; del.StartDate = d.StartDate; del.EndDate = d.EndDate; context.SaveChanges(); } }
public List <Item> FindLowStockItems() { SSISContext context = new SSISContext(); List <Item> items = context.Items.OfType <Item>(). Where(x => x.AvailableUnit <= x.ReorderLevel). Include(i => i.PurchaseOrderDetails). Include(i => i.PurchaseOrderDetails.Select(x => x.PurchaseOrder)). ToList <Item>(); context.Dispose(); return(items); }
public Supplier GetSupplierById(string codeSupplier) { Supplier supplier = new Supplier(); using (SSISContext db = new SSISContext()) { supplier = db.Suppliers .Where(s => s.CodeSupplier == codeSupplier) .FirstOrDefault(); } return(supplier); }
public List <SupplierItem> GetSuppliersById(int itemId) { List <SupplierItem> suppliers = new List <SupplierItem>(); using (SSISContext db = new SSISContext()) { suppliers = db.SupplierItems .Include("Supplier") .Include("Item") .Where(s => s.IdItem == itemId) .ToList(); } return(suppliers); }
public PurchaseOrder Create(string codeSupplier, int idStoreClerk) { SSISContext context = new SSISContext(); PurchaseOrder purchaseOrder = new PurchaseOrder { StoreClerk = context.Employees.OfType <Employee>().Where(x => x.IdEmployee == idStoreClerk).FirstOrDefault(), Supplier = context.Suppliers.OfType <Supplier>().Where(x => x.CodeSupplier.Equals(codeSupplier)).FirstOrDefault(), Status = context.Status.OfType <Status>().Where(x => x.Label.Equals("Incomplete")).FirstOrDefault(), ApprovedDate = DateTime.Parse("01/01/1900"), DeliverDate = DateTime.Parse("01/01/1900"), OrderDate = DateTime.Parse("01/01/1900") }; context.PurchaseOrders.Add(purchaseOrder); context.SaveChanges(); context.Dispose(); return(purchaseOrder); }
public List <Disbursement> GetAllDisbursements() { List <Disbursement> models = new List <Disbursement>(); using (SSISContext db = new SSISContext()) { models = db.Disbursements .Include("DisbursementItems.Item") .Include("Department") .Include("CollectedBy") .Include("DisbursedBy") .Include("CollectionPoint") .Include("Status") .ToList(); } return(models); }
public List <Disbursement> GetDeptDisbursements(string codeDepartment) { List <Disbursement> models = new List <Disbursement>(); using (SSISContext db = new SSISContext()) { models = db.Disbursements .Include("DisbursementItems.Item") .Include("Department") .Include("CollectedBy") .Include("DisbursedBy") .Include("CollectionPoint") .Include("Status") .Where(x => x.CodeDepartment == codeDepartment) .ToList(); } return(models); }
public Disbursement GetDisbursement(int id) { Disbursement model = new Disbursement(); using (SSISContext db = new SSISContext()) { model = db.Disbursements .Include("DisbursementItems.Item") .Include("Department") .Include("CollectedBy") .Include("DisbursedBy") .Include("CollectionPoint") .Include("Status") .Where(x => x.IdDisbursement == id) .FirstOrDefault(); } return(model); }
public Disbursement GetScheduledDisbursement(string codeDepartment) { Disbursement model = new Disbursement(); using (SSISContext db = new SSISContext()) { model = db.Disbursements .Include("DisbursementItems.Item") .Include("Department") .Include("CollectedBy") .Include("DisbursedBy") .Include("CollectionPoint") .Include("Status") .Where(x => x.IdStatus == 10 && x.CodeDepartment.Equals(codeDepartment)) .FirstOrDefault(); } return(model); }
public bool AcknowledgeCollection(int idDisbursement, int IdCollectedBy) { using (SSISContext db = new SSISContext()) { Disbursement disbursement = db.Disbursements.OfType <Disbursement>() .Where(x => x.IdDisbursement == idDisbursement) .FirstOrDefault(); if (disbursement == null) { return(false); } List <DisbursementItem> disbursementItems = db.DisbursementItems.OfType <DisbursementItem>() .Where(x => x.IdDisbursement == idDisbursement) .ToList(); disbursement.IdStatus = 11; disbursement.IdCollectedBy = IdCollectedBy; foreach (DisbursementItem di in disbursementItems) { di.IdStatus = 11; } db.SaveChanges(); } return(true); }
public DisbursementDAO() { this.context = new SSISContext(); }
public RequisitionItemDAO() { this.context = new SSISContext(); }
protected override void Seed(SSISContext context) { base.Seed(context); }
public StatusDAO() { this.context = new SSISContext(); }
public CategoryDAO() { this.context = new SSISContext(); }
public PurchaseOrderDAO() { this.context = new SSISContext(); }
public DepartmentDAO() { context = new SSISContext(); }
public ItemDAO() { this.context = new SSISContext(); }
public StockRecordDAO() { this.context = new SSISContext(); }
public SupplierItemDAO() { this.context = new SSISContext(); }
public NotificationChannelDAO() { this.context = new SSISContext(); }