public static List <tbl_RefundGoods> GetByAgent(int AgentID)
        {
            using (var dbe = new inventorymanagementEntities())
            {
                List <tbl_RefundGoods> las = new List <tbl_RefundGoods>();

                las = dbe.tbl_RefundGoods.Where(r => r.AgentID == AgentID).OrderByDescending(r => r.CreatedDate).ToList();
                var a = las.GroupBy(r => r.CreatedBy).ToList();
                return(las);
            }
        }
示例#2
0
        public static tbl_DiscountGroup GetByID(int ID)
        {
            using (var con = new inventorymanagementEntities())
            {
                var discountGroup = con.tbl_DiscountGroup
                                    .Where(a => a.ID == ID)
                                    .FirstOrDefault();

                return(discountGroup);
            }
        }
示例#3
0
        public static bool deleteAll(int orderID)
        {
            using (var con = new inventorymanagementEntities())
            {
                var fees = con.Fees.Where(x => x.OrderID == orderID);
                con.Fees.RemoveRange(fees);
                con.SaveChanges();
            }

            return(true);
        }
示例#4
0
        /// <summary>
        /// Lấy tất cả sản phẩm của phiên kiểm
        /// </summary>
        /// <param name="checkID"></param>
        /// <returns></returns>
        public static IList <CheckWarehouseDetail> getProductByCheckID(int checkID)
        {
            using (var con = new inventorymanagementEntities())
            {
                var products = con.CheckWarehouseDetails
                               .Where(x => x.CheckWarehouseID == checkID)
                               .OrderByDescending(o => o.ModifiedDate)
                               .ToList();

                return(products);
            }
        }
示例#5
0
 public static int Insert(string Name, int ParentID)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         PostCategory ui = new PostCategory();
         ui.Name     = Name;
         ui.ParentID = ParentID;
         dbe.PostCategories.Add(ui);
         int kq = dbe.SaveChanges();
         return(ui.ID);
     }
 }
 public static List <tbl_WhiteDomain> GetAll()
 {
     using (var db = new inventorymanagementEntities())
     {
         var wd = db.tbl_WhiteDomain.Where(x => x.IsHidden == false).ToList();
         if (wd.Count() > 0)
         {
             return(wd);
         }
         return(null);
     }
 }
示例#7
0
 public static DeliverySaveAddress GetByID(int ID)
 {
     using (var db = new inventorymanagementEntities())
     {
         var pro = db.DeliverySaveAddresses.Where(x => x.ID == ID).FirstOrDefault();
         if (pro != null)
         {
             return(pro);
         }
         return(null);
     }
 }
示例#8
0
 public static List <DeliverySaveAddress> GetAll()
 {
     using (var db = new inventorymanagementEntities())
     {
         var pro = db.DeliverySaveAddresses.Where(x => x.PID == null && x.Type == 0).ToList();
         if (pro.Count() > 0)
         {
             return(pro);
         }
         return(null);
     }
 }
 public static tbl_Province GetByID(int ID)
 {
     using (var db = new inventorymanagementEntities())
     {
         var pro = db.tbl_Province.Where(x => x.ID == ID).FirstOrDefault();
         if (pro != null)
         {
             return(pro);
         }
         return(null);
     }
 }
示例#10
0
 public static List <tbl_Province> GetAll()
 {
     using (var db = new inventorymanagementEntities())
     {
         var pro = db.tbl_Province.Where(x => x.IsHidden == false).ToList();
         if (pro.Count() > 0)
         {
             return(pro);
         }
         return(null);
     }
 }
 public static tbl_WhiteDomain GetByID(int ID)
 {
     using (var db = new inventorymanagementEntities())
     {
         var wd = db.tbl_WhiteDomain.Where(x => x.ID == ID).FirstOrDefault();
         if (wd != null)
         {
             return(wd);
         }
         return(null);
     }
 }
        /// <summary>
        /// Lấy danh sách bài viết public thể hiện tại home
        /// </summary>
        /// <param name="postSlug"></param>
        /// <returns></returns>
        public List <PostPublic> getHomePosts()
        {
            using (var con = new inventorymanagementEntities())
            {
                var homePosts = con.PostPublics
                                .Where(x => x.AtHome == true)
                                .OrderByDescending(o => o.ModifiedDate)
                                .ToList();

                return(homePosts);
            }
        }
        public List <FlutterPostCardModel> getPosts(FlutterPostFilterModel filter, ref PaginationMetadataModel pagination)
        {
            using (var con = new inventorymanagementEntities())
            {
                var posts = con.PostPublics.Where(x => x.IsPolicy == filter.isPolicy);

                if (!String.IsNullOrEmpty(filter.categorySlug))
                {
                    var categories = _postCategory.getPostCategoryChild(filter.categorySlug);

                    if (categories == null || categories.Count() == 0)
                    {
                        return(null);
                    }

                    var categoriesID = categories.Select(x => x.id).ToList();
                    posts = posts.Where(p => categoriesID.Contains(p.CategoryID));
                }

                var data = posts
                           .OrderByDescending(o => o.ModifiedDate)
                           .Select(x => new FlutterPostCardModel()
                {
                    action      = x.Action,
                    name        = x.Title,
                    actionValue = x.Action == FlutterPageNavigation.ViewMore ? (x.IsPolicy ? "policy/" : "post/") + x.ActionValue : x.ActionValue,
                    image       = x.Thumbnail,
                    message     = x.Summary,
                    createdDate = x.ModifiedDate
                })
                           .ToList();

                // Lấy tổng số record sản phẩm
                pagination.totalCount = data.Count();

                // Calculating Totalpage by Dividing (No of Records / Pagesize)
                pagination.totalPages = (int)Math.Ceiling(pagination.totalCount / (double)pagination.pageSize);

                var result = data
                             .Skip((pagination.currentPage - 1) * pagination.pageSize)
                             .Take(pagination.pageSize)
                             .ToList();

                // if CurrentPage is greater than 1 means it has previousPage
                pagination.previousPage = pagination.currentPage > 1 ? "Yes" : "No";

                // if TotalPages is greater than CurrentPage means it has nextPage
                pagination.nextPage = pagination.currentPage < pagination.totalPages ? "Yes" : "No";

                return(result);
            }
        }
示例#14
0
        public static void Insert(tbl_OrderDetail orderDetail)
        {
            using (var con = new inventorymanagementEntities())
            {
                #region Cập nhật thôn tin giá vốn
                Nullable <double> cogs = null;

                #region Sản phẩm đơn gian
                if (orderDetail.ProductType == 1)
                {
                    cogs = con.tbl_Product
                           .Where(x => x.ID == orderDetail.ProductID)
                           .Select(x => x.CostOfGood.HasValue ? x.CostOfGood.Value : 0)
                           .SingleOrDefault();
                }
                #endregion

                #region Sản phẩm biến thể
                if (orderDetail.ProductType == 2)
                {
                    cogs = con.tbl_ProductVariable
                           .Where(x => x.ID == orderDetail.ProductVariableID)
                           .Select(x => x.CostOfGood.HasValue ? x.CostOfGood.Value : 0)
                           .SingleOrDefault();
                }
                #endregion
                #endregion

                #region Khởi tạo chi tiết đơn hàng
                tbl_OrderDetail ui = new tbl_OrderDetail();
                ui.AgentID                   = orderDetail.AgentID;
                ui.OrderID                   = orderDetail.OrderID;
                ui.SKU                       = orderDetail.SKU;
                ui.ProductID                 = orderDetail.ProductID;
                ui.ProductVariableID         = orderDetail.ProductVariableID;
                ui.ProductVariableDescrition = orderDetail.ProductVariableDescrition;
                ui.Quantity                  = orderDetail.Quantity;
                ui.Price                     = orderDetail.Price;
                ui.Status                    = orderDetail.Status;
                ui.DiscountPrice             = orderDetail.DiscountPrice;
                ui.ProductType               = orderDetail.ProductType;
                ui.CreatedDate               = orderDetail.CreatedDate;
                ui.CreatedBy                 = orderDetail.CreatedBy;
                ui.ModifiedDate              = orderDetail.ModifiedDate;
                ui.ModifiedBy                = orderDetail.ModifiedBy;
                ui.IsCount                   = orderDetail.IsCount;
                ui.CostOfGood                = cogs.HasValue ? Convert.ToDecimal(cogs.Value) : 0;
                con.tbl_OrderDetail.Add(ui);
                con.SaveChanges();
                #endregion
            }
        }
示例#15
0
        public static ProductTag get(int productID, ProductTag prodTag)
        {
            using (var con = new inventorymanagementEntities())
            {
                var productTags = con.ProductTags
                                  .Where(x => x.TagID == prodTag.TagID)
                                  .Where(x => x.ProductID == productID)
                                  .Where(x => x.ProductVariableID == 0)
                                  .FirstOrDefault();

                return(productTags);
            }
        }
示例#16
0
 public static List <PostClone> GetAll(int postPublicID)
 {
     using (var dbe = new inventorymanagementEntities())
     {
         List <PostClone> result = new List <PostClone>();
         result = dbe.PostClones.Where(p => p.PostPublicID == postPublicID).OrderByDescending(o => o.ID).ToList();
         if (result.Count > 0)
         {
             return(result);
         }
         return(null);
     }
 }
        public static void cancel(int postOfficeID)
        {
            using (var con = new inventorymanagementEntities())
            {
                var postOffice = con.DeliveryPostOffices.Where(x => x.ID == postOfficeID).FirstOrDefault();

                if (postOffice != null)
                {
                    postOffice.OrderStatus = (int)OrderStatus.Spam;
                    con.SaveChanges();
                }
            }
        }