Exemplo n.º 1
0
        /// <summary>
        /// function get all data tblTypeProduct
        /// </summary>
        /// <returns></returns>
        public List <ArticleAutoItem> GetList(out int total, string name, int?parentId, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblArticleAuto
                        where p.Name.ToLower().Contains(name) && p.IsDeleted == isDelete
                        select p;

            if (parentId.HasValue)
            {
                query = query.Where(p => p.Parent == parentId);
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new ArticleAutoItem()
            {
                ID = p.ID,
                Name = p.Name,
                Link = p.Link,
                PictureID = p.PictureID.HasValue ? p.PictureID.Value : 0,
                Number = p.Number.HasValue ? p.Number.Value : 0,
                Parent = p.Parent,
                IsShow = p.IsShow.HasValue && p.IsShow.Value,
                IsDeleted = p.IsDeleted.HasValue && p.IsDeleted.Value,
                Xpath = p.Xpath,
                XpathTitle = p.XpathTitle,
                XpathSummary = p.XpathSummary,
                XpathDetail = p.XpathDetail,
                XpathImage = p.XpathImage,
                Xpage = p.Xpage,
                XpathPaging = p.XpathPaging,
                TypeID = p.TypeID.HasValue ? p.TypeID.Value : 0
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 2
0
        /// <summary>
        /// function get all data tblArticle
        /// </summary>
        /// <returns></returns>
        public List <ArticleItem> GetList(out int total, string name, int?typeId, int?groupId, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblArticle
                        where p.IsDeleted == isDelete && !string.IsNullOrEmpty(p.LinkReference)
                        select p;

            if (typeId.HasValue)
            {
                query = query.Where(a => a.TypeID == typeId);
            }

            if (groupId.HasValue)
            {
                query = query.Where(a => a.tblGroup_Article_Map.Any(g => g.GroupID == groupId));
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new ArticleItem()
            {
                ID = p.ID,
                Title = p.Title,
                TitleAscii = p.TitleAscii,
                SEOTitle = p.SEOTitle,
                SEODescription = p.SEODescription,
                SEOKeyword = p.SEOKeyword,
                Number = p.Number,
                Summary = p.Summary,
                Detail = p.Detail,
                Tags = p.Tags,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 3
0
        /// <summary>
        /// function get all data tblTypeArticle
        /// </summary>
        /// <returns></returns>
        public List <ArticleTypeItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblTypeArticle
                        where p.Name.ToLower().Contains(name) && p.IsDeleted == isDelete
                        select p;

            query = query.Where(p => p.LanguageId == LanguageId);

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new ArticleTypeItem()
            {
                ID = p.ID,
                Name = p.Name,
                NameAscii = p.NameAscii,
                SEOTitle = p.SEOTitle,
                SEODescription = p.SEODescription,
                SEOKeyword = p.SEOKeyword,
                Number = p.Number,
                Summary = p.Summary,
                Detail = p.Detail,
                Parent = p.Parent,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 4
0
        /// <summary>
        /// function get all data tblProduct_Variant
        /// </summary>
        /// <returns></returns>
        public List <ProductVariantItem> GetList(out int total,
                                                 string name,
                                                 string code,
                                                 int?productId,
                                                 int currentRecord,
                                                 int numberRecord,
                                                 string propertyNameSort,
                                                 bool descending,
                                                 bool isDelete = false)
        {
            var query = from p in web365db.tblProduct_Variant
                        where p.Name.ToLower().Contains(name) && p.Code.ToLower().Contains(code) && p.IsDeleted == isDelete
                        select p;

            query = query.Where(p => p.tblProduct.tblTypeProduct.LanguageId == LanguageId);

            if (productId.HasValue)
            {
                query = query.Where(p => p.ProductID == productId.Value);
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new ProductVariantItem()
            {
                ID = p.ID,
                Name = p.Name,
                DisplayOrder = p.DisplayOrder,
                Code = p.Code,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 5
0
        /// <summary>
        /// function get all data UserProfile
        /// </summary>
        /// <returns></returns>
        public List <UserProfileItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.UserProfile
                        where p.IsDeleted == false
                        where p.UserName.ToLower().Contains(name)
                        where !p.ShopLevel.HasValue
                        select p;

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new UserProfileItem()
            {
                UserId = p.UserId,
                UserName = p.UserName,
                FirstName = p.FirstName,
                LastName = p.LastName,
                Gender = p.Gender,
                Email = p.Email,
                IsDeleted = p.IsDeleted,
                Phone = p.Phone,
                CreateBy = p.CreateBy,
                UpdateBy = p.UpdateBy,
                DateCreated = p.DateCreated,
                DateUpdated = p.DateUpdated,
                IsActive = p.IsActive
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 6
0
        /// <summary>
        /// function get all data tblProductFilter
        /// </summary>
        /// <returns></returns>
        public List <ProductFilterItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblProductFilter
                        where p.Name.ToLower().Contains(name) && p.IsDeleted == isDelete
                        orderby p.ID descending
                        select new ProductFilterItem()
            {
                ID             = p.ID,
                Name           = p.Name,
                NameAscii      = p.NameAscii,
                SEOTitle       = p.SEOTitle,
                SEODescription = p.SEODescription,
                SEOKeyword     = p.SEOKeyword,
                Number         = p.Number,
                Detail         = p.Detail,
                Parent         = p.Parent,
                IsShow         = p.IsShow
            };

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 7
0
        /// <summary>
        /// function get all data tblFile
        /// </summary>
        /// <returns></returns>
        public List <MenuItem> GetList(out int total, string name, int?parentId, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblMenu
                        where p.Name.ToLower().Contains(name) && p.IsDeleted == isDelete
                        select p;

            query = query.Where(p => p.LanguageId == LanguageId);

            if (parentId.HasValue)
            {
                query = query.Where(p => p.Parent == parentId);
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new MenuItem()
            {
                ID = p.ID,
                Name = p.Name,
                NameAscii = p.NameAscii,
                DateCreated = p.DateCreated,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 8
0
        /// <summary>
        /// function get all data tblProduct
        /// </summary>
        /// <returns></returns>
        public List <ProductItem> GetList(out int total,
                                          string name,
                                          string serial,
                                          int?typeId,
                                          int?manuId,
                                          int?distributorId,
                                          int?statusId,
                                          int?labelId,
                                          int currentRecord,
                                          int numberRecord,
                                          string propertyNameSort,
                                          bool descending,
                                          bool isDelete = false)
        {
            var query = from p in web365db.tblProduct
                        where p.Name.ToLower().Contains(name) && p.Serial.ToLower().Contains(serial) && p.IsDeleted == isDelete
                        select p;

            query = query.Where(p => p.tblTypeProduct.LanguageId == LanguageId);

            if (typeId.HasValue)
            {
                query = query.Where(p => p.TypeID == typeId);
            }

            if (manuId.HasValue)
            {
                query = query.Where(p => p.Manufacturer == manuId);
            }

            if (distributorId.HasValue)
            {
                query = query.Where(p => p.Distributor == distributorId);
            }

            if (statusId.HasValue)
            {
                query = query.Where(p => p.tblProduct_Status_Map.Any(s => s.ProductStatusID == statusId));
            }

            if (labelId.HasValue)
            {
                query = query.Where(p => p.tblProductLabel.Any(l => l.ID == labelId));
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new ProductItem()
            {
                ID = p.ID,
                Name = p.Name,
                NameAscii = p.NameAscii,
                TypeID = p.TypeID,
                Number = p.Number,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 9
0
        public List <UserInfoNew3> GetDaiLyCap1(int currentPage = 0, int pageSize = 0, string fDate = "", string tDate = "", string key = "", string propertyNameSort = "", bool descending = true)
        {
            var paramTotal = new SqlParameter
            {
                ParameterName = "total",
                SqlDbType     = SqlDbType.Int,
                Direction     = ParameterDirection.Output
            };

            if (!string.IsNullOrEmpty(fDate))
            {
                fDate = Convert.ToDateTime(fDate).ToString("yyyy-MM-dd 00:00:00.000");
            }
            if (!string.IsNullOrEmpty(tDate))
            {
                tDate = Convert.ToDateTime(tDate).ToString("yyyy-MM-dd 23:59:59.999");
            }

            var query = web365DbReder.Database.SqlQuery <UserInfoNew3>("exec [dbo].[PRC_AdminGetListDailyCap1] @fDate, @tDate, @key, @currentPage, @pageSize, @total OUTPUT",
                                                                       new SqlParameter("currentPage", currentPage),
                                                                       new SqlParameter("pageSize", pageSize),
                                                                       new SqlParameter("key", key),
                                                                       new SqlParameter("fDate", fDate),
                                                                       new SqlParameter("tDate", tDate),
                                                                       paramTotal);

            var result = query.Select(p => new UserInfoNew3()
            {
                user_id             = p.user_id,
                indexRow            = p.indexRow,
                fullname            = p.fullname,
                username            = p.username,
                gameCashN           = p.gameCashN.HasValue ? p.gameCashN.Value : 0,
                CashKet             = p.CashKet.HasValue ? p.CashKet.Value : 0,
                ShopLevel           = p.ShopLevel.HasValue ? p.ShopLevel.Value : 0,
                totalSendToUser     = p.totalSendToUser.HasValue ? p.totalSendToUser.Value : 0,
                totalRecivefromUser = p.totalRecivefromUser.HasValue ? p.totalRecivefromUser.Value : 0,
                total                   = (p.totalSendToUser.HasValue ? p.totalSendToUser.Value : 0) + (p.totalRecivefromUser.HasValue ? p.totalRecivefromUser.Value : 0),
                totalTax                = p.totalTax.HasValue ? p.totalTax.Value : 0,
                totalSendToUserCap1     = p.totalSendToUserCap1.HasValue ? p.totalSendToUserCap1.Value : 0,
                totalRecivefromUserCap1 = p.totalRecivefromUserCap1.HasValue ? p.totalRecivefromUserCap1.Value : 0,
                totalCap1               = (p.totalSendToUserCap1.HasValue ? p.totalSendToUserCap1.Value : 0) + (p.totalRecivefromUserCap1.HasValue ? p.totalRecivefromUserCap1.Value : 0),
                totalTaxCap1            = p.totalTaxCap1.HasValue ? p.totalTaxCap1.Value : 0,
            }).OrderByDescending(c => c.total).ToList();


            if (!string.IsNullOrEmpty(propertyNameSort))
            {
                var rsQueryable = result.AsQueryable();
                var result2     = descending ? QueryableHelper.OrderByDescending(rsQueryable, propertyNameSort) : QueryableHelper.OrderBy(rsQueryable, propertyNameSort);

                return(result2.ToList());
            }
            else
            {
                return(result);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// function get all data tblTypeProduct
        /// </summary>
        /// <returns></returns>
        public List <PictureItem> GetList(out int total,
                                          string name,
                                          string nameFile,
                                          int[] typeId,
                                          int currentRecord,
                                          int numberRecord,
                                          string propertyNameSort,
                                          bool descending,
                                          bool?isShow,
                                          bool isDelete = false)
        {
            var query = from p in web365db.tblPicture
                        where p.Name.ToLower().Contains(name) && p.FileName.ToLower().Contains(nameFile) && p.IsDeleted == isDelete
                        select p;

            if (typeId != null && typeId.Count() > 0)
            {
                query = query.Where(p => typeId.Contains(p.TypeID.Value));
            }

            if (isShow.HasValue)
            {
                query = query.Where(p => p.IsShow == isShow);
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new PictureItem()
            {
                ID = p.ID,
                Name = p.Name,
                FileName = p.FileName,
                TypeID = p.TypeID,
                Summary = p.Summary,
                Alt = p.Alt,
                Link = p.Link,
                Size = p.Size,
                DateCreated = p.DateCreated,
                DateUpdated = p.DateUpdated,
                CreatedBy = p.CreatedBy,
                UpdatedBy = p.UpdatedBy,
                IsShow = p.IsShow,
                IsDeleted = p.IsDeleted
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 11
0
        /// <summary>
        /// function get all data tblTypeProduct
        /// </summary>
        /// <returns></returns>
        public List <ReceiveInfoItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblReceiveInfo
                        where p.Name.ToLower().Contains(name) && p.IsDeleted == isDelete
                        orderby p.ID descending
                        select new ReceiveInfoItem()
            {
                ID     = p.ID,
                Name   = p.Name,
                IsShow = p.IsShow
            };

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 12
0
        /// <summary>
        /// function get all data tblCustomer
        /// </summary>
        /// <returns></returns>
        public List <CustomerItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblCustomer
                        where p.UserName.ToLower().Contains(name) && p.IsDeleted == isDelete
                        select p;

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new CustomerItem()
            {
                ID = p.ID,
                UserName = p.UserName,
                Email = p.Email,
                DateCreated = p.DateCreated,
                IsActive = p.IsActive.HasValue && p.IsActive.Value
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 13
0
        /// <summary>
        /// function get all data tblAdvertise
        /// </summary>
        /// <returns></returns>
        public List <AdvertiesItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblAdvertise
                        where p.Name.ToLower().Contains(name) && p.IsDeleted == isDelete
                        select p;

            query = query.Where(p => p.LanguageId == LanguageId);

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new AdvertiesItem()
            {
                ID = p.ID,
                Name = p.Name,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 14
0
        /// <summary>
        /// function get all data webpages_Roles
        /// </summary>
        /// <returns></returns>
        public List <UserRoleItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.webpages_Roles
                        where p.IsDeleted == p.IsDeleted
                        where p.RoleName.ToLower().Contains(name)
                        select p;

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new UserRoleItem()
            {
                RoleId = p.RoleId,
                RoleName = p.RoleName,
                CreatedBy = p.CreateBy,
                UpdatedBy = p.UpdateBy,
                DateCreated = p.DateCreated,
                DateUpdated = p.DateUpdated,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 15
0
        /// <summary>
        /// function get all data tblTypeProduct
        /// </summary>
        /// <returns></returns>
        public List<OrderItem> GetList(out int total,
            int? id,
            string customerName, 
            string email,
            string phone,
            int currentRecord, 
            int numberRecord, 
            string propertyNameSort,
            bool descending,
            bool? isViewed,
            bool isDelete = false)
        {
            var query = from p in web365db.tblOrder
                        where p.CustomerName.ToLower().Contains(customerName)
                        && p.Email.ToLower().Contains(email)
                        && p.Phone.ToLower().Contains(phone) 
                        && p.IsDeleted == isDelete                        
                        select p;

            if (id.HasValue)
            {
                query = query.Where(p => p.ID == id);
            }

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return query.Select(p => new OrderItem()
            {
                ID = p.ID,
                CustomerName = p.CustomerName,
                Email = p.Email,
                Phone = p.Phone,
                DateCreated = p.DateCreated,
                TotalCost = p.TotalCost,
                IsViewed = p.IsViewed
            }).Skip(currentRecord).Take(numberRecord).ToList();
        }
Exemplo n.º 16
0
        /// <summary>
        /// function get all data tblSupport
        /// </summary>
        /// <returns></returns>
        public List <SupportItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblSupport
                        where p.FullName.ToLower().Contains(name) && p.IsDeleted == isDelete
                        select p;

            query = query.Where(p => p.tblTypeSupport.LanguageId == LanguageId);

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new SupportItem()
            {
                ID = p.ID,
                FullName = p.FullName,
                Number = p.Number,
                Yahoo = p.Yahoo,
                Skype = p.Skype,
                Email = p.Email,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 17
0
        /// <summary>
        /// function get all data tblPage
        /// </summary>
        /// <returns></returns>
        public List <PageItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isDelete = false)
        {
            var query = from p in web365db.tblPage
                        where p.IsDeleted == false
                        where p.Name.ToLower().Contains(name)
                        select p;

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new PageItem()
            {
                ID = p.ID,
                Name = p.Name,
                Link = p.Link,
                ClassAtrtibute = p.ClassAtrtibute,
                Number = p.Number,
                Parent = p.Parent,
                HasChild = p.HasChild,
                IsShow = p.IsShow
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 18
0
        /// <summary>
        /// function get all data tblTypeArticle
        /// </summary>
        /// <returns></returns>
        public List <CommentItem> GetList(out int total, string name, int currentRecord, int numberRecord, string propertyNameSort, bool descending, bool isShow = true)
        {
            var query = from p in web365db.tblComment
                        //where p.Name.ToLower().Contains(name) && p.IsShow == isShow
                        select p;

            total = query.Count();

            query = descending ? QueryableHelper.OrderByDescending(query, propertyNameSort) : QueryableHelper.OrderBy(query, propertyNameSort);

            return(query.Select(p => new CommentItem()
            {
                ID = p.ID,
                Name = p.Name,
                Detail = p.Detail,
                Email = p.Email,
                CateJoinID = p.CateJoinID,
                JoinID = p.JoinID,
                IsShow = p.IsShow,
                DateCreated = p.DateCreated,
                CateName = p.tblTypeComment.Name
            }).Skip(currentRecord).Take(numberRecord).ToList());
        }
Exemplo n.º 19
0
 public static IQueryable <T> OrderByDescending <T>(this IQueryable <T> queryable, string propertyName)
 {
     return(QueryableHelper <T> .OrderByDescending(queryable, propertyName));
 }