private SupplierProductQuery GetDataQuery(HttpContext context) { SupplierProductQuery supplierProductQuery = new SupplierProductQuery(); supplierProductQuery.Keywords = base.GetParameter(context, "Keywords", true); supplierProductQuery.CategoryId = base.GetIntParam(context, "CategoryId", true); if (supplierProductQuery.CategoryId.HasValue) { supplierProductQuery.MaiCategoryPath = CatalogHelper.GetCategory(supplierProductQuery.CategoryId.Value).Path; } supplierProductQuery.SaleStatus = ProductSaleStatus.OnStock; supplierProductQuery.AuditStatus = ProductAuditStatus.Apply; int?intParam = base.GetIntParam(context, "SupplierId", true); if (intParam.HasValue) { supplierProductQuery.SupplierId = intParam.Value; } else { supplierProductQuery.SupplierId = -1; } supplierProductQuery.Role = SystemRoles.SystemAdministrator; supplierProductQuery.PageIndex = base.CurrentPageIndex; supplierProductQuery.PageSize = base.CurrentPageSize; supplierProductQuery.SortBy = "UpdateDate"; supplierProductQuery.SortOrder = SortAction.Desc; return(supplierProductQuery); }
private DataGridViewModel <Dictionary <string, object> > GetProducts(SupplierProductQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); string empty = string.Empty; if (query != null) { Globals.EntityCoding(query, true); DbQueryResult products = ProductHelper.GetProducts(query); List <Dictionary <string, object> > list = DataHelper.DataTableToDictionary(products.Data); List <Dictionary <string, object> > list2 = new List <Dictionary <string, object> >(); foreach (Dictionary <string, object> item in list) { ProductInfo productInfo = item.ToObject <ProductInfo>(); item.Add("AuditStatusStr", this.ParseAuditStatus(string.Concat((int)productInfo.AuditStatus))); if (string.IsNullOrEmpty(item["ThumbnailUrl40"].ToNullString())) { item["ThumbnailUrl40"] = HiContext.Current.SiteSettings.DefaultProductImage; } } dataGridViewModel.rows = list; dataGridViewModel.total = products.TotalRecords; } return(dataGridViewModel); }
public void GetList(HttpContext context) { SupplierProductQuery dataQuery = this.GetDataQuery(context); DataGridViewModel <Dictionary <string, object> > dataList = this.GetDataList(dataQuery); string s = base.SerializeObjectToJson(dataList); context.Response.Write(s); context.Response.End(); }
private DataGridViewModel <Dictionary <string, object> > GetDataList(SupplierProductQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult products = ProductHelper.GetProducts(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(products.Data); foreach (Dictionary <string, object> row in dataGridViewModel.rows) { if (string.IsNullOrEmpty(row["ThumbnailUrl40"].ToNullString())) { row["ThumbnailUrl40"] = HiContext.Current.SiteSettings.DefaultProductImage; } } dataGridViewModel.total = products.TotalRecords; } return(dataGridViewModel); }
private SupplierProductQuery GetDataQuery(HttpContext context) { SupplierProductQuery supplierProductQuery = new SupplierProductQuery(); supplierProductQuery.Keywords = base.GetParameter(context, "Keywords", true); supplierProductQuery.ProductCode = base.GetParameter(context, "ProductCode", true); supplierProductQuery.CategoryId = base.GetIntParam(context, "CategoryId", true); supplierProductQuery.BrandId = base.GetIntParam(context, "BrandId", true); supplierProductQuery.TagId = base.GetIntParam(context, "TagId", true); supplierProductQuery.TypeId = base.GetIntParam(context, "TypeId", true); int?intParam = base.GetIntParam(context, "SaleStatus", true); if (intParam.HasValue) { supplierProductQuery.SaleStatus = (ProductSaleStatus)intParam.Value; } else { supplierProductQuery.SaleStatus = ProductSaleStatus.All; } supplierProductQuery.IsWarningStock = base.GetBoolParam(context, "IsWarningStock", false).Value; if (supplierProductQuery.CategoryId.HasValue) { supplierProductQuery.MaiCategoryPath = CatalogHelper.GetCategory(supplierProductQuery.CategoryId.Value).Path; } int?intParam2 = base.GetIntParam(context, "SupplierId", true); if (intParam2.HasValue) { supplierProductQuery.SupplierId = intParam2.Value; } else { supplierProductQuery.SupplierId = -1; } supplierProductQuery.AuditStatus = ProductAuditStatus.Pass; supplierProductQuery.PageIndex = base.CurrentPageIndex; supplierProductQuery.PageSize = base.CurrentPageSize; supplierProductQuery.SortBy = "DisplaySequence"; supplierProductQuery.SortOrder = SortAction.Desc; return(supplierProductQuery); }
private DataGridViewModel <Dictionary <string, object> > GetDataList(SupplierProductQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { Globals.EntityCoding(query, true); DbQueryResult products = ProductHelper.GetProducts(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(products.Data); dataGridViewModel.total = products.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { row.Add("SaleStatusText", this.ParseSaleStatus((int)row["SaleStatus"])); if (string.IsNullOrEmpty(row["ThumbnailUrl40"].ToNullString())) { row["ThumbnailUrl40"] = HiContext.Current.SiteSettings.DefaultProductImage; } } } return(dataGridViewModel); }
private void GetList(HttpContext context) { int? categoryId = null; int? typeId = null; bool flag = false; int pageIndex = 1; int pageSize = 10; string empty = string.Empty; ProductSaleStatus saleStatus = ProductSaleStatus.All; string keywords = context.Request["productName"]; string productCode = context.Request["productCode"]; flag = false; if (context.Request["isWarning"] == "true") { flag = true; } empty = context.Request["categoryId"]; if (!string.IsNullOrWhiteSpace(empty)) { try { categoryId = int.Parse(empty); } catch { categoryId = null; } } empty = context.Request["page"]; if (!string.IsNullOrWhiteSpace(empty)) { try { pageIndex = int.Parse(empty); } catch { pageIndex = 1; } } empty = context.Request["rows"]; if (!string.IsNullOrWhiteSpace(empty)) { try { pageSize = int.Parse(empty); } catch { pageSize = 10; } } empty = context.Request["typeId"]; if (!string.IsNullOrWhiteSpace(empty)) { try { typeId = int.Parse(empty); } catch { typeId = null; } } empty = context.Request["saleStatus"]; if (!string.IsNullOrWhiteSpace(empty)) { try { saleStatus = (ProductSaleStatus)Enum.Parse(typeof(ProductSaleStatus), empty); } catch { saleStatus = ProductSaleStatus.All; } } SupplierProductQuery supplierProductQuery = new SupplierProductQuery { Keywords = keywords, ProductCode = productCode, CategoryId = categoryId, PageSize = pageSize, PageIndex = pageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", TypeId = typeId, SaleStatus = saleStatus, AuditStatus = ProductAuditStatus.Pass, SupplierId = HiContext.Current.Manager.StoreId, IsWarningStock = flag }; if (supplierProductQuery.CategoryId > 0) { supplierProductQuery.MaiCategoryPath = CatalogHelper.GetCategory(categoryId.Value).Path; } string s = base.SerializeObjectToJson(this.GetProducts(supplierProductQuery)); context.Response.Write(s); context.Response.End(); }
private void GetList(HttpContext context) { int? categoryId = null; int? typeId = null; string empty = string.Empty; string empty2 = string.Empty; ProductSaleStatus productSaleStatus = ProductSaleStatus.All; string keywords = context.Request["productName"]; string productCode = context.Request["productCode"]; empty2 = context.Request["AuditStatus"]; empty = context.Request["categoryId"]; if (!string.IsNullOrWhiteSpace(empty)) { try { categoryId = int.Parse(empty); } catch { categoryId = null; } } empty = context.Request["typeId"]; if (!string.IsNullOrWhiteSpace(empty)) { try { typeId = int.Parse(empty); } catch { typeId = null; } } SupplierProductQuery supplierProductQuery = new SupplierProductQuery { Keywords = keywords, ProductCode = productCode, CategoryId = categoryId, PageSize = base.CurrentPageSize, PageIndex = base.CurrentPageIndex, SortOrder = SortAction.Desc, SortBy = "UpdateDate", TypeId = typeId, SaleStatus = ProductSaleStatus.OnStock, SupplierId = HiContext.Current.Manager.StoreId, Role = SystemRoles.SupplierAdmin }; if (!string.IsNullOrEmpty(empty2)) { supplierProductQuery.AuditStatus = (ProductAuditStatus)Enum.Parse(typeof(ProductAuditStatus), empty2); } if (supplierProductQuery.CategoryId > 0) { supplierProductQuery.MaiCategoryPath = CatalogHelper.GetCategory(categoryId.Value).Path; } string s = base.SerializeObjectToJson(this.GetProducts(supplierProductQuery)); context.Response.Write(s); context.Response.End(); }