Example #1
0
        public bool Insert(MySqlConnection conn, MySqlTransaction trans, ShowPlanPo 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 #2
0
        public bool Delete(ShowPlanPo 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 #3
0
        public bool Update(MySqlConnection conn, MySqlTransaction trans, ShowPlanPo 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 bool Delete(MySqlConnection conn, MySqlTransaction trans, ShowPlanPo 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 #5
0
        public bool Insert(ShowPlanPo 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 #6
0
 private void SetAttParams(MySqlCommand cmd, ShowPlanPo obj)
 {
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.SHOWPLANNAME, 253).Value      = obj.SHOWPLANNAME;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.FILMID, 253).Value            = obj.FILMID;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.FILM_FILMMODEID, 3).Value     = obj.FILM_FILMMODEID;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.POSITION, 3).Value            = obj.POSITION;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.STARTTIME, 12).Value          = obj.STARTTIME;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ENDTTIME, 12).Value           = obj.ENDTTIME;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.FILMLENGTH, 3).Value          = obj.FILMLENGTH;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.HALLID, 253).Value            = obj.HALLID;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.DAILYPLANID, 253).Value       = obj.DAILYPLANID;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.TIMESPAN, 3).Value            = obj.TIMESPAN;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.RATIO, 4).Value               = obj.RATIO;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.LOWESTPRICE, 4).Value         = obj.LOWESTPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.FARESETTINGID, 3).Value       = obj.FARESETTINGID;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.SINGLEPRICE, 4).Value         = obj.SINGLEPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.DOUBLEPRICE, 4).Value         = obj.DOUBLEPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.BOXPRICE, 4).Value            = obj.BOXPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.STUDENTPRICE, 4).Value        = obj.STUDENTPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.GROUPPRICE, 4).Value          = obj.GROUPPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.MEMBERPRICE, 4).Value         = obj.MEMBERPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.DISCOUNTPRICE, 4).Value       = obj.DISCOUNTPRICE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.SHOWSTATUS, 502).Value        = obj.SHOWSTATUS;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.SHOWTYPEID, 502).Value        = obj.SHOWTYPEID;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.SHOWGROUP, 502).Value         = obj.SHOWGROUP;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISDISCOUNTED, 502).Value      = obj.ISDISCOUNTED;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISCHECKINGNUMBER, 502).Value  = obj.ISCHECKINGNUMBER;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISTICKETCHECKING, 502).Value  = obj.ISTICKETCHECKING;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISONLINETICKETING, 502).Value = obj.ISONLINETICKETING;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISAPPROVED, 502).Value        = obj.ISAPPROVED;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISSALABLE, 502).Value         = obj.ISSALABLE;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ISLOCKED, 502).Value          = obj.ISLOCKED;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.STAGEHAND, 502).Value         = obj.STAGEHAND;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.PROJECTIONIST, 502).Value     = obj.PROJECTIONIST;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.CREATED, 12).Value            = obj.CREATED;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.UPDATED, 12).Value            = obj.UPDATED;
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.ACTIVEFLAG, 3).Value          = obj.ACTIVEFLAG;
 }
Example #7
0
        public bool Update(ShowPlanPo 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);
        }
Example #8
0
 private void SetKeyParams(MySqlCommand cmd, ShowPlanPo obj)
 {
     cmd.Parameters.AddWithValue(ShowPlanDbo.CmdParam.SHOWPLANID, 253).Value = obj.SHOWPLANID;
 }