public static List <SeatMaDll.Seat> RetrieveStatusObjs(string szShowPlanId, string szHallId, int nLevel, int nUser) { List <SeatMaDll.Seat> listAll = new List <SeatMaDll.Seat>(); List <SeatMaDll.Seat> listNoBrother = new List <SeatMaDll.Seat>(); List <SeatMaDll.Seat> listHaveBrother = new List <SeatMaDll.Seat>(); List <SeatMaDll.SeatingChart> scList = SeatingChartAction.RetrieveObjList(szHallId, nLevel); if (scList == null || scList.Count <= 0) { return(listAll); } SeatstatusDbo dbo = new SeatstatusDbo(); //DataTable dt = dbo.RetrieveItemStatus_Init(szShowPlanId, szHallId, nLevel); DataTable dt = dbo.RetrieveItemStatus(szShowPlanId, scList[0].SeatingChartId); if (dt == null || dt.Rows.Count <= 0) { return(listAll); } foreach (DataRow dr in dt.Rows) { string szStatusFlag = "0"; SeatPo po = ChangeObj(dr, nUser, ref szStatusFlag); SeatMaDll.Seat st = SeatAction.ChangeObjFromData(po); //st._seatStatusFlag = dr["TicketingState"] == DBNull.Value ? "0" : dr["TicketingState"].ToString(); st._seatStatusFlag = szStatusFlag; if (st._seatSeatGroup.Trim().Length <= 0) { listAll.Add(st); } else { if (st._brotherList.Count <= 0) { listNoBrother.Add(st); } else { st._brotherList[0]._seatStatusFlag = szStatusFlag; listHaveBrother.Add(st); } } //if (!SeatAction.MergeObj(list, st)) list.Add(st); } SeatAction.MergeObjNew(listNoBrother, listHaveBrother); foreach (SeatMaDll.Seat st in listHaveBrother) { listAll.Add(st); } //if (listHaveBrother.Count > 0) // listAll.AddRange(listHaveBrother[0], listHaveBrother[listHaveBrother.Count-1]); //listAll = listAll.AddRange(listNoBrother); //.CopyTo(listNoBrother); return(listAll); }
void cbb_Level_SelectedIndexChanged(object sender, EventArgs e) { if (uC_HallInfoSeek1.cbb_Theater.SelectedItem == null) { return; } if (uC_HallInfoSeek1.cbb_Hall.SelectedItem == null) { return; } if (uC_HallInfoSeek1.cbb_Level.SelectedItem == null) { return; } SimTheaterInfo sti = (SimTheaterInfo)uC_HallInfoSeek1.cbb_Theater.SelectedItem; string szTheaterId = sti._TheaterId; SimHall sh = (SimHall)uC_HallInfoSeek1.cbb_Hall.SelectedItem; string szHallId = sh._HallId; SimHallLevel shl = (SimHallLevel)uC_HallInfoSeek1.cbb_Level.SelectedItem; string szLevel = shl._LevelId; _editSeatInfo = new SeatMaDll.EditSeatInfo(); _editSeatInfo._szTheaterName = sti._TheaterName; _editSeatInfo._szHallName = sh._HallName; _editSeatInfo._szLevelName = shl._LevelId; List <SeatMaDll.SeatingChart> scList = SeatingChartAction.RetrieveObjListWithBlock(sh._HallId, Convert.ToInt32(shl._LevelId)); uC_HallInfoSeek1.InitSeatingChart(scList); QueryData(); }
private SeatMaDll.SeatingChart BuildSeatingChart(string szSeatingChartName) { if (uC_HallInfoSeek1.cbb_Theater.SelectedItem == null) { MessageBox.Show("必须选择一个影院!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } if (uC_HallInfoSeek1.cbb_Hall.SelectedItem == null) { MessageBox.Show("必须选择一个影厅!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } if (uC_HallInfoSeek1.cbb_Level.SelectedItem == null) { MessageBox.Show("必须选择一个楼层!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } if (szSeatingChartName.Trim().Length <= 0) { MessageBox.Show("座位图名称不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } string szTheaterId = ((SimTheaterInfo)uC_HallInfoSeek1.cbb_Theater.SelectedItem)._TheaterId; string szHallId = ((SimHall)uC_HallInfoSeek1.cbb_Hall.SelectedItem)._HallId; try { int nLevel = Convert.ToInt32(uC_HallInfoSeek1.cbb_Level.Text.Trim()); //Convert.ToInt32(((SimHallLevel)cbb_Level.SelectedItem)._LevelId); string szSeatingchartId = SeatingChartAction.BuildSeatingchartId(szHallId, nLevel); SeatMaDll.SeatingChart stchTemp = new SeatMaDll.SeatingChart(); stchTemp.SeatingChartId = szSeatingchartId; stchTemp.SeatingChartName = szSeatingChartName; stchTemp.Level = nLevel; stchTemp.Seats = 0; stchTemp.Rows = 0; stchTemp.Columns = 0; stchTemp.RowSpace = 5; stchTemp.ColumnSpace = 4; stchTemp.HallId = szHallId; stchTemp.TheaterId = szTheaterId; if (SeatingChartAction.Update(stchTemp)) { return(stchTemp); } else { return(null); } } catch (Exception ex) { throw ex; } }
public void InitSeatingChart(string szHallId, int nLevel) { cbb_SeatingChart.ResetText(); List <SeatMaDll.SeatingChart> scList = SeatingChartAction.RetrieveObjList(szHallId, nLevel); cbb_SeatingChart.DataSource = scList; if (scList.Count > 0) { cbb_SeatingChart.SelectedItem = scList[0]; } else { cbb_SeatingChart.SelectedItem = null; } }
public static BlockRich RetrieveObj(string szHallId, int nLevel) { SeatMaDll.SeatingChart objSeatingChart = SeatingChartAction.RetrieveObj(szHallId, nLevel); if (objSeatingChart == null) { return(null); } BlockRich blcR = new BlockRich(); blcR._ObjSeatingChart = objSeatingChart; if (blcR._ObjSeatingChart != null) { blcR._ObjBlock = Block.RetrieveObj(blcR._ObjSeatingChart.SeatingChartId, "0"); } return(blcR); }
private void btnSeatInfoSubmit_Click(object sender, EventArgs e) { if (cbb_Theater.SelectedItem == null) { return; } if (cbb_Hall.SelectedItem == null) { return; } if (cbb_Level.Text.Trim().Length <= 0) { return; } string szTheaterId = ((SimTheaterInfo)cbb_Theater.SelectedItem)._TheaterId; string szHallId = ((SimHall)cbb_Hall.SelectedItem)._HallId; string szSeats = tb_Seats.Text.Trim(); if (szSeats.Length <= 0) { szSeats = "0"; } string szRows = tb_Rows.Text.Trim(); if (szRows.Length <= 0) { szRows = "0"; } string szColumns = tb_Columns.Text.Trim(); if (szColumns.Length <= 0) { szColumns = "0"; } try { int nLevel = Convert.ToInt32(cbb_Level.Text.Trim()); //Convert.ToInt32(((SimHallLevel)cbb_Level.SelectedItem)._LevelId); string szSeatingchartId = SeatingChartAction.BuildSeatingchartId(szHallId, nLevel); SeatMaDll.SeatingChart _seatingChart = new SeatMaDll.SeatingChart(); _seatingChart.SeatingChartId = szSeatingchartId; _seatingChart.SeatingChartName = tb_seatingchartName.Text; _seatingChart.Level = nLevel; _seatingChart.Seats = int.Parse(szSeats); _seatingChart.Rows = int.Parse(szRows); _seatingChart.Columns = int.Parse(szColumns); _seatingChart.RowSpace = 5; _seatingChart.ColumnSpace = 4; _seatingChart.HallId = szHallId; _seatingChart.TheaterId = szTheaterId; if (SeatingChartAction.Update(_seatingChart)) { this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("创建座位图成功!"); } } catch (Exception ex) { throw ex; } }
public static bool CommitData(SeatMaDll.SeatChartDisp seatChartDispTemp, ref SeatMaDll.SeatingChart seatingchartTemp, ref SeatMaDll.EditSeatInfo editSeatInfoTemp) { try { DataObject.DBO.SeatDbo dbo = new DataObject.DBO.SeatDbo(); //SeatAction.DeleteBySeatingChartId(seatingchartTemp.SeatingChartId); List <DataObject.PO.SeatPo> listSeat = new List <DataObject.PO.SeatPo>(); int nSeatCount = 0; foreach (Control c in seatChartDispTemp.Controls) { if (c.GetType() == typeof(SeatMaDll.BHSeatControl)) { string szSeatGuid = string.Format("{0:D4}", nSeatCount); SeatMaDll.Seat si = (SeatMaDll.Seat)c.Tag; if (si._brotherList.Count <= 0) { nSeatCount++; szSeatGuid = string.Format("{0:D4}", nSeatCount); si._seatSeatingChartId = seatingchartTemp.SeatingChartId; si._seatId = si._seatSeatingChartId + szSeatGuid; si._seatBlockId = si._seatSeatingChartId + "0"; } else { for (int i = 0; i < si._brotherList.Count; i++) { nSeatCount++; szSeatGuid = string.Format("{0:D4}", nSeatCount); si._brotherList[i]._seatSeatingChartId = seatingchartTemp.SeatingChartId; szSeatGuid = si._brotherList[i]._seatSeatingChartId + szSeatGuid; si._brotherList[i]._seatId = szSeatGuid; si._brotherList[i]._seatBlockId = si._brotherList[i]._seatSeatingChartId + "0"; } } if (listSeat != null) { listSeat.Clear(); } listSeat = SeatAction.SplitDBObj(si); foreach (DataObject.PO.SeatPo po in listSeat) { if (dbo.Insert(po)) { seatingchartTemp._listSiteItem.Add(si); } } } } seatingchartTemp.Seats = editSeatInfoTemp._ObjSeatingChart.Seats; seatingchartTemp.Rows = editSeatInfoTemp._ObjSeatingChart.Rows; seatingchartTemp.Columns = editSeatInfoTemp._ObjSeatingChart.Columns; seatingchartTemp.RowSpace = editSeatInfoTemp._ObjSeatingChart.RowSpace; seatingchartTemp.ColumnSpace = editSeatInfoTemp._ObjSeatingChart.ColumnSpace; seatingchartTemp.Rotation = editSeatInfoTemp._ObjSeatingChart.Rotation; bool bR = SeatingChartAction.ResetData(seatingchartTemp); bR = Hall.UpdateSeat(seatingchartTemp.HallId); return(bR); } catch (Exception ex) { throw ex; } }
public static List <SeatMaDll.Seat> RetrieveObjWithSeatingchartAndBlock(string szShowPlanId, string szHallId, int nLevel, int nUser, ref SeatMaDll.SeatingChart seatingchart) { List <SeatMaDll.Seat> listAll = new List <SeatMaDll.Seat>(); List <SeatMaDll.Seat> listNoBrother = new List <SeatMaDll.Seat>(); List <SeatMaDll.Seat> listHaveBrother = new List <SeatMaDll.Seat>(); List <SeatMaDll.SeatingChart> scList = SeatingChartAction.RetrieveObjList(szHallId, nLevel); if (scList == null || scList.Count <= 0) { return(listAll); } SeatstatusDbo dbo = new SeatstatusDbo(); //DataTable dt = dbo.RetrieveItemStatus_Init(szShowPlanId, szHallId, nLevel); DataTable dt = dbo.RetrieveItemStatus_InitWithBlock(szShowPlanId, scList[0].SeatingChartId); seatingchart = scList[0]; if (dt == null || dt.Rows.Count <= 0) { return(listAll); } foreach (DataRow dr in dt.Rows) { int nBgColour = dr["BgColour"] == DBNull.Value ? 0 : Convert.ToInt32(dr["BgColour"]); string szStatusFlag = "0"; SeatPo po = ChangeObj(dr, nUser, ref szStatusFlag); SeatMaDll.Seat st = SeatAction.ChangeObjFromData(po); st._BackColor = nBgColour; st._IsUsedBackColor = true; //st._seatStatusFlag = dr["TicketingState"] == DBNull.Value ? "0" : dr["TicketingState"].ToString(); st._seatStatusFlag = szStatusFlag; if (st._seatSeatGroup.Trim().Length <= 0) { listAll.Add(st); } else { if (st._brotherList.Count <= 0) { listNoBrother.Add(st); } else { st._brotherList[0]._BackColor = nBgColour; st._brotherList[0]._IsUsedBackColor = true; st._brotherList[0]._seatStatusFlag = szStatusFlag; listHaveBrother.Add(st); } } } SeatAction.MergeObjNew(listNoBrother, listHaveBrother); foreach (SeatMaDll.Seat st in listHaveBrother) { listAll.Add(st); } return(listAll); }
public static List <SeatMaDll.SeatingChart> RetrieveSeatingChartList(string szHallId, int nLevel) { List <SeatMaDll.SeatingChart> scList = SeatingChartAction.RetrieveObjList(szHallId, nLevel); return(scList); }
private void SaveData() { if (this.bgwSave.IsBusy) { throw new ApplicationException("系统正在执行数据提交操作,请稍后..."); } if (_editSeatInfo == null) { MessageBox.Show("必须选择一个座位图!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (_seatingChart == null) { MessageBox.Show("必须选择一个座位图!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (uC_HallInfoSeek1.cbb_Theater.SelectedItem == null) { MessageBox.Show("必须选择一个影院!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (uC_HallInfoSeek1.cbb_Hall.SelectedItem == null) { MessageBox.Show("必须选择一个影厅!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (uC_HallInfoSeek1.cbb_Level.SelectedItem == null) { MessageBox.Show("必须选择一个座位图!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SimTheaterInfo sti = (SimTheaterInfo)uC_HallInfoSeek1.cbb_Theater.SelectedItem; SimHall sh = (SimHall)uC_HallInfoSeek1.cbb_Hall.SelectedItem; SimHallLevel shl = (SimHallLevel)uC_HallInfoSeek1.cbb_Level.SelectedItem; if (_editSeatInfo._szTheaterName != sti._TheaterName) { MessageBox.Show("导入的影院名称与座位图的影院名称不一致!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (_editSeatInfo._szHallName != sh._HallName) { MessageBox.Show("导入的影厅名称与座位图的影厅名称不一致!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (_editSeatInfo._szLevelName != shl._LevelId) { MessageBox.Show("导入的座位图楼层与座位图的楼层不一致!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (seatChartDispScreen1.seatChartDisp1.Controls.Count <= 0) { MessageBox.Show("座位图中没有座位,不能导入保存!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } SeatMaDll.SeatingChart stchTemp = SeatingChartAction.GetSeatingChart(_seatingChart.SeatingChartName); if (stchTemp == null) { stchTemp = BuildSeatingChart(_seatingChart.SeatingChartName); stchTemp.BgColour = _seatingChart.BgColour; stchTemp.Shape = _seatingChart.Shape; _seatingChart = stchTemp; } else { stchTemp.BgColour = _seatingChart.BgColour; stchTemp.Shape = _seatingChart.Shape; _seatingChart = stchTemp; bool bWillUsed = SeatingChartAction.SeatingChartExistWillUsed(_seatingChart.SeatingChartName, DateTime.Now); if (bWillUsed) { MessageBox.Show("座位图正在买票中使用,不能导入保存!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show("座位图已经存在,是否重新导入?", "系统提示", buttons); if (result == System.Windows.Forms.DialogResult.No) { return; } bool bHaveUsed = SeatingChartAction.SeatingChartExistHaveUsed(_seatingChart.SeatingChartId); if (bHaveUsed) { SeatingChartAction.UpdateActiveFlag(_seatingChart.SeatingChartId, 0); stchTemp = BuildSeatingChart(_seatingChart.SeatingChartName); stchTemp.BgColour = _seatingChart.BgColour; stchTemp.Shape = _seatingChart.Shape; _seatingChart = stchTemp; } else { SeatAction.DeleteBySeatingChartId(_seatingChart.SeatingChartId); } } this.Cursor = Cursors.AppStarting; this.bgwSave.RunWorkerAsync(); }
private bool ImportData(ref string szMsg) { if (uC_HallInfoSeek1.cbb_Theater.SelectedItem == null) { szMsg = "必须选择一个影院!"; return(false); } if (uC_HallInfoSeek1.cbb_Hall.SelectedItem == null) { szMsg = "必须选择一个影厅!"; return(false); } if (uC_HallInfoSeek1.cbb_Level.SelectedItem == null) { szMsg = "必须选择一个楼层!"; return(false); } SimTheaterInfo sti = (SimTheaterInfo)uC_HallInfoSeek1.cbb_Theater.SelectedItem; string szTheaterId = sti._TheaterId; SimHall sh = (SimHall)uC_HallInfoSeek1.cbb_Hall.SelectedItem; string szHallId = sh._HallId; SimHallLevel shl = (SimHallLevel)uC_HallInfoSeek1.cbb_Level.SelectedItem; string szLevel = shl._LevelId; _editSeatInfo = new SeatMaDll.EditSeatInfo(); _editSeatInfo._szTheaterName = sti._TheaterName; _editSeatInfo._szHallName = sh._HallName; _editSeatInfo._szLevelName = shl._LevelId; OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "请选择包含数据的座位图文件"; dialog.Filter = "座位图文件|*.dat"; string szFileName_Full = ""; //@"c:\Firsite.dat"; if (dialog.ShowDialog(this) == DialogResult.OK) { szFileName_Full = dialog.FileName; if (szFileName_Full.Trim().Length <= 0) { //MessageBox.Show("文件名称不能为空!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); szMsg = "文件名称不能为空!"; return(false); } } if (szFileName_Full.Trim().Length <= 0) { return(false); } //bool bImport = seatChartDispScreen1.seatChartDisp1.ImportItems(szFileName_Full, ref _editSeatInfo, ref szMsg); bool bImport = seatChartDispScreen1.seatChartDisp1.PreImportItems(szFileName_Full, ref _editSeatInfo, ref szMsg); if (!bImport) { return(false); } SetSeatResource(_editSeatInfo._ObjSeatingChart.BgColour); seatChartDispScreen1.seatChartDisp1.ImportSeatChartNew(_editSeatInfo._ObjSeatingChart); _seatingChart = _editSeatInfo._ObjSeatingChart; _seatingChart.SeatingChartName = _editSeatInfo._szSeatingChartName; seatChartDispScreen1.seatChartDisp1.Invalidate(); bool bInUsed = SeatingChartAction.SeatingChartExistWillUsed(_seatingChart.SeatingChartName, DateTime.Now); if (bInUsed) { MessageBox.Show("座位图正在买票中使用,不能导入保存!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } return(bImport); }