/// <summary> /// 增加物品领用/发放/借阅 /// </summary> /// <param name="model">物品领用/发放/借阅model</param> /// <returns>正值1:成功; 负值或0:失败;2:超过库存</returns> public int AddGovGoodUse(Model.GovStructure.MGovGoodUse model) { DbCommand dc = this._db.GetStoredProcCommand("proc_GovGoodUse_Add"); this._db.AddInParameter(dc, "UseId", DbType.AnsiStringFixedLength, model.UseId); this._db.AddInParameter(dc, "GoodId", DbType.AnsiStringFixedLength, model.GoodId); this._db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.CompanyId); this._db.AddInParameter(dc, "Type", DbType.Byte, (int)model.Type); this._db.AddInParameter(dc, "Time", DbType.DateTime, model.Time); this._db.AddInParameter(dc, "DeptId", DbType.Int32, model.DeptId); this._db.AddInParameter(dc, "Number", DbType.Int32, model.Number); this._db.AddInParameter(dc, "UserId", DbType.AnsiStringFixedLength, model.UserId); this._db.AddInParameter(dc, "Price", DbType.Decimal, model.Price); this._db.AddInParameter(dc, "Use", DbType.String, model.Use); this._db.AddInParameter(dc, "OperatorId", DbType.AnsiStringFixedLength, model.OperatorId); this._db.AddInParameter(dc, "IssueTime", DbType.DateTime, model.IssueTime); this._db.AddInParameter(dc, "PlanId", DbType.AnsiStringFixedLength, model.PlanId); this._db.AddOutParameter(dc, "Result", DbType.Int32, 4); EyouSoft.Toolkit.DAL.DbHelper.RunProcedure(dc, this._db); object Result = this._db.GetParameterValue(dc, "Result"); if (!Result.Equals(null)) { return(int.Parse(Result.ToString())); } return(0); }
/// <summary> /// 增加物品领用/发放/借阅 /// </summary> /// <param name="model">物品领用/发放/借阅model</param> /// <returns>正值1:成功; 负值或0:失败;2:超过库存</returns> public int AddGovGoodUse(Model.GovStructure.MGovGoodUse model) { if (model != null && !string.IsNullOrEmpty(model.GoodId) && !string.IsNullOrEmpty(model.CompanyId) && !string.IsNullOrEmpty(model.UserId) && model.DeptId > 0 && model.Number > 0 && !string.IsNullOrEmpty(model.OperatorId) && model.Time != null) { model.UseId = Guid.NewGuid().ToString(); int result = dal.AddGovGoodUse(model); if (result == 1) { SysStructure.BSysLogHandle.Insert("增加物品领用/发放/借阅:编号为:" + model.UseId); } return(result); } return(0); }