/// <summary> /// 保存数据 /// </summary> protected string UpdateItemCategory() { var bll = new ItemCategoryService(this.CurrentUserInfo); var data = this.DeserializeJSONContent <ItemCategoryInfo>(); var rsp = new ResponseData(); if (data != null) { IList <ItemCategoryInfo> listdata = bll.GetItemCagegoryList("", "");//获取所有类别 if (Searchtype(listdata, data.Item_Category_Id, data.Parent_Id)) { rsp.success = false; rsp.msg = "上级分类不能选择自身下级"; return(rsp.ToJSON()); } if (CheckCategoryNameIsExist(data.Item_Category_Id, data.Item_Category_Name, listdata)) { rsp.success = false; rsp.msg = "商品品类不能重复"; return(rsp.ToJSON()); } if (string.IsNullOrWhiteSpace(data.Item_Category_Code)) { rsp.success = false; rsp.msg = "类型编码不能为空"; return(rsp.ToJSON()); } if (string.IsNullOrWhiteSpace(data.Status)) { rsp.success = false; rsp.msg = "状态不能为空"; return(rsp.ToJSON()); } if (string.IsNullOrWhiteSpace(data.Parent_Id)) { rsp.success = false; rsp.msg = "上级分类不能为空"; return(rsp.ToJSON()); } data.Create_User_Id = CurrentUserInfo.CurrentUser.User_Id; data.Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); data.Create_User_Name = CurrentUserInfo.CurrentUser.User_Name; data.CustomerID = CurrentUserInfo.CurrentUser.customer_id; bll.SetItemCategoryInfo(this.CurrentUserInfo, data); } rsp.success = true; rsp.msg = "保存成功"; // return(rsp.ToJSON()); }
/// <summary> /// 保存数据 /// </summary> protected string UpdateItemCategory() { var bll = new ItemCategoryService(this.CurrentUserInfo); var data = this.DeserializeJSONContent <ItemCategoryInfo>(); var rsp = new ResponseData(); if (data != null) { if (string.IsNullOrWhiteSpace(data.Item_Category_Code)) { rsp.success = false; rsp.msg = "类型编码不能为空"; return(rsp.ToJSON()); } if (string.IsNullOrWhiteSpace(data.Status)) { rsp.success = false; rsp.msg = "状态不能为空"; return(rsp.ToJSON()); } if (string.IsNullOrWhiteSpace(data.Parent_Id)) { rsp.success = false; rsp.msg = "上级分类不能为空"; return(rsp.ToJSON()); } data.Create_User_Id = CurrentUserInfo.CurrentUser.User_Id; data.Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); data.Create_User_Name = CurrentUserInfo.CurrentUser.User_Name; data.CustomerID = CurrentUserInfo.CurrentUser.customer_id; // bll.SetItemCategoryInfo(this.CurrentUserInfo, data); } // return(rsp.ToJSON()); }
/// <summary> /// 商品分类信息 /// </summary> public string SaveItemCategory() { var itemCategoryService = new ItemCategoryService(CurrentUserInfo); ItemCategoryInfo itemCategory = new ItemCategoryInfo(); string content = string.Empty; var responseData = new ResponseData(); string key = string.Empty; string ItemCategoryId = string.Empty; if (Request("itemCategorys") != null && Request("itemCategorys") != string.Empty) { key = Request("itemCategorys").ToString().Trim(); } if (Request("ItemCategoryId") != null && Request("ItemCategoryId") != string.Empty) { ItemCategoryId = Request("ItemCategoryId").ToString().Trim(); } itemCategory = key.DeserializeJSONTo <ItemCategoryInfo>(); if (itemCategory.Item_Category_Code == null || itemCategory.Item_Category_Code.Trim().Length == 0) { responseData.success = false; responseData.msg = "类型编码不能为空"; return(responseData.ToJSON()); } if (itemCategory.Item_Category_Name == null || itemCategory.Item_Category_Name.Trim().Length == 0) { responseData.success = false; responseData.msg = "类型名称不能为空"; return(responseData.ToJSON()); } if (itemCategory.Status == null || itemCategory.Status.Trim().Length == 0) { responseData.success = false; responseData.msg = "状态不能为空"; return(responseData.ToJSON()); } if (itemCategory.Parent_Id == null || itemCategory.Parent_Id.Trim().Length == 0) { responseData.success = false; responseData.msg = "上级商品名称不能为空"; return(responseData.ToJSON()); } itemCategory.Create_User_Id = CurrentUserInfo.CurrentUser.User_Id; itemCategory.Create_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); itemCategory.Create_User_Name = CurrentUserInfo.CurrentUser.User_Name; itemCategory.CustomerID = CurrentUserInfo.CurrentUser.customer_id; if (ItemCategoryId.Trim().Length != 0) { itemCategory.Item_Category_Id = ItemCategoryId; } bool status = true; string message = "保存成功"; try { itemCategoryService.SetItemCategoryInfo(CurrentUserInfo, itemCategory); } catch (Exception ex) { status = false; message = ex.Message; } responseData.success = status; responseData.msg = message; content = responseData.ToJSON(); return(content); }