/// <summary> /// 修改 /// </summary> /// <param name="budgetPrice">BudgetPrice实体</param> /// <returns></returns> public static int UpdateBudgetPriceInfo(BudgetPrice budgetPrice) { return ProjectBudgetDBHelper.UpdateBudgetPriceInfo(budgetPrice); }
/// <summary> /// 修改 /// </summary> /// <param name="budgetPrice">BudgetPrice实体</param> /// <returns></returns> public static int UpdateBudgetPriceInfo(BudgetPrice budgetPrice) { StringBuilder sqlstr = new StringBuilder(); sqlstr.Append("update officedba.budgetPrice set "); sqlstr.Append("BudgetPriceName=@BudgetPriceName,UnitPrice=@UnitPrice,Formula=@Formula,"); sqlstr.Append(" projectID=@projectID,codeType=@codeType "); sqlstr.Append(" where CompanyCD=@CompanyCD and budgetpriceID=@budgetpriceID "); SqlParameter[] param = { new SqlParameter("@CompanyCD",SqlDbType.VarChar,50), new SqlParameter("@BudgetPriceName",SqlDbType.VarChar,500), new SqlParameter("@UnitPrice",SqlDbType.Decimal), new SqlParameter("@Formula",SqlDbType.VarChar,50), new SqlParameter("@projectID",SqlDbType.Int), new SqlParameter("@codeType",SqlDbType.Int), new SqlParameter("@budgetpriceID",SqlDbType.Int), }; param[0].Value = budgetPrice.CompanyCD; param[1].Value = budgetPrice.BudgetPriceName; param[2].Value = budgetPrice.UnitPrice; param[3].Value = budgetPrice.Formula; param[4].Value = budgetPrice.projectID; param[5].Value = budgetPrice.codeType; param[6].Value = budgetPrice.budgetpriceID; TransactionManager tran = new TransactionManager(); int num = 0; tran.BeginTransaction(); try { num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr.ToString(), param); tran.Commit(); } catch { tran.Rollback(); } return num; }
public static int AddBudgetPriceInfo(BudgetPrice budgetPrice, XBase.Common.UserInfoUtil userinfo) { return ProjectBudgetDBHelper.AddBudgetPriceInfo(budgetPrice, userinfo); }
public static int AddBudgetPriceInfo(BudgetPrice budgetPrice, XBase.Common.UserInfoUtil userinfo) { StringBuilder sqlstr = new StringBuilder(); sqlstr.Append("insert into officedba.budgetPrice(CompanyCD,BudgetPriceName,UnitPrice,Formula,projectID,codeType) values(@CompanyCD,@BudgetPriceName,@UnitPrice,@Formula,@projectID,@codeType)"); sqlstr.Append(" ;select @@IDENTITY "); SqlParameter[] param = { new SqlParameter("@CompanyCD",SqlDbType.VarChar,50), new SqlParameter("@BudgetPriceName",SqlDbType.VarChar,500), new SqlParameter("@UnitPrice",SqlDbType.Decimal), new SqlParameter("@Formula",SqlDbType.VarChar,50), new SqlParameter("@projectID",SqlDbType.Int), new SqlParameter("@codeType",SqlDbType.Int) }; param[0].Value = userinfo.CompanyCD; param[1].Value = budgetPrice.BudgetPriceName; param[2].Value = budgetPrice.UnitPrice; param[3].Value = budgetPrice.Formula; param[4].Value = budgetPrice.projectID; param[5].Value = budgetPrice.codeType; TransactionManager tran = new TransactionManager(); int num = 0; tran.BeginTransaction(); try { //num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr.ToString(), param); num = Convert.ToInt32(SqlHelper.ExecuteScalar(sqlstr.ToString(), param)); tran.Commit(); } catch { tran.Rollback(); } return num; }