public int BuildId() { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); int result; try { object idValue = this.GetIdValue(connection); int num; if (idValue == DBNull.Value || idValue == null) { num = 1; } else { num = Convert.ToInt32(idValue) + 1; } result = num; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public DataTable RetrieveALLItems(string szTheaterId) { string text = "SELECT * FROM Hall WHERE TheaterId = '{0}' "; text = string.Format(text, szTheaterId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("Hall"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public bool Update(TheaterInfoPo 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; }
public bool DeleteBySeatingChartId(string szSeatingChartId) { string text = " DELETE FROM Seat WHERE SeatingChartId = '{0}'"; text = string.Format(text, szSeatingChartId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); 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 DataTable RetrieveALLItems(string szSeatingChartId, string szBlockId) { string text = "SELECT * FROM Seat WHERE SeatingChartId = '{0}' AND BlockId = '{1}' order by ROWNumber,ColumnNumber,SeatGroup"; text = string.Format(text, szSeatingChartId, szBlockId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("Seat"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public DataTable RetrieveALLItems_Ext(string szShowPlanId) { string text = "SELECT sp.*,\r\nh.HallName,f.FilmCode,f.FilmName \r\nFROM ShowPlan sp\r\nINNER JOIN hall h ON h.HallId = sp.HallId\r\nINNER JOIN film f ON f.FilmId = sp.FilmId\r\nWHERE sp.ShowPlanId = '{0}'"; text = string.Format(text, szShowPlanId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("Block"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public DataTable RetrieveItemStatus_Init(string szShowPlanId, string szHallId, int nLevel) { string text = "select sp.showplanId,\r\ns.SeatId,s.RowNumber,s.ColumnNumber,s.SeatNumber,s.Xaxis,s.Yaxis,s.Height,s.Width,s.Property,s.SeatGroup,s.Capacity,s.SeatingChartId,s.BlockId,s.SeatType,s.SeatGroup,\r\nss.SeatStatusId,ss.TicketingState,ss.LockedBy,ss.SoldBy,ss.Created,ss.Updated,ss.ActiveFlag\r\nfrom showplan sp\r\nleft outer join seatingChart sc on sp.Hallid = sc.Hallid \r\nleft outer join seat s on s.seatingChartid = sc.seatingChartid\r\nleft outer join seatstatus ss on ss.seatid = s.seatid and ss.ShowPlanId = sp.showplanId\r\nwhere sp.showplanId = '{0}' and sc.Hallid = '{1}' and sc.Level = {2} order by s.ROWNumber,s.ColumnNumber,s.SeatGroup"; text = string.Format(text, szShowPlanId, szHallId, nLevel); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("seatstatus"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public DataTable RetrieveSeatingChartItems(string szTheaterId, string szHallId, int nLevel) { string text = "SELECT DISTINCT SeatingChartId,HallId,Level FROM SeatingChart WHERE ActiveFlag = 1 and HallId = '{0}' and Level = {1} "; text = string.Format(text, szHallId, nLevel); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("SeatingChart"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public DataTable GetSeatingChart(string szSeatingChartName) { string text = "SELECT * FROM Seatingchart WHERE ActiveFlag = 1 AND SeatingChartName = '{0}' "; text = string.Format(text, szSeatingChartName); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("Seatingchart"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public bool UpdateActiveFlag(string szSeatingchartId, int nActiveFlag) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); string text = "UPDATE Seatingchart SET ActiveFlag = @ActiveFlag WHERE SeatingchartId = '{0}'"; text = string.Format(text, szSeatingchartId); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); mySqlCommand.Parameters.AddWithValue("@ActiveFlag", 3).Value = nActiveFlag; 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 DataTable RetrieveItemStatus(string szShowPlanId, string szSeatingChartId) { string text = "select ss.*,\r\ns.RowNumber,s.ColumnNumber,s.SeatNumber,s.Xaxis,s.Yaxis,s.Height,s.Width,s.Property,s.SeatGroup,s.Capacity,s.SeatingChartId,s.BlockId,s.SeatType,s.SeatGroup\r\nfrom seatstatus ss\r\ninner join showplan sp on sp.showplanId = ss.showplanId\r\ninner join seatingChart sc on sc.Hallid = sp.Hallid \r\ninner join seat s on s.SeatId = ss.SeatId \r\nwhere sp.showplanId = '{0}' and s.seatingChartId = '{1}' \r\norder by s.ROWNumber,s.ColumnNumber,s.SeatGroup"; text = string.Format(text, szShowPlanId, szSeatingChartId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("seatstatus"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
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); }
public bool UpdateThumbnail(string szSeatingchartId, byte[] byteThumbnail) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); string text = "UPDATE Seatingchart SET Thumbnail = @Thumbnail WHERE SeatingchartId = '{0}'"; text = string.Format(text, szSeatingchartId); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); mySqlCommand.Parameters.AddWithValue("@Thumbnail", 251).Value = byteThumbnail; 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 DataTable RetrieveALLItems_Ext(string szSeatingChartId, string szShowPlanId) { string text = "SELECT b.* ,\r\nbp.BlockPriceId,bp.ShowPlanId,bp.SinglePrice,bp.DoublePrice,bp.BoxPrice,bp.StudentPrice,bp.GroupPrice,bp.MemberPrice,bp.DiscountPrice \r\nFROM Block b\r\nLEFT OUTER JOIN BlockPrice bp ON bp.BlockId = b.BlockId AND bp.ShowPlanId = '{0}'\r\n WHERE b.SeatingChartId = '{1}' "; text = string.Format(text, szShowPlanId, szSeatingChartId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("Block"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public DataTable RetrieveALLItems() { string text = "select * from Hall "; MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); DataTable result; try { MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter(mySqlCommand); DataTable dataTable = new DataTable("Hall"); mySqlDataAdapter.Fill(dataTable); int count = dataTable.Rows.Count; mySqlDataAdapter.Dispose(); result = dataTable; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
/// <summary> /// 启用1,禁用0,删除-1 /// </summary> public string ChangeState(int taskId, int state) { var task = GetTask(taskId); if (task.RunState == ERunState.Running) { return("任务运行中,不能修改状态"); } else if (state == 1) { task.RunState = ERunState.HangUp; if (task.Enabled == 1) { return(""); } task.Enabled = 1; DBOHelper.UpdateTaskState(task); } else if (state == 0) { if (task.Enabled == 0) { return(""); } task.Enabled = 0; task.RunState = ERunState.Stop; DBOHelper.UpdateTaskState(task); } else if (state == -1) { taskInfos.Remove(taskId); DBOHelper.DeleteTask(taskId); } return(""); }
public bool UpdateBlock(string szSeatId, string szBlockId) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); string text = "UPDATE Seat SET BlockId = '{0}' WHERE Seatid = '{1}'"; text = string.Format(text, szBlockId, szSeatId); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); 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 byte[] GetThumbnailValue(string szSeatingchartId) { string text = "SELECT Thumbnail FROM seatingchart where SeatingchartId = '{0}' "; text = string.Format(text, szSeatingchartId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(text, connection); byte[] result; try { byte[] array = (byte[])mySqlCommand.ExecuteScalar(); result = array; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
/// <summary> /// 保存新的任务 /// </summary> public bool AddNewTask(TaskInfo taskInfo) { bool b = DBOHelper.SaveNewTask(taskInfo); if (b) { taskInfos.Add(taskInfo.Id, taskInfo); } return(b); }
/// <summary> /// 保存新的任务 /// </summary> public int AddNewTask(TaskInfo taskInfo) { int taskId = DBOHelper.SaveNewTask(taskInfo); if (taskId > 0) { taskInfo.Id = taskId; taskInfos.Add(taskId, taskInfo); } return(taskId); }
/// <summary> /// 保存至数据库 /// </summary> protected virtual void SaveToDB() { var newContextList = DBOHelper.SaveData(ResultDataDic.Values.ToList()); if (newContextList.Count > 0) { ReportInfo($"新数据有【{ newContextList.Count }】条,钉钉通知已发送..."); //发送钉钉通知群里的小伙伴 string title = string.Format("来自【{0}】最新发布的{1}", Description, TaskInfo.Remark.Replace(",", ",").Split(',')[0]); DingTalk.Send_Morkdown(title, newContextList); } }
/// <summary> /// 更新任务 /// </summary> public int UpdateTask(TaskInfo taskInfo) { int res = DBOHelper.UpdateTask(taskInfo); if (res > 0) { if (!taskInfos.ContainsKey(taskInfo.Id)) { taskInfos.Add(taskInfo.Id, taskInfo); } else { taskInfos[taskInfo.Id] = taskInfo; } } return(res); }
public bool DeleteAll(BlockPo obj, string szBlockIdNew) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlTransaction mySqlTransaction = connection.BeginTransaction(); bool result; try { SeatDbo seatDbo = new SeatDbo(); BlockPriceDbo blockPriceDbo = new BlockPriceDbo(); bool flag = true; seatDbo.UpdateBlockWithNew(connection, mySqlTransaction, obj.BLOCKID, szBlockIdNew); blockPriceDbo.DeleteAllByBlockId(connection, mySqlTransaction, obj.BLOCKID); if (flag) { flag = this.Delete(connection, mySqlTransaction, obj); } if (flag) { mySqlTransaction.Commit(); } else { mySqlTransaction.Rollback(); } result = flag; } catch (MySqlException ex) { mySqlTransaction.Rollback(); throw ex; } catch (Exception ex2) { mySqlTransaction.Rollback(); throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public string BuildId(string szShowPlanId) { MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); string result; try { object idValue = this.GetIdValue(connection, szShowPlanId); string text = szShowPlanId + "1"; if (idValue == DBNull.Value || idValue == null) { result = text; } else { text = idValue.ToString(); text = text.Replace(szShowPlanId, ""); if (text.Trim().Length <= 0) { text = "1"; } else { text = (Convert.ToInt32(text.Trim()) + 1).ToString(); } text = szShowPlanId + text; result = text; } } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public bool CheckExistByNameWillUsed(string szSeatingChartName, DateTime dtStartTime) { string text = "SELECT count(*) FROM showplan sp\r\ninner join seatstatus ss on ss.ShowPlanId = sp.ShowPlanId\r\ninner join Seat st on st.SeatId = ss.SeatId\r\ninner join seatingchart sc on sc.SeatingChartId = st.SeatingChartId\r\nwhere sc.ActiveFlag = 1 and sc.SeatingChartName = '{0}' and sp.StartTime >= '{1}' "; text = string.Format(text, szSeatingChartName, dtStartTime); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(); mySqlCommand.CommandText = text; mySqlCommand.CommandTimeout = 300; mySqlCommand.Connection = connection; bool result; try { object obj = mySqlCommand.ExecuteScalar(); if (obj == DBNull.Value || obj == null) { result = false; } else { result = (Convert.ToInt32(obj) > 0); } } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public int GetHallLevel(string szTheaterId, string szHallId) { string text = "SELECT Levels FROM Hall WHERE TheaterId = '{0}' and HallId = '{1}'"; text = string.Format(text, szTheaterId, szHallId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(); mySqlCommand.CommandText = text; mySqlCommand.CommandTimeout = 3000; mySqlCommand.Connection = connection; int result; try { object obj = mySqlCommand.ExecuteScalar(); if (obj == DBNull.Value || obj == null) { result = 0; } else { result = Convert.ToInt32(obj); } } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public string GetDefaultBlock(string szSeatingChartId) { string text = "SELECT BlockId FROM Block WHERE SeatingChartId = '{0}' and BlockName = '默认'"; text = string.Format(text, szSeatingChartId); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(); mySqlCommand.CommandText = text; mySqlCommand.CommandTimeout = 3000; mySqlCommand.Connection = connection; string result; try { object obj = mySqlCommand.ExecuteScalar(); if (obj == DBNull.Value || obj == null) { result = ""; } else { result = obj.ToString(); } } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
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); }
public bool CheckExistByName(string szSeatingChartName) { string text = "SELECT SeatingChartId FROM seatingchart where ActiveFlag = 1 and SeatingChartName = '{0}'"; text = string.Format(text, szSeatingChartName); MySqlConnection connection = DBOHelper.GetConnection(); DBOHelper.OpenConnection(connection); MySqlCommand mySqlCommand = new MySqlCommand(); mySqlCommand.CommandText = text; mySqlCommand.CommandTimeout = 300; mySqlCommand.Connection = connection; bool result; try { object obj = mySqlCommand.ExecuteScalar(); if (obj == DBNull.Value || obj == null) { result = false; } else { result = true; } } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }
public int GetSeatsByHallId(string szHallId) { MySqlConnection connection = DBOHelper.GetConnection(); string text = "SELECT COUNT(*) FROM Seat s\r\ninner join SeatingChart sc on sc.SeatingChartId = s.SeatingChartId\r\nWHERE sc.HallId = '{0}' "; text = string.Format(text, szHallId); DBOHelper.OpenConnection(connection); int result; try { MySqlCommand mySqlCommand = new MySqlCommand(); mySqlCommand.CommandText = text; mySqlCommand.Connection = connection; object obj = mySqlCommand.ExecuteScalar(); int num; if (obj == DBNull.Value || obj == null) { num = 0; } else { num = Convert.ToInt32(obj); } result = num; } catch (MySqlException ex) { throw ex; } catch (Exception ex2) { throw ex2; } finally { DBOHelper.CloseConnection(connection); } return(result); }