Example #1
0
        public bool Delete(HallPo obj)
        {
            string          text       = " DELETE FROM " + this.TABLE_NAME + this.SQL_WHERE_KEYS;
            MySqlConnection connection = DBOHelper.GetConnection();

            DBOHelper.OpenConnection(connection);
            MySqlCommand mySqlCommand = new MySqlCommand(text, connection);

            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);
            }
            finally
            {
                DBOHelper.CloseConnection(connection);
            }
            return(result);
        }
Example #2
0
        public bool Insert(MySqlConnection conn, MySqlTransaction trans, HallPo obj)
        {
            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, 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);
        }
Example #3
0
        public bool Update(MySqlConnection conn, MySqlTransaction trans, HallPo 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);
        }
Example #4
0
        public static bool UpdateSeat(string szHallId)
        {
            int    nCount = SeatAction.GetSeatsByHallId(szHallId);
            HallPo po     = new HallPo();

            po.HALLID = szHallId;
            po.SEATS  = nCount;
            HallDbo dbo = new HallDbo();

            return(dbo.UpdateSeat(po));
        }
Example #5
0
 private void SetAttParams(MySqlCommand cmd, HallPo obj)
 {
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.THEATERID, 253).Value   = obj.THEATERID;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.HALLNAME, 253).Value    = obj.HALLNAME;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.SEATS, 503).Value       = obj.SEATS;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.LEVELS, 502).Value      = obj.LEVELS;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.SCREEN, 253).Value      = obj.SCREEN;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.PROJECTOR, 253).Value   = obj.PROJECTOR;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.PLAYMODE, 253).Value    = obj.PLAYMODE;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.SOUNDSYSTEM, 253).Value = obj.SOUNDSYSTEM;
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.DESCRIPTION, 253).Value = obj.DESCRIPTION;
 }
Example #6
0
        public bool Insert(HallPo 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);
        }
Example #7
0
        public bool Delete(MySqlConnection conn, MySqlTransaction trans, HallPo 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);
        }
Example #8
0
        public bool UpdateSeat(HallPo obj)
        {
            MySqlConnection connection = DBOHelper.GetConnection();

            DBOHelper.OpenConnection(connection);
            string text = string.Concat(new string[]
            {
                "UPDATE ",
                this.TABLE_NAME,
                " SET ",
                this.SQL_UPDATE_FIELD_SEATS,
                this.SQL_WHERE_KEYS
            });
            MySqlCommand mySqlCommand = new MySqlCommand(text, connection);

            this.SetKeyParams(mySqlCommand, obj);
            this.SetAttParams_Seats(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);
        }
Example #9
0
 private void SetAttParams_Seats(MySqlCommand cmd, HallPo obj)
 {
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.SEATS, 503).Value = obj.SEATS;
 }
Example #10
0
 private void SetKeyParams(MySqlCommand cmd, HallPo obj)
 {
     cmd.Parameters.AddWithValue(HallDbo.CmdParam.HALLID, 253).Value = obj.HALLID;
 }