public static int Add(XBase.Model.Office.SellReport.UserProductInfo model) { int num = 0; string sqlstr = "insert into officedba.UserProductInfo(CompanyCD,productNum,productName,price,bref,memo) values(@CompanyCD,@productNum,@productName,@price,@bref,@memo)"; TransactionManager tran = new TransactionManager(); tran.BeginTransaction(); SqlParameter[] param = { new SqlParameter("@CompanyCD", SqlDbType.VarChar, 50), new SqlParameter("@productNum", SqlDbType.VarChar, 50), new SqlParameter("@productName", SqlDbType.VarChar, 200), new SqlParameter("@price", SqlDbType.Decimal), new SqlParameter("@bref", SqlDbType.VarChar, 500), new SqlParameter("@memo", SqlDbType.VarChar, 1000) }; param[0].Value = model.CompanyCD; param[1].Value = model.productNum; param[2].Value = model.productName; param[3].Value = model.price; param[4].Value = model.bref; param[5].Value = model.memo; try { num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr, param); tran.Commit(); } catch { tran.Rollback(); } return(num); }
public static int Update(XBase.Model.Office.SellReport.UserProductInfo model) { int num = 0; string sqlstr = "update officedba.UserProductInfo set productNum=@productNum,productName=@productName,price=@price,bref=@bref,memo=@memo where id=@id"; TransactionManager tran = new TransactionManager(); tran.BeginTransaction(); SqlParameter[] param = { new SqlParameter("@CompanyCD", SqlDbType.VarChar, 50), new SqlParameter("@productNum", SqlDbType.VarChar, 50), new SqlParameter("@productName", SqlDbType.VarChar, 200), new SqlParameter("@price", SqlDbType.Decimal), new SqlParameter("@bref", SqlDbType.VarChar, 500), new SqlParameter("@memo", SqlDbType.VarChar, 1000), new SqlParameter("@id", SqlDbType.Int, 4) }; param[0].Value = model.CompanyCD; param[1].Value = model.productNum; param[2].Value = model.productName; param[3].Value = model.price; param[4].Value = model.bref; param[5].Value = model.memo; param[6].Value = model.id; try { num = SqlHelper.ExecuteNonQuery(tran.Trans, CommandType.Text, sqlstr, param); tran.Commit(); } catch { tran.Rollback(); } return(num); }
public static int Update(XBase.Model.Office.SellReport.UserProductInfo model) { return(UserProjectInfoDBHelper.Update(model)); }