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; })); }
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; })); }
public static PageResult <ProductModel> Get( GiaSinhVienEntities db, PageArg <ProductModel.Select, ProductModel.Sort> pageArg, long[] id = null, StringParam str_Name = null, NumericParam num_CategoryId = null, NumericParam num_SubCategoryId = null, NumericParam num_Price = null, NumericParam num_Status = null, DateTimeParam date_CreateDate = null, NumericParam num_PostUserId = null, NumericParam num_DictrictId = null, NumericParam num_ProviceId = null) { return(DAOCore.DoPage <ProductModel, ProductModel.Select, ProductModel.Sort>(pageArg, (c, p) => { var total = new ObjectParameter("Total", typeof(int)); var query = new ObjectParameter("Query", typeof(string)); var data = db.usp_Product_Get( pageArg.SelectQuery(), pageArg.SortQuery(), p.PageIndex, p.PageSize, pageArg.DebugQuery, id == null ? null : string.Join(",", id), str_Name == null ? null : str_Name.ToString(), num_CategoryId == null ? null : num_CategoryId.ToString(), num_SubCategoryId == null ? null : num_SubCategoryId.ToString(), num_Price == null ? null : num_Price.ToString(), num_Status == null ? null : num_Status.ToString(), date_CreateDate == null ? null : date_CreateDate.ToString(), num_PostUserId == null ? null : num_PostUserId.ToString(), num_DictrictId == null ? null : num_DictrictId.ToString(), num_ProviceId == null ? null : num_ProviceId.ToString(), total, query).FirstOrDefault(); c.SetResult(p, c.ConvertFromXml(data), (int)total.Value, query.Value == DBNull.Value ? null : (string)query.Value); })); }
public static PageResult <UserInfoModel> Get( GiaSinhVienEntities db, PageArg <UserInfoModel.Select, UserInfoModel.Sort> pageArg, long[] id = null, StringParam str_Name = null, NumericParam num_Status = null) { return(DAOCore.DoPage <UserInfoModel, UserInfoModel.Select, UserInfoModel.Sort>(pageArg, (c, p) => { var total = new ObjectParameter("Total", typeof(int)); var query = new ObjectParameter("Query", typeof(string)); string data = null; //db.usp_Badwords_Get( // pageArg.SelectQuery(), pageArg.SortQuery(), p.PageIndex, p.PageSize, pageArg.DebugQuery, // id == null ? null : string.Join(",", id), // str_Value == null ? null : str_Value.ToString(), // num_Status == null ? null : num_Status.ToString(), // total, query).FirstOrDefault(); c.SetResult(p, c.ConvertFromXml(data), (int)total.Value, query.Value == DBNull.Value ? null : (string)query.Value); })); }
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; })); }