public bool Update(MySqlConnection conn, MySqlTransaction trans, SeatstatusPo obj) { string text = string.Concat(new string[] { "UPDATE ", this.TABLE_NAME, " SET ", this.SQL_UPDATE_FIELD, this.SQL_WHERE_KEYS }); MySqlCommand mySqlCommand = new MySqlCommand(text, conn, trans); this.SetKeyParams(mySqlCommand, obj); this.SetAttParams(mySqlCommand, obj); bool result; try { result = (mySqlCommand.ExecuteNonQuery() > 0); } catch (MySqlException ex) { throw new Exception(ex.Message); } catch (Exception ex2) { throw new Exception(ex2.Message); } return(result); }
private void SetAttParams(MySqlCommand cmd, SeatstatusPo obj) { cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.SEATID, 253).Value = obj.SEATID; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.SHOWPLANID, 15).Value = obj.SHOWPLANID; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.TICKETINGSTATE, 3).Value = obj.TICKETINGSTATE; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.LOCKEDBY, 3).Value = obj.LOCKEDBY; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.SOLDBY, 3).Value = obj.SOLDBY; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.CREATED, 12).Value = obj.CREATED; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.UPDATED, 12).Value = obj.UPDATED; cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.ACTIVEFLAG, 3).Value = obj.ACTIVEFLAG; }
public bool Insert(SeatstatusPo obj) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); string text = string.Concat(new string[] { "INSERT INTO ", this.TABLE_NAME, " (", this.SQL_INSERT_COLUMNS, ") VALUES (", this.SQL_INSERT_VALUES, ")" }); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); this.SetKeyParams(mySqlCommand, obj); this.SetAttParams(mySqlCommand, obj); bool result; try { result = (mySqlCommand.ExecuteNonQuery() > 0); } catch (MySqlException ex) { throw new Exception(ex.Message); } catch (Exception ex2) { throw new Exception(ex2.Message); } finally { DBOHelper.CloseConnection(connection); } return(result); }
public bool Delete(MySqlConnection conn, MySqlTransaction trans, SeatstatusPo obj) { string text = " DELETE FROM " + this.TABLE_NAME + this.SQL_WHERE_KEYS; MySqlCommand mySqlCommand = new MySqlCommand(text, conn, trans); this.SetKeyParams(mySqlCommand, obj); bool result; try { result = (mySqlCommand.ExecuteNonQuery() > 0); } catch (MySqlException ex) { throw new Exception(ex.Message); } catch (Exception ex2) { throw new Exception(ex2.Message); } return(result); }
public bool Update(SeatstatusPo obj) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); string text = string.Concat(new string[] { "UPDATE ", this.TABLE_NAME, " SET ", this.SQL_UPDATE_FIELD, this.SQL_WHERE_KEYS }); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); this.SetKeyParams(mySqlCommand, obj); this.SetAttParams(mySqlCommand, obj); bool result; try { result = (mySqlCommand.ExecuteNonQuery() > 0); } catch (MySqlException ex) { throw new Exception(ex.Message); } catch (Exception ex2) { throw new Exception(ex2.Message); } finally { DBOHelper.CloseConnection(connection); } return(result); }
private void SetKeyParams(MySqlCommand cmd, SeatstatusPo obj) { cmd.Parameters.AddWithValue(SeatstatusDbo.CmdParam.SEATSTATUSID, 253).Value = obj.SEATSTATUSID; }