internal void Delete(T_Item_CategoryEntity dbEntity) { using (var conn = new SqlConnection(ConnectionString.XgxInsert)) { conn.Open(); conn.Delete(dbEntity); } }
internal void Update(T_Item_CategoryEntity dbEntity) { using (var conn = new SqlConnection(ConnectionString.XgxInsert)) { dbEntity.modify_time = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"); conn.Open(); conn.Update(dbEntity); } }
/// <summary> /// 添加/获取/修改 商品类别信息 {仅供 订单 商品 调用} /// </summary> /// <param name="ItemCategoryName">类别名称</param> /// <param name="ItemCategoryCode">类别编号</param> /// <param name="CustomerID">商户编号</param> /// <param name="ParentItemCategoryCode">父节点编号</param> /// <param name="Status">状态</param> public string CreateOrUpdateItemCategory(string ItemCategoryName, string ItemCategoryCode, string CustomerID, string ParentItemCategoryCode, string Status) { //请求参数 T_Item_CategoryEntity itemcategory = new T_Item_CategoryEntity(); itemcategory.item_category_name = ItemCategoryName; itemcategory.item_category_code = ItemCategoryCode; //非请求参数 itemcategory.CustomerID = CustomerID; itemcategory.item_category_id = Guid.NewGuid().ToString(); itemcategory.status = "1"; //通过商品类别编号和商户号 获取商品类别信息 var ItemInfoCategory = GetItemCategoryByCode(ItemCategoryCode, CustomerID); //通过父节点编号获取 商品类别信息 var ParentItemInfoCategory = GetItemCategoryByCode(ParentItemCategoryCode, CustomerID); //如果父节点为空 或者 前端没有传递父节点 那我们就默认父节点信息 if (ParentItemInfoCategory == null || (ParentItemCategoryCode + "").Trim() == "0000" || String.IsNullOrWhiteSpace(ParentItemCategoryCode)) { var entity = GetItemCategoryByCode("全部", "-99", CustomerID); if (entity != null) { itemcategory.parent_id = entity.item_category_id; } else { throw new Exception("该类别父节点不存在,请联系管理员"); } } else { itemcategory.parent_id = ParentItemInfoCategory.item_category_id; } if (ItemInfoCategory == null) { Create(itemcategory); return(itemcategory.item_category_id); } else { //非请求参数 ItemInfoCategory.status = Status; ItemInfoCategory.item_category_name = ItemCategoryName; ItemInfoCategory.CustomerID = CustomerID; //请求参数 ItemInfoCategory.item_category_id = ItemInfoCategory.item_category_id; ItemInfoCategory.item_category_code = ItemInfoCategory.item_category_code; ItemInfoCategory.parent_id = itemcategory.parent_id; Update(ItemInfoCategory); return(ItemInfoCategory.item_category_id); } }
private T_Item_CategoryEntity Convert(ItemCategoryContract contract) { var dbEntity = new T_Item_CategoryEntity { item_category_id = contract.ItemCategoryId, item_category_code = contract.ItemCategoryCode, item_category_name = contract.ItemCategoryName, status = contract.Status, parent_id = string.IsNullOrEmpty(contract.ParentId) ? ConfigMgr.HeadItemCategoryId : contract.ParentId, create_time = contract.CreateTime != null?contract.CreateTime.Value.ToString("yyyy-MM-dd hh:mm:ss") : null, modify_time = contract.ModifyTime != null?contract.ModifyTime.Value.ToString("yyyy-MM-dd hh:mm:ss") : null, DisplayIndex = contract.DisplayIndex, CustomerID = ConfigMgr.CustomerId }; return(dbEntity); }
public void Delete(T_Item_CategoryEntity dbEntity) { _cmd.Delete(dbEntity); }
public void Update(T_Item_CategoryEntity dbEntity) { _cmd.Update(dbEntity); }
public void Create(T_Item_CategoryEntity dbEntity) { _cmd.Create(dbEntity); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(T_Item_CategoryEntity pEntity, IDbTransaction pTran) { _currentDAO.Update(pEntity, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(T_Item_CategoryEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <T_Item_CategoryEntity> PagedQueryByEntity(T_Item_CategoryEntity 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 T_Item_CategoryEntity[] QueryByEntity(T_Item_CategoryEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(T_Item_CategoryEntity pEntity) { _currentDAO.Delete(pEntity); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(T_Item_CategoryEntity pEntity) { _currentDAO.Update(pEntity); }