public OrderDetail FindOrderDetailById(int id) { SSAEntities context = new SSAEntities(); OrderDetail orderDetail = context.OrderDetails.Where(x => x.OrderDetailsId == id).FirstOrDefault(); return(orderDetail); }
public List <OrderDetail> FindOrderDetailByPONumber(int poNumber) { SSAEntities context = new SSAEntities(); List <OrderDetail> orderDetail = context.OrderDetails.Where(x => x.PoNumber == poNumber).ToList <OrderDetail>(); return(orderDetail); }
public string FindLastStationeryId() { SSAEntities s = new SSAEntities(); Stationery stationery = s.Stationeries.OrderByDescending(x => x.ItemCode).FirstOrDefault(); return(stationery.ItemCode); }
public List <OrderDetail> FindAllOrderDetails() { SSAEntities context = new SSAEntities(); List <OrderDetail> listOrderDetails = context.OrderDetails.ToList(); return(listOrderDetails); }
public RequisitionDetail GetRequisitionDetailBySId(int StatTransId) { using (SSAEntities e = new SSAEntities()) { return(new SSAEntities().RequisitionDetails.Where(p => p.StatTransId == StatTransId).FirstOrDefault()); } }
public List <RequisitionDetail> SearchRequisitionDetailByItemCode(string itemCode) { using (SSAEntities s = new SSAEntities()) { return(s.RequisitionDetails.Where(x => x.ItemCode.ToUpper().Contains(itemCode.Trim().ToUpper())).ToList()); } }
public Category FindCategoryByFullName(string name) { SSAEntities context = new SSAEntities(); Category category = context.Categories.Where(x => x.CategoryName == name).FirstOrDefault(); return(category); }
public static Supplier getSupplier(String supplierCode) { SSAEntities ssae = new SSAEntities(); Supplier supplier = ssae.Suppliers.Where(x => x.SupplierCode.Contains(supplierCode)).FirstOrDefault(); return(supplier); }
public Category FindCategoryById(int categoryId) { SSAEntities context = new SSAEntities(); Category category = context.Categories.Where(x => x.CategoryId == categoryId).FirstOrDefault(); return(category); }
public List <Category> FindCategoryByName(string name) { SSAEntities context = new SSAEntities(); List <Category> categorylist = context.Categories.Where(x => x.CategoryName.Contains(name)).ToList <Category>(); return(categorylist); }
public List <Category> FindAllCategories() { SSAEntities context = new SSAEntities(); List <Category> listCategory = context.Categories.ToList <Category>(); return(listCategory); }
public List <StockAdjustment> FindAllAbove250Pending() { SSAEntities context = new SSAEntities(); List <StockAdjustment> listAbove = new List <StockAdjustment>(); // For appending adjustments >$250 // Loop through all Pending adjustments foreach (StockAdjustment adjustment in FindAllPending()) { // Calculate adjustment double sum = 0; foreach (SupplierStationery supplier in adjustment.Stationery.SupplierStationeries) { if (supplier.SupplierRank == 1) { sum += supplier.UnitPrice * Math.Abs(adjustment.QuantityAdjusted); break; } } // If adjustment >= $250, add to listAbove if (sum >= 250) { listAbove.Add(adjustment); } } return(listAbove); }
public int UpdateAdjustment(StockAdjustment adjustment) { SSAEntities context = new SSAEntities(); try { StockAdjustment s = context.StockAdjustments .Where(x => x.AdjustmentId == adjustment.AdjustmentId).FirstOrDefault(); s.ItemCode = adjustment.ItemCode; s.QuantityAdjusted = adjustment.QuantityAdjusted; s.Reason = adjustment.Reason; s.Status = adjustment.Status; s.ApproverRemarks = adjustment.ApproverRemarks; s.DateCreated = adjustment.DateCreated; s.DateApproved = adjustment.DateApproved; s.ClerkEmployeeId = adjustment.ClerkEmployeeId; s.ApprovedByEmployeeId = adjustment.ApprovedByEmployeeId; s.VoucherNumber = adjustment.VoucherNumber; return(context.SaveChanges()); // 1 row updated } catch (Exception e) { return(0); // 0 rows updated } }
public List <StockAdjustment> FindAllAdjustments() { SSAEntities context = new SSAEntities(); List <StockAdjustment> listAdjustments = context.StockAdjustments.ToList <StockAdjustment>(); return(listAdjustments); }
public List <Order> FindAllOrders() { SSAEntities context = new SSAEntities(); List <Order> listOrders = context.Orders.ToList <Order>(); return(listOrders); }
public static List <SupplierStationery> getSupplierStationeries(String itemCode) { SSAEntities ssae = new SSAEntities(); List <SupplierStationery> supplierStationeries = ssae.SupplierStationeries.Where(x => x.ItemCode.Contains(itemCode)).ToList <SupplierStationery>(); return(supplierStationeries); }
public Order FindOrderById(int poNumber) { SSAEntities context = new SSAEntities(); Order order = context.Orders.Where(x => x.PoNumber == poNumber).FirstOrDefault(); return(order); }
// view requisitiondetail by statTransId public List <RequisitionDetail> GetRequisitionDetail(int StatTransId) { using (SSAEntities e = new SSAEntities()) { return(new SSAEntities().RequisitionDetails.Where(p => p.StatTransId == StatTransId).ToList()); } }
public List <Order> FindOrderBySupplierCode(string supplierCode) { SSAEntities context = new SSAEntities(); List <Order> orderlist = context.Orders.Where(x => x.SupplierCode == supplierCode).ToList <Order>(); return(orderlist); }
//------------------------------------------------ public List <RequisitionDetail> SearchRequisitionDetailByRequisitionId(int requisitionId) { using (SSAEntities s = new SSAEntities()) { return(s.RequisitionDetails.Where(x => x.RequisitionId == requisitionId).ToList()); } }
public List <Order> FindOrderByDeliveryDate(DateTime datedelivery) { SSAEntities context = new SSAEntities(); List <Order> orderlist = context.Orders.Where(x => x.DateDelivery == datedelivery).ToList <Order>(); return(orderlist); }
public List <Employee> FindEmployeesByRole(string role) { using (SSAEntities ssae = new SSAEntities()) { return(ssae.Employees.Where(x => x.Role == role).ToList()); } }
public static Stationery getStationery(String itemCode) { SSAEntities ssae = new SSAEntities(); Stationery stationery = ssae.Stationeries.Where(x => x.ItemCode.Contains(itemCode)).FirstOrDefault(); return(stationery); }
public int UpdateDisbursementStatus(string depId, DateTime fromdate, DateTime toDate) { SSAEntities ssa = new SSAEntities(); List <string> departmentId = new List <string>(); try { List <Disbursement> disbursements = se.Disbursements.Where(x => x.DeptId == depId).ToList(); foreach (Disbursement d in disbursements) { if (d.Status == "Acknowledged" && DateTime.Compare(fromdate.Date, ((DateTime)d.DateDisbursed).Date) <= 0 && DateTime.Compare(toDate.Date, ((DateTime)d.DateDisbursed).Date) >= 0) { DisbursementDetail disbursementDetail = se.DisbursementDetails.Where(x => x.DisbursementId == d.DisbursementId).FirstOrDefault(); if (disbursementDetail != null) { disbursementDetail.Disbursement.Status = "Charged"; se.SaveChanges(); return(1); } } } return(0); } catch (Exception ex) { return(0); } }
public RequisitionDetail GetLastStatTransId() { using (SSAEntities s = new SSAEntities()) { RequisitionDetail rd = s.RequisitionDetails.OrderByDescending(x => x.StatTransId).FirstOrDefault(); return(rd); } }
//---------------------------------- public int CreateRequisitionDetail(RequisitionDetail r) { using (SSAEntities s = new SSAEntities()) { s.RequisitionDetails.Add(r); return(s.SaveChanges()); } }
public List <Stationery> FindStationeryByCatagoryName(string name) { SSAEntities context = new SSAEntities(); int categoryId = context.Categories.Where(x => x.CategoryName.Contains(name)).Select(x => x.CategoryId).FirstOrDefault(); List <Stationery> stationery = context.Stationeries.Where(x => x.CategoryId == categoryId).ToList(); return(stationery); }
public Requisition GetLastRequisitionId() { using (SSAEntities s = new SSAEntities()) { Requisition r = s.Requisitions.OrderByDescending(x => x.RequisitionId).FirstOrDefault(); return(r); } }
public StockAdjustment FindAdjustmentById(int adjustmentId) { SSAEntities context = new SSAEntities(); StockAdjustment adjustment = context.StockAdjustments .Where(x => x.AdjustmentId == adjustmentId).FirstOrDefault(); return(adjustment); }
public List <StockAdjustment> FindAllAdjustmentsOfVoucher(int voucherNumber) { SSAEntities context = new SSAEntities(); List <StockAdjustment> listAdjustments = context.StockAdjustments .Where(x => x.VoucherNumber == voucherNumber).ToList <StockAdjustment>(); return(listAdjustments); }