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; } }
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; } }