/// <summary> /// Web列表获取 /// </summary> public IList <BrandDetailEntity> GetWebBrandDetail(BrandDetailEntity entity, int Page, int PageSize) { if (PageSize <= 0) { PageSize = 15; } IList <BrandDetailEntity> list = new List <BrandDetailEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetWebBrandDetail(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { list = DataTableToObject.ConvertToList <BrandDetailEntity>(ds.Tables[0]); } return(list); }
/// <summary> /// 删除 /// </summary> public string BrandDetailDeleteData() { string content = string.Empty; string error = ""; var responseData = new ResponseData(); var service = new BrandDetailBLL(this.CurrentUserInfo); var propService = new PropService(this.CurrentUserInfo); string key = string.Empty; if (FormatParamValue(Request("ids")) != null && FormatParamValue(Request("ids")) != string.Empty) { key = FormatParamValue(Request("ids")).ToString().Trim(); } if (key == null || key.Trim().Length == 0) { responseData.success = false; responseData.msg = "ID不能为空"; return(responseData.ToJSON()); } string[] ids = key.Split(','); if (ids.Length > 0) { foreach (var id in ids) { var propObj = new BrandDetailEntity(); propObj.BrandId = id; service.Delete(propObj); //propService.DeleteProp(new PropInfo() { Prop_Id = id }); service.SetBrandAndPropSyn(propObj.BrandId, propObj.BrandName, 1, 1, out error); } } responseData.success = true; responseData.msg = error; content = responseData.ToJSON(); return(content); }
/// <summary> /// 根据属性ID获取属性信息 /// </summary> public string GetBrandDetailInfoById() { var service = new BrandDetailBLL(CurrentUserInfo); BrandDetailEntity obj = new BrandDetailEntity(); string content = string.Empty; string key = string.Empty; if (Request("item_id") != null && Request("item_id") != string.Empty) { key = Request("item_id").ToString().Trim(); } obj = service.GetByID(key); var jsonData = new JsonData(); jsonData.totalCount = obj == null ? "0" : "1"; jsonData.data = obj; content = jsonData.ToJSON(); return(content); }
/// <summary> /// 查询属性 /// </summary> public string GetBrandDetailListData() { var form = Request("form").DeserializeJSONTo <BrandDetailQueryEntity>(); var service = new BrandDetailBLL(CurrentUserInfo); IList <BrandDetailEntity> list; string content = string.Empty; int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1; BrandDetailEntity queryEntity = new BrandDetailEntity(); queryEntity.BrandName = FormatParamValue(form.BrandName); queryEntity.BrandCode = FormatParamValue(form.BrandCode); //if (Request("parentId") != null && Request("parentId").Length > 0)// && Request("parentId") != "ALL") //{ // queryEntity.Parent_Prop_id = FormatParamValue(Request("parentId")); //} //else //{ // queryEntity.Parent_Prop_id = "-99"; //} list = service.GetWebBrandDetail(queryEntity, pageIndex, PageSize); var dataTotalCount = service.GetWebBrandDetailCount(queryEntity); var jsonData = new JsonData(); jsonData.totalCount = dataTotalCount.ToString(); jsonData.data = list; content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", jsonData.data.ToJSON(), jsonData.totalCount); return(content); }
public void Update(BrandDetailEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran) { _currentDAO.Update(pEntity, pIsUpdateNullField, pTran); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(BrandDetailEntity pEntity, IDbTransaction pTran) { Update(pEntity, true, pTran); }
/// <summary> /// 在事务内创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Create(BrandDetailEntity pEntity, IDbTransaction pTran) { _currentDAO.Create(pEntity, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(BrandDetailEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <BrandDetailEntity> PagedQueryByEntity(BrandDetailEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex) { return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex)); }
/// <summary> /// 根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public BrandDetailEntity[] QueryByEntity(BrandDetailEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(BrandDetailEntity pEntity) { _currentDAO.Delete(pEntity); }
public void Update(BrandDetailEntity pEntity, bool pIsUpdateNullField) { _currentDAO.Update(pEntity, pIsUpdateNullField); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(BrandDetailEntity pEntity) { Update(pEntity, true); }
/// <summary> /// 品牌信息同步 /// </summary> /// <param name="BrandId">品牌唯一码</param> /// <param name="BrandName">品牌名称</param> /// <param name="DataFrom">来源1=brandDetail,2=prop</param> /// <param name="IsDelete">是否删除1=是,0=否</param> /// <returns></returns> public bool SetBrandAndPropSyn(string BrandId, string BrandName, int DataFrom, int IsDelete, out string strError) { bool bReturn = true; try { #region if (BrandId == null || BrandId.Trim().Equals("")) { strError = "品牌唯一码为空"; return(false); } if (BrandName == null || BrandName.Trim().Equals("")) { strError = "品牌名称为空"; return(false); } #endregion #region 修改属性 if (DataFrom == 1) { PropService propService = new PropService(this.CurrentUserInfo); PropInfo propInfo = new PropInfo(); propInfo = propService.GetPropInfoById(BrandId); if (propInfo == null || propInfo.Prop_Id == null || propInfo.Prop_Id.Equals("")) { propInfo.Prop_Id = BrandId; propInfo.Prop_Code = BrandName; propInfo.Prop_Name = BrandName; propInfo.Prop_Eng_Name = BrandName; propInfo.Prop_Type = "3"; propInfo.Parent_Prop_id = "F8823C2EBACF4965BA134D3B10BD0B9F"; propInfo.Prop_Level = 3; propInfo.Prop_Domain = "ITEM"; propInfo.Prop_Status = 1; propInfo.Display_Index = 10; propInfo.Create_Time = BaseService.NewGuidPub(); propInfo.Create_User_Id = this.CurrentUserInfo.CurrentUser.User_Id; propInfo.Modify_Time = BaseService.NewGuidPub(); propInfo.Modify_User_Id = this.CurrentUserInfo.CurrentUser.User_Id; strError = "新建属性品牌信息出错"; bReturn = propService.SaveProp(propInfo, ref strError); } else { propInfo.Prop_Code = BrandName; propInfo.Prop_Name = BrandName; propInfo.Prop_Eng_Name = BrandName; propInfo.Modify_Time = BaseService.NewGuidPub(); propInfo.Modify_User_Id = this.CurrentUserInfo.CurrentUser.User_Id; propInfo.Prop_Status = 1; bReturn = propService.UpdateProp(propInfo); } } #endregion #region 修改品牌 if (DataFrom == 2) { BrandDetailEntity brandInfo = new BrandDetailEntity(); brandInfo = GetByID(BrandId); if (brandInfo == null || brandInfo.BrandId == null || brandInfo.BrandId.Trim().Equals("")) { BrandDetailEntity brandInfo1 = new BrandDetailEntity(); brandInfo1.BrandId = BrandId; brandInfo1.BrandCode = BrandName; brandInfo1.BrandName = BrandName; brandInfo1.BrandEngName = BrandName; brandInfo1.CustomerId = this.CurrentUserInfo.CurrentUser.customer_id; Create(brandInfo1); } else { brandInfo.BrandCode = BrandName; brandInfo.BrandName = BrandName; brandInfo.BrandEngName = BrandName; brandInfo.CustomerId = this.CurrentUserInfo.CurrentUser.customer_id; Update(brandInfo, false); } } #endregion strError = "成功"; return(bReturn); } catch (Exception ex) { strError = ex.ToString(); return(false); } }
/// <summary> /// 列表数量获取 /// </summary> public int GetWebBrandDetailCount(BrandDetailEntity entity) { return(_currentDAO.GetWebBrandDetailCount(entity)); }
/// <summary> /// 保存 /// </summary> public string SaveBrandDetailData() { var service = new BrandDetailBLL(CurrentUserInfo); var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); var propService = new PropService(CurrentUserInfo); BrandDetailEntity obj = new BrandDetailEntity(); string content = string.Empty; string error = ""; var responseData = new ResponseData(); string key = string.Empty; string item_id = string.Empty; if (Request("item") != null && Request("item") != string.Empty) { key = Request("item").ToString().Trim(); } if (Request("item_id") != null && Request("item_id") != string.Empty) { item_id = Request("item_id").ToString().Trim(); } obj = key.DeserializeJSONTo <BrandDetailEntity>(); if (obj.BrandName == null || obj.BrandName.Trim().Length == 0) { responseData.success = false; responseData.msg = "名称不能为空"; return(responseData.ToJSON()); } if (obj.BrandCode == null || obj.BrandCode.Trim().Length == 0) { responseData.success = false; responseData.msg = "代码不能为空"; return(responseData.ToJSON()); } if (item_id.Trim().Length == 0) { obj.BrandId = Utils.NewGuid(); obj.CustomerId = this.CurrentUserInfo.CurrentUser.customer_id; service.Create(obj); var tmpImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() { ObjectId = obj.BrandId }, null); if (tmpImageList != null && tmpImageList.Length > 0) { foreach (var tmpImageItem in tmpImageList) { objectImagesBLL.Delete(tmpImageItem); } } if (obj.ItemImageList != null) { foreach (var tmpImageItem in obj.ItemImageList) { tmpImageItem.ObjectId = obj.BrandId; tmpImageItem.CustomerId = this.CurrentUserInfo.CurrentUser.customer_id; objectImagesBLL.Create(tmpImageItem); } } service.SetBrandAndPropSyn(obj.BrandId, obj.BrandName, 1, 0, out error); } else { obj.BrandId = item_id; obj.CustomerId = CurrentUserInfo.CurrentUser.customer_id; service.Update(obj, false); var tmpImageList = objectImagesBLL.QueryByEntity( new ObjectImagesEntity() { ObjectId = obj.BrandId }, null); if (tmpImageList != null && tmpImageList.Length > 0) { foreach (var tmpImageItem in tmpImageList) { objectImagesBLL.Delete(tmpImageItem); } } if (obj.ItemImageList != null) { foreach (var tmpImageItem in obj.ItemImageList) { tmpImageItem.ObjectId = obj.BrandId; tmpImageItem.CustomerId = this.CurrentUserInfo.CurrentUser.customer_id; objectImagesBLL.Create(tmpImageItem); } } service.SetBrandAndPropSyn(obj.BrandId, obj.BrandName, 1, 0, out error); } responseData.success = true; responseData.msg = error; content = responseData.ToJSON(); return(content); }