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); }
public static List <SeatMaDll.Seat> RetrieveObjWithSeatingchartAndBlock(string szShowPlanId, SeatMaDll.SeatingChart seatingChartTemp, int nUser, int nLeftPad, int nTopPad, 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>(); if (seatingChartTemp == null) { return(listAll); } SeatstatusDbo dbo = new SeatstatusDbo(); DataTable dt = dbo.RetrieveItemStatus_InitWithBlock(szShowPlanId, seatingChartTemp.SeatingChartId); seatingchart = seatingChartTemp; if (dt == null || dt.Rows.Count <= 0) { return(listAll); } //var sw = new Stopwatch(); //sw.Restart(); 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.ChangeObjFromDataWithPad(po, nLeftPad, nTopPad); 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); } } } //sw.Stop(); //TimeSpan time = sw.Elapsed; SeatAction.MergeObjNew(listNoBrother, listHaveBrother); dt.Dispose(); foreach (SeatMaDll.Seat st in listHaveBrother) { listAll.Add(st); } return(listAll); }
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); }