protected int UpdateAssets(AssetsDepreciation assetsDepreciation, UserInfo sysUser, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("assetsId", assetsDepreciation.AssetsId); string sql = @"select * from Assets where assetsId=@assetsId "; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras, dbUpdate.cmd).Tables[0]; dt.TableName = "Assets"; dt.Rows[0]["assetsNetValue"] = DataConvert.ToDouble(dt.Rows[0]["assetsNetValue"]) - DataConvert.ToDouble(assetsDepreciation.DepreciationMonth); dt.Rows[0]["remainMonth"] = DataConvert.ToInt32(dt.Rows[0]["remainMonth"]) - 1; Update5Field(dt, sysUser.UserId, viewTitle); return(dbUpdate.Update(dt)); }
protected int AddDetail(Dictionary <string, object> objs, AssetsDepreciation assetsDepreciation, UserInfo sysUser, string viewTitle) { string sql = @"select * from AssetsDepreciation where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AssetsDepreciation"; DataRow dr = dt.NewRow(); dr["assetsId"] = assetsDepreciation.AssetsId; dr["fiscalYearId"] = DataConvert.ToString(objs["fiscalYearId"]); dr["fiscalPeriodId"] = DataConvert.ToString(objs["fiscalPeriodId"]); dr["depreciationMonth"] = assetsDepreciation.DepreciationMonth; Create5Field(dr, sysUser.UserId, viewTitle); dt.Rows.Add(dr); dbUpdate.Update(dt); UpdateAssets(assetsDepreciation, sysUser, viewTitle); return(1); }