Exemplo n.º 1
0
        public bool Insert(MySqlConnection conn, MySqlTransaction trans, SeatingchartPo 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);
        }
Exemplo n.º 2
0
        public bool Delete(SeatingchartPo 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);
        }
Exemplo n.º 3
0
        public bool Update(MySqlConnection conn, MySqlTransaction trans, SeatingchartPo 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);
        }
Exemplo n.º 4
0
        public static bool Update(SeatMaDll.SeatingChart sc)
        {
            SeatingchartDbo dbo  = new SeatingchartDbo();
            SeatingchartPo  scPo = new SeatingchartPo();

            scPo.SEATINGCHARTID   = sc.SeatingChartId;
            scPo.SEATINGCHARTNAME = sc.SeatingChartName;
            scPo.LEVEL            = sc.Level;
            scPo.SEATS            = sc.Seats;
            scPo.COLUMNS          = sc.Columns;
            scPo.ROWSPACE         = sc.RowSpace;
            scPo.COLUMNSPACE      = sc.ColumnSpace;
            scPo.ROTATION         = sc.Rotation;
            scPo.HALLID           = sc.HallId;
            scPo.THEATERID        = sc.TheaterId;

            BlockPo blPo = new BlockPo();

            blPo.BLOCKID        = scPo.SEATINGCHARTID + "0";
            blPo.BLOCKNAME      = "默认";
            blPo.SEATINGCHARTID = scPo.SEATINGCHARTID;

            DataTable dt      = dbo.RetrieveALLItemsBySeatingchartId(sc.SeatingChartId);
            bool      bReturn = false;

            if (dt == null || dt.Rows.Count <= 0)
            {
                bReturn = dbo.InsertWithBlock(scPo, blPo);
            }
            dt.Dispose();
            return(bReturn);
        }
Exemplo n.º 5
0
 private void SetAttParams(MySqlCommand cmd, SeatingchartPo obj)
 {
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.SEATINGCHARTNAME, 253).Value = obj.SEATINGCHARTNAME;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.LEVEL, 3).Value         = obj.LEVEL;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.SEATS, 503).Value       = obj.SEATS;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.ROWS, 503).Value        = obj.ROWS;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.COLUMNS, 503).Value     = obj.COLUMNS;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.ROWSPACE, 503).Value    = obj.ROWSPACE;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.COLUMNSPACE, 503).Value = obj.COLUMNSPACE;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.SHAPE, 253).Value       = (string.IsNullOrEmpty(obj.SHAPE) ? null : obj.SHAPE);
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.BGCOLOUR, 253).Value    = (string.IsNullOrEmpty(obj.BGCOLOUR) ? null : obj.BGCOLOUR);
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.HALLID, 253).Value      = obj.HALLID;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.ROTATION, 503).Value    = obj.ROTATION;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.CREATED, 12).Value      = obj.CREATED;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.UPDATED, 12).Value      = obj.UPDATED;
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.ACTIVEFLAG, 3).Value    = obj.ACTIVEFLAG;
 }
Exemplo n.º 6
0
        public bool InsertWithBlock(SeatingchartPo scPo, BlockPo blPo)
        {
            MySqlConnection connection = DBOHelper.GetConnection();

            DBOHelper.OpenConnection(connection);
            MySqlTransaction mySqlTransaction = connection.BeginTransaction();
            bool             result;

            try
            {
                bool flag = this.Insert(connection, mySqlTransaction, scPo);
                if (flag)
                {
                    flag = new BlockDbo().Insert(connection, mySqlTransaction, blPo);
                }
                if (flag)
                {
                    DBOHelper.CommitTransaction(mySqlTransaction);
                }
                else
                {
                    DBOHelper.RollBackTransction(mySqlTransaction);
                }
                result = flag;
            }
            catch (MySqlException ex)
            {
                DBOHelper.RollBackTransction(mySqlTransaction);
                throw ex;
            }
            catch (Exception ex2)
            {
                DBOHelper.RollBackTransction(mySqlTransaction);
                throw ex2;
            }
            finally
            {
                DBOHelper.CloseConnection(connection);
            }
            return(result);
        }
Exemplo n.º 7
0
        public bool Insert(SeatingchartPo 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);
        }
Exemplo n.º 8
0
        public bool Delete(MySqlConnection conn, MySqlTransaction trans, SeatingchartPo 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);
        }
Exemplo n.º 9
0
        public static bool ResetData(SeatMaDll.SeatingChart sc)
        {
            SeatingchartDbo dbo  = new SeatingchartDbo();
            SeatingchartPo  scPo = new SeatingchartPo();

            scPo.SEATINGCHARTID   = sc.SeatingChartId;
            scPo.SEATINGCHARTNAME = sc.SeatingChartName;
            scPo.LEVEL            = sc.Level;
            scPo.SEATS            = sc.Seats;
            scPo.ROWS             = sc.Rows;
            scPo.COLUMNS          = sc.Columns;
            scPo.ROWSPACE         = sc.RowSpace;
            scPo.COLUMNSPACE      = sc.ColumnSpace;
            scPo.ROTATION         = sc.Rotation;
            scPo.HALLID           = sc.HallId;
            scPo.THEATERID        = sc.TheaterId;
            scPo.BGCOLOUR         = sc.BgColour;
            scPo.SHAPE            = sc.Shape;
            bool bReturn = dbo.Update(scPo);

            return(bReturn);
        }
Exemplo n.º 10
0
        public bool Update(SeatingchartPo 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);
        }
Exemplo n.º 11
0
 private void SetKeyParams(MySqlCommand cmd, SeatingchartPo obj)
 {
     cmd.Parameters.AddWithValue(SeatingchartDbo.CmdParam.SEATINGCHARTID, 253).Value = obj.SEATINGCHARTID;
 }