예제 #1
0
        public static PageResult <ProductCategoryModel> GetListProductCategory(long?actionUserId, int?pageIndex = 0, int?pageSize = 10,
                                                                               long[] id = null, string str_Value = null, int?num_Status = null)
        {
            return(BUSCore.DoPage <ProductCategoryModel>(
                       userId: actionUserId,
                       action: (c) =>
            {
                var pArg = new PageArg <ProductCategoryModel.Select, ProductCategoryModel.Sort>
                {
                    PageIndex = Convert.ToInt32(pageIndex),
                    PageSize = Convert.ToInt32(pageSize),
                    Select = new[]
                    {
                        new SelectItem <ProductCategoryModel.Select> {
                            Table = ProductCategoryModel.Select.ProductCategory, Column = new [] { "Id", "Name", "Photo" }
                        },
                    },
                    DebugQuery = true
                };

                //var r = ProductCategoryDAO.Get(c.Db, pArg,
                //    id: id,
                //    str_Value: str_Value == null ? null : new StringParam(str_Value),
                //    num_Status: num_Status == null ? null : new NumericParam(num_Status));
                var r = new PageResult <ProductCategoryModel>();
                c.SetError(r);
                if (r.Total == 0)
                {
                    r.Items = new List <ProductCategoryModel>();
                }
                return r;
            }));
        }
예제 #2
0
파일: Product.cs 프로젝트: GSVien/Code
        public static PageResult <ProductModel> Store_GetInfoProduct(long?actionUserId, long id)
        {
            return(BUSCore.DoPage <ProductModel>(
                       userId: actionUserId,
                       action: (c) =>
            {
                #region [Lấy dữ liệu]

                var pAgr = new PageArg <ProductModel.Select, ProductModel.Sort>
                {
                    PageIndex = 0,
                    PageSize = 1,
                    Select = new SelectItem <ProductModel.Select>[]
                    {
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Product,
                            Column =
                                new[] { "Id", "Name", "Description", "Photo", "CreateDate", "Title",
                                        "Price", "Link" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.District,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Province,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.UserInfo,
                            Column = new[] { "Id", "UserName", "AvatarPhoto", "Phone", "CreateDate" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.ProductCategory,
                            Column = new[] { "Id", "Name" }
                        }
                    },
                    DebugQuery = true
                };
                var num_Status = 1;
                long[] num_id = new long[] { id };

                var pResult = ProductDAO.Get(c.Db, pAgr,
                                             id: num_id,
                                             num_Status: num_Status == null ? null : new NumericParam(num_Status)
                                             );
                #endregion

                c.SetError(pResult);
                return pResult;
            }));
        }
예제 #3
0
파일: Product.cs 프로젝트: GSVien/Code
        public static PageResult <ProductModel> Store_GetListProduct(long?actionUserId, int pageIndex, int pageSize,
                                                                     string str_Name  = null, int?num_CategoryId = null, int?num_SubCategoryId = null,
                                                                     int?num_Price    = null, int?num_Status     = null, DateTime?StartDate    = null,
                                                                     DateTime?EndDate = null, int?num_PostUserId = null, int?num_DictrictId    = null, int?num_ProviceId = null)
        {
            return(BUSCore.DoPage <ProductModel>(
                       userId: actionUserId,
                       action: (c) =>
            {
                #region [Lấy dữ liệu]

                var pAgr = new PageArg <ProductModel.Select, ProductModel.Sort>
                {
                    PageIndex = pageIndex,
                    PageSize = pageSize,
                    Select = new SelectItem <ProductModel.Select>[]
                    {
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Product,
                            Column =
                                new[] { "Id", "Name", "Description", "Photo", "CreateDate", "Title",
                                        "Price", "Link" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.District,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.Province,
                            Column = new[] { "Id", "Name" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.UserInfo,
                            Column = new[] { "Id", "UserName", "AvatarPhoto" }
                        },
                        new SelectItem <ProductModel.Select>()
                        {
                            Table = ProductModel.Select.ProductCategory,
                            Column = new[] { "Id", "Name" }
                        }
                    },
                    DebugQuery = true
                };
                num_Status = 1;
                var pResult = ProductDAO.Get(c.Db, pAgr,
                                             str_Name: str_Name == null ? null : new StringParam(str_Name),
                                             num_CategoryId: num_CategoryId == null ? null : new NumericParam(num_CategoryId),
                                             num_SubCategoryId: num_SubCategoryId == null ? null : new NumericParam(num_SubCategoryId),
                                             num_Price: num_Price == null ? null : new NumericParam(num_Price),
                                             num_Status: num_Status == null ? null : new NumericParam(num_Status),
                                             date_CreateDate: StartDate == null ? null : new DateTimeParam(StartDate, EndDate),
                                             num_PostUserId: num_PostUserId == null ? null : new NumericParam(num_PostUserId),
                                             num_DictrictId: num_DictrictId == null ? null : new NumericParam(num_DictrictId),
                                             num_ProviceId: num_ProviceId == null ? null : new NumericParam(num_ProviceId)
                                             );
                #endregion

                c.SetError(pResult);
                return pResult;
            }));
        }