public ActionResult CateList() { string cateName = WebUtil.GetFormValue <string>("cateName", string.Empty); int pageIndex = WebUtil.GetFormValue <int>("pageIndex", 0); int pageSize = WebUtil.GetFormValue <int>("pageSize", 0); ProductCategoryProvider provider = new ProductCategoryProvider(); ProductCategoryEntity entity = new ProductCategoryEntity(); if (!cateName.IsEmpty()) { entity.Begin <ProductCategoryEntity>() .Where <ProductCategoryEntity>("CateNum", ECondition.Like, "%" + cateName + "%") .Or <ProductCategoryEntity>("CateName", ECondition.Like, "%" + cateName + "%") .End <ProductCategoryEntity>() ; } PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; List <ProductCategoryEntity> list = provider.GetList(entity, ref pageInfo); list = list.IsNull() ? new List <ProductCategoryEntity>() : list; string json = ConvertJson.ListToJson <ProductCategoryEntity>(list, "data"); JsonObject jsonObject = new JsonObject(json); this.ReturnJson.AddProperty("list", jsonObject); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return(Content(this.ReturnJson.ToString())); }
/// <summary> /// 查询分页 /// </summary> /// <returns></returns> public ActionResult GetPage() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); int PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int PageSize = WebUtil.GetFormValue <int>("PageSize", 10); string CateNum = WebUtil.GetFormValue <string>("CateNum"); string CateName = WebUtil.GetFormValue <string>("CateName"); string Remark = WebUtil.GetFormValue <string>("Remark"); ProductCategoryEntity entity = new ProductCategoryEntity(); entity.CateNum = CateNum; entity.CateName = CateName; entity.Remark = Remark; PageInfo pageInfo = new PageInfo(); pageInfo.PageIndex = PageIndex; pageInfo.PageSize = PageSize; ProductCategoryProvider provider = new ProductCategoryProvider(CompanyID); List <ProductCategoryEntity> list = provider.GetList(entity, ref pageInfo); DataListResult <ProductCategoryEntity> result = new DataListResult <ProductCategoryEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = list, PageInfo = pageInfo }; return(Content(JsonHelper.SerializeObject(result))); }
/// <summary> /// 查询产品类别列表 /// </summary> /// <returns></returns> public ActionResult GetList() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); ProductCategoryProvider provider = new ProductCategoryProvider(CompanyID); List <ProductCategoryEntity> list = provider.GetList(); DataListResult <ProductCategoryEntity> result = new DataListResult <ProductCategoryEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = list }; return(Content(JsonHelper.SerializeObject(result))); }
/// <summary> /// 获得产品的类别 /// </summary> /// <param name="cateNum"></param> /// <returns></returns> public static string GetProductCategory(string cateNum) { ProductCategoryProvider provider = new ProductCategoryProvider(); List <ProductCategoryEntity> list = provider.GetList(); StringBuilder sb = new StringBuilder(); string departTemplate = "<option value='{0}' {1}>{2}</option>"; sb.AppendFormat(departTemplate, "", "", "请选择类别"); if (!list.IsNullOrEmpty()) { foreach (ProductCategoryEntity depart in list) { sb.AppendFormat(departTemplate, depart.CateNum, depart.CateNum == cateNum ? "selected='selected'" : string.Empty, depart.CateName); } } return(sb.ToString()); }
/// <summary> /// 查询所有的货品种类 /// </summary> /// <returns></returns> public List <ProductCategory_CE> GetList() { ProductCategoryProvider provider = new ProductCategoryProvider(); List <ProductCategoryEntity> listResult = provider.GetList(); if (!listResult.IsNullOrEmpty()) { List <ProductCategory_CE> list = new List <ProductCategory_CE>(); foreach (ProductCategoryEntity item in listResult) { ProductCategory_CE ce = ProductCategory_To.ToCE(item); list.Add(ce); } return(list); } return(null); }