Beispiel #1
0
        /// <summary>
        /// Trả về danh sách
        /// </summary>
        /// <returns></returns>
        public List<Receipt> GetReceipts()
        {
            var context = new StockDataEntities();

                return context.Receipts.ToList();

        }
Beispiel #2
0
        /// <summary>
        /// Trả về danh sách đơn vị
        /// </summary>
        /// <returns></returns>
        public List<Unit> GetUnits()
        {
            var context = new StockDataEntities();

            return context.Units.ToList();

        }
Beispiel #3
0
        /// <summary>
        /// Trả về danh sách
        /// </summary>
        /// <returns></returns>
        public List<Department> GetDepartments()
        {
            var context = new StockDataEntities();

            return context.Departments.ToList();

        }
Beispiel #4
0
        /// <summary>
        /// Danh sách Log
        /// </summary>
        /// <returns></returns>
        public List<Log> GetLogs()
        {
            var context = new StockDataEntities();

            return context.Logs.OrderByDescending(log => log.LogDate).ToList();

        }
Beispiel #5
0
 public List<InventoryView> GetAllInventories()
 {
     var context = new StockDataEntities();
     List<InventoryView> inventories = (from inventory in context.Inventories
         join product in context.Products on inventory.ProductID equals product.ProductID
         join productGroup in context.ProductGroups on product.ProductGroupID equals productGroup.ProductGroupID
         //join stock in context.Stocks on product.StockID equals stock.StockID
         join unit in context.Units on product.UnitID equals unit.UnitID
         where inventory.TotalOut > 0
         select new InventoryView()
         {
             ProductGroupID = product.ProductGroupID,
             ProductGroupName = productGroup.ProductGroupName,
             ProductID = product.ProductID,
             ProductName = product.ProductName,
             Price =  (long) product.Price,
             QuantityFirst =  (int) inventory.InventoryFirt,
             QuantityImport =  (int) inventory.TotalIn,
             QuantityExport = (int) inventory.TotalOut,
             QuantityInventory = (int) inventory.InventoryLast,
             InventoryDate = inventory.InventoryDate,
             UnitID = product.UnitID,
             UnitName = unit.UnitName,
             StockID = product.StockID,
         }).ToList();
     return inventories;
 }
Beispiel #6
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public List<ReportTotalView> GetReportTotals()
        {
            var context = new StockDataEntities();
            var reportTotals = (from inventory in context.Inventories

                join product in context.Products on inventory.ProductID equals product.ProductID

                //join stock in context.Stocks on product.StockID equals stock.StockName

                join unit in context.Units on product.UnitID equals unit.UnitID

                //join productGroup in context.ProductGroups on product.ProductGroupID equals productGroup.ProductGroupID
                select new ReportTotalView()
                {
                    ProductID = product.ProductID,
                    ProductName = product.ProductName,
                    Description = product.Description,
                    SPQ = unit.UnitName,
                    Price = (float) product.Price,
                    Inventory = (int) inventory.InventoryFirt,
                    Plan = (int) (inventory.Plan==null ? inventory.Plan : 0),
                    TotalIn = (int) inventory.TotalIn,
                    TotalOut = (int) inventory.TotalOut,
                    InventoryLast = (int) inventory.InventoryLast,
                    InventoryPrice = (float) product.Price,
                    InventoryDate = inventory.InventoryDate,
                    SearchByDate = inventory.Date,
                    
                }).ToList();

            return reportTotals;
        } 
Beispiel #7
0
        /// <summary>
        /// Danh sách user
        /// </summary>
        /// <returns></returns>
        public List<User> GetUsers()
        {
            var context = new StockDataEntities();

            return context.Users.ToList();

        }
Beispiel #8
0
        /// <summary>
        /// Trả về danh sách
        /// </summary>
        /// <returns></returns>
        public List<Issue> GetIssues()
        {
            var context = new StockDataEntities();

            return context.Issues.ToList();

        }
Beispiel #9
0
        /// <summary>
        /// Trả về danh sách
        /// </summary>
        /// <returns></returns>
        public List<Product> GetProducts()
        {
            var context = new StockDataEntities();

            return context.Products.ToList();


        }
Beispiel #10
0
        /// <summary>
        /// Trả về danh sách đơn vị
        /// </summary>
        /// <returns></returns>
        public List<Data.Stock> GetStocks()
        {
            var context = new StockDataEntities();

            return context.Stocks.ToList();


        }
Beispiel #11
0
        /// <summary>
        /// Trả về danh sách đơn vị
        /// </summary>
        /// <returns></returns>
        public List<Inventory> GetInventories()
        {
            var context = new StockDataEntities();

            return context.Inventories.ToList();


        }
Beispiel #12
0
        /// <summary>
        /// Trả về danh sách
        /// </summary>
        /// <returns></returns>
        public List<WeekReport> GetWeekReports(string reportDate)
        {
            var context = new StockDataEntities();

            if (string.IsNullOrEmpty(reportDate))
            {
                return context.WeekReports.ToList();
            }
            return context.WeekReports.Where(w => w.ReportDate == reportDate).ToList();
        }
Beispiel #13
0
        /// <summary>
        /// Danh sách item theo user
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        public List<Item> GetItemsByUserName(string userName)
        {
            var context = new StockDataEntities();

            var items = from item in context.Items
                where item.Users.Any(u => u.Username == userName)
                select item;

            return items.ToList();


        } 
Beispiel #14
0
        public List<UserPermission> GetPermissionsByUserName(string userName)
        {
            var context = new StockDataEntities();

            var permissionsByUsername = (from perUser in context.UserPermissions
                join permission in context.Permissions on perUser.ObjectID equals permission.ObjectID
                where perUser.Username == userName
                select perUser

                ).ToList();

            return permissionsByUsername;
        } 
Beispiel #15
0
 public DepartmentService()
 {
     _context = new StockDataEntities();
 }
Beispiel #16
0
 public StockService()
 {
     _context = new StockDataEntities();
 }
Beispiel #17
0
 public PermissionService()
 {
     _context = new StockDataEntities();
 }
Beispiel #18
0
 public List<Inventory> GetQuantityInventories()
 {
     var context = new StockDataEntities();
     return context.Inventories.Where(inven => inven.InventoryLast <= 5 && !string.IsNullOrEmpty(inven.InventoryLast.ToString())).ToList();
     
 }
Beispiel #19
0
 public InventoryService()
 {
     _context = new StockDataEntities();
 }
Beispiel #20
0
        //public Inventory GetInventoryById(Guid inventoryId)
        //{
        //    return _context.Inventories.FirstOrDefault(inven => inven.ID == inventoryId);
        //}

        public List<ReportByDepartment> GetReportsByDepartments()
        {
            var context = new StockDataEntities();
            var reportsByDepartments = (from issueDetails in context.IssueDetails
                join product in context.Products on issueDetails.ProductID equals product.ProductID
                join unit in context.Units on product.UnitID equals unit.UnitID
                join department in context.Departments on issueDetails.DepartmentID equals department.DepartmentID
            
            
                select new ReportByDepartment()
                {
                    ProductID = product.ProductID,
                    ProductName = product.ProductName,
                    Description = product.Description,
                    SPQ = unit.UnitName,
                    Price = (float) product.Price,
                    DepartmentID = department.DepartmentName,


                }).ToList();
            return reportsByDepartments;
        } 
Beispiel #21
0
  public ReceiptService()
 {
     _context = new StockDataEntities();
 }
Beispiel #22
0
 public WeekReportService()
 {
     _context = new StockDataEntities();
 }
Beispiel #23
0
 public ProductService()
 {
     _context = new StockDataEntities();
 }
Beispiel #24
0
 public IssueDetailService()
 {
     _context = new StockDataEntities();
 }