コード例 #1
0
        public OrderDetail FindOrderDetailById(int id)
        {
            SSAEntities context     = new SSAEntities();
            OrderDetail orderDetail = context.OrderDetails.Where(x => x.OrderDetailsId == id).FirstOrDefault();

            return(orderDetail);
        }
コード例 #2
0
        public List <OrderDetail> FindOrderDetailByPONumber(int poNumber)
        {
            SSAEntities        context     = new SSAEntities();
            List <OrderDetail> orderDetail = context.OrderDetails.Where(x => x.PoNumber == poNumber).ToList <OrderDetail>();

            return(orderDetail);
        }
コード例 #3
0
        public string FindLastStationeryId()
        {
            SSAEntities s          = new SSAEntities();
            Stationery  stationery = s.Stationeries.OrderByDescending(x => x.ItemCode).FirstOrDefault();

            return(stationery.ItemCode);
        }
コード例 #4
0
        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());
     }
 }
コード例 #7
0
        public Category FindCategoryByFullName(string name)
        {
            SSAEntities context  = new SSAEntities();
            Category    category = context.Categories.Where(x => x.CategoryName == name).FirstOrDefault();

            return(category);
        }
コード例 #8
0
        public static Supplier getSupplier(String supplierCode)
        {
            SSAEntities ssae     = new SSAEntities();
            Supplier    supplier = ssae.Suppliers.Where(x => x.SupplierCode.Contains(supplierCode)).FirstOrDefault();

            return(supplier);
        }
コード例 #9
0
        public Category FindCategoryById(int categoryId)
        {
            SSAEntities context  = new SSAEntities();
            Category    category = context.Categories.Where(x => x.CategoryId == categoryId).FirstOrDefault();

            return(category);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        public List <Category> FindAllCategories()
        {
            SSAEntities     context      = new SSAEntities();
            List <Category> listCategory = context.Categories.ToList <Category>();

            return(listCategory);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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
            }
        }
コード例 #14
0
        public List <StockAdjustment> FindAllAdjustments()
        {
            SSAEntities            context         = new SSAEntities();
            List <StockAdjustment> listAdjustments = context.StockAdjustments.ToList <StockAdjustment>();

            return(listAdjustments);
        }
コード例 #15
0
        public List <Order> FindAllOrders()
        {
            SSAEntities  context    = new SSAEntities();
            List <Order> listOrders = context.Orders.ToList <Order>();

            return(listOrders);
        }
コード例 #16
0
        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);
        }
コード例 #17
0
        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());
     }
 }
コード例 #19
0
        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());
            }
        }
コード例 #21
0
        public List <Order> FindOrderByDeliveryDate(DateTime datedelivery)
        {
            SSAEntities  context   = new SSAEntities();
            List <Order> orderlist = context.Orders.Where(x => x.DateDelivery == datedelivery).ToList <Order>();

            return(orderlist);
        }
コード例 #22
0
 public List <Employee> FindEmployeesByRole(string role)
 {
     using (SSAEntities ssae = new SSAEntities())
     {
         return(ssae.Employees.Where(x => x.Role == role).ToList());
     }
 }
コード例 #23
0
        public static Stationery getStationery(String itemCode)
        {
            SSAEntities ssae       = new SSAEntities();
            Stationery  stationery = ssae.Stationeries.Where(x => x.ItemCode.Contains(itemCode)).FirstOrDefault();

            return(stationery);
        }
コード例 #24
0
        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);
            }
        }
コード例 #25
0
 public RequisitionDetail GetLastStatTransId()
 {
     using (SSAEntities s = new SSAEntities())
     {
         RequisitionDetail rd = s.RequisitionDetails.OrderByDescending(x => x.StatTransId).FirstOrDefault();
         return(rd);
     }
 }
コード例 #26
0
 //----------------------------------
 public int CreateRequisitionDetail(RequisitionDetail r)
 {
     using (SSAEntities s = new SSAEntities())
     {
         s.RequisitionDetails.Add(r);
         return(s.SaveChanges());
     }
 }
コード例 #27
0
        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);
        }
コード例 #28
0
 public Requisition GetLastRequisitionId()
 {
     using (SSAEntities s = new SSAEntities())
     {
         Requisition r = s.Requisitions.OrderByDescending(x => x.RequisitionId).FirstOrDefault();
         return(r);
     }
 }
コード例 #29
0
        public StockAdjustment FindAdjustmentById(int adjustmentId)
        {
            SSAEntities     context    = new SSAEntities();
            StockAdjustment adjustment = context.StockAdjustments
                                         .Where(x => x.AdjustmentId == adjustmentId).FirstOrDefault();

            return(adjustment);
        }
コード例 #30
0
        public List <StockAdjustment> FindAllAdjustmentsOfVoucher(int voucherNumber)
        {
            SSAEntities            context         = new SSAEntities();
            List <StockAdjustment> listAdjustments = context.StockAdjustments
                                                     .Where(x => x.VoucherNumber == voucherNumber).ToList <StockAdjustment>();

            return(listAdjustments);
        }