Esempio n. 1
0
 public int InsertWareHouse(WareHouseInfo wareHouse, SqlTransaction trans)
 {
     string sql = @"INSERT INTO [WareHouse]
                            ([Name]
                            ,[No]
                            ,[Address]
                            ,[Tel]
                            ,[detail]
                            ,[InsertDateTime]
                            ,[InsertUser])
                      VALUES
                            (@Name
                            ,@No
                            ,@Address
                            ,@Tel
                            ,@detail
                            ,@InsertDateTime
                            ,@InsertUser)";
     SqlParameter[] spvalues = DBTool.GetSqlPm(wareHouse);
     return SqlHelper.ExecuteNonQuery(trans, System.Data.CommandType.Text, sql, spvalues);
 }
Esempio n. 2
0
 public int InsertWareHouse(WareHouseInfo wareHouse)
 {
     SqlConnection conn;
     int count = 0;
     using (conn = SqlHelper.CreateConntion())
     {
         conn.Open();
         SqlTransaction trans = conn.BeginTransaction();
         try
         {
             count = DAL.InsertWareHouse(wareHouse, trans);
             trans.Commit();
         }
         catch (Exception)
         {
             trans.Rollback();
         }
         conn.Close();
     }
     return count;
 }
Esempio n. 3
0
 public int UpdateWareHouse(WareHouseInfo wareHouse, SqlTransaction trans)
 {
     string sql = @"UPDATE [WareHouse]
                        SET [id] = @id
                           ,[Name] = @Name
                           ,[No] = @No
                           ,[Address] = @Address
                           ,[Tel] = @Tel
                           ,[detail] = @detail
                           ,[InsertDateTime] = @InsertDateTime
                           ,[InsertUser] = @InsertUser
                      WHERE id=@id";
     SqlParameter[] spvalues = DBTool.GetSqlPm(wareHouse);
     return SqlHelper.ExecuteNonQuery(trans, System.Data.CommandType.Text, sql, spvalues);
 }