/// <summary> /// 更新物品 /// </summary> /// <param name="model">物品model</param> /// <returns></returns> public bool UpdateGovGood(Model.GovStructure.MGovGood model) { if (model != null && !string.IsNullOrEmpty(model.GoodId) && !string.IsNullOrEmpty(model.CompanyId) && !string.IsNullOrEmpty(model.Name) && model.Number > 0 && !string.IsNullOrEmpty(model.OperatorId) && model.Time != null) { bool result = dal.UpdateGovGood(model); if (result) { SysStructure.BSysLogHandle.Insert("更新一条物品信息:编号为:" + model.GoodId); } return(result); } return(false); }
/// <summary> /// 增加物品 /// </summary> /// <param name="model">物品model</param> public bool AddGovGood(Model.GovStructure.MGovGood model) { if (model != null && !string.IsNullOrEmpty(model.CompanyId) && !string.IsNullOrEmpty(model.Name) && model.Number > 0 && !string.IsNullOrEmpty(model.OperatorId) && model.Time != null) { model.GoodId = Guid.NewGuid().ToString(); bool result = dal.AddGovGood(model); if (result) { SysStructure.BSysLogHandle.Insert("增加一条物品信息:编号为:" + model.GoodId); } return(result); } return(false); }
/// <summary> /// 更新物品 /// </summary> /// <param name="model">物品model</param> /// <returns></returns> public bool UpdateGovGood(Model.GovStructure.MGovGood model) { string StrSql = "UPDATE tbl_GovGood SET GoodName=@Name,Number=@Number,Price=@Price,Stock=@Stock,[GoodUse]=@Use,InTime=@Time,Remark=@Remark WHERE GoodId=@GoodId AND CompanyId=@CompanyId"; DbCommand dc = this._db.GetSqlStringCommand(StrSql); this._db.AddInParameter(dc, "GoodId", DbType.AnsiStringFixedLength, model.GoodId); this._db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.CompanyId); this._db.AddInParameter(dc, "Name", DbType.String, model.Name); this._db.AddInParameter(dc, "Number", DbType.Int32, model.Number); this._db.AddInParameter(dc, "Price", DbType.Decimal, model.Price); this._db.AddInParameter(dc, "Stock", DbType.Int32, model.Stock); this._db.AddInParameter(dc, "Use", DbType.String, model.Use); this._db.AddInParameter(dc, "Time", DbType.DateTime, model.Time); this._db.AddInParameter(dc, "Remark", DbType.String, model.Remark); //this._db.AddInParameter(dc, "OperatorId", DbType.AnsiStringFixedLength, model.OperatorId); //this._db.AddInParameter(dc, "IssueTime", DbType.DateTime, model.IssueTime); return(EyouSoft.Toolkit.DAL.DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false); }
/// <summary> /// 增加物品 /// </summary> /// <param name="model">物品model</param> public bool AddGovGood(Model.GovStructure.MGovGood model) { string StrSql = "INSERT INTO tbl_GovGood([GoodId],[CompanyId],[GoodName],[Number],[Price],[Stock],[GoodUse],[InTime],[Remark],[OperatorId],[IssueTime]) VALUES(@GoodId,@CompanyId,@Name,@Number,@Price,@Stock,@Use,@Time,@Remark,@OperatorId,@IssueTime)"; DbCommand dc = this._db.GetSqlStringCommand(StrSql); this._db.AddInParameter(dc, "GoodId", DbType.AnsiStringFixedLength, model.GoodId); this._db.AddInParameter(dc, "CompanyId", DbType.AnsiStringFixedLength, model.CompanyId); this._db.AddInParameter(dc, "Name", DbType.String, model.Name); this._db.AddInParameter(dc, "Number", DbType.Int32, model.Number); this._db.AddInParameter(dc, "Price", DbType.Decimal, model.Price); this._db.AddInParameter(dc, "Stock", DbType.Int32, model.Stock); this._db.AddInParameter(dc, "Use", DbType.String, model.Use); this._db.AddInParameter(dc, "Time", DbType.DateTime, model.Time); this._db.AddInParameter(dc, "Remark", DbType.String, model.Remark); this._db.AddInParameter(dc, "OperatorId", DbType.AnsiStringFixedLength, model.OperatorId); this._db.AddInParameter(dc, "IssueTime", DbType.DateTime, model.IssueTime); return(EyouSoft.Toolkit.DAL.DbHelper.ExecuteSql(dc, this._db) > 0 ? true : false); }