/// <summary> /// 注册仓库 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int Add(StorageEntity entity) { //如果是默认仓库 if (entity.IsDefault == (int)EBool.Yes) { StorageEntity temp = new StorageEntity(); temp.Where(a => a.IsDefault == (int)EBool.Yes); if (this.Storage.GetCount(temp) > 0) { temp = new StorageEntity(); temp.IsDefault = (int)EBool.No; temp.IncludeIsDefault(true); temp.Where(a => a.IsDefault == (int)EBool.Yes); this.Storage.Update(temp); } } entity.IncludeAll(); int line = this.Storage.Add(entity); if (line > 0) { Clear(); } return line; }
/// <summary> /// 设置仓库的禁用和启用状态 /// </summary> /// <param name="storageNum"></param> /// <param name="isForbid"></param> /// <returns></returns> public int SetForbid(string storageNum, EBool isForbid) { StorageEntity entity = new StorageEntity(); entity.IsDefault = (int)isForbid; entity.IncludeIsDefault(true); entity.Where(a => a.StorageNum == storageNum); int line = this.Storage.Update(entity); return line; }
/// <summary> /// 设置某个仓库为默认仓库值 /// </summary> /// <param name="sotrageNum"></param> /// <returns></returns> public int SetDefault(string sotrageNum) { StorageEntity entity = new StorageEntity(); entity.IsDefault = (int)EBool.No; entity.IncludeIsDefault(true); int line = this.Storage.Update(entity); entity = new StorageEntity(); entity.IsDefault = (int)EBool.Yes; entity.IncludeIsDefault(true); entity.Where(a => a.StorageNum == sotrageNum); line += this.Storage.Update(entity); if (line > 0) { Clear(); } return line; }