//绑定航段信息的数据 private void BindPlanInfo(string cusID) { EyouSoft.BLL.TourStructure.TourOrder TourOrderBll = new EyouSoft.BLL.TourStructure.TourOrder(); EyouSoft.Model.TourStructure.MCustomerAllFlight fight = TourOrderBll.GetCustomerAllFlight(cusID); //调用取得航段信息集合 IList <EyouSoft.Model.PlanStructure.TicketFlight> list = DisponseFightList(fight); //绑定数据. if (list != null && list.Count > 0) { this.rpTicket.DataSource = list; this.rpTicket.DataBind(); //repeater显示 this.rpTicket.Visible = true; //无数据提示Label隐藏 this.lblMsg.Visible = false; } else { //无数据提示Label显示 this.lblMsg.Visible = true; //赋值 this.lblMsg.Text = "未查找到相应的航段信息"; //隐藏repeater this.rpTicket.Visible = false; //设置label控件的字体颜色 this.lblMsg.ForeColor = Color.BlueViolet; } }
//处理航段list数据 protected IList <EyouSoft.Model.PlanStructure.TicketFlight> DisponseFightList(EyouSoft.Model.TourStructure.MCustomerAllFlight fight) { IList <EyouSoft.Model.PlanStructure.TicketFlight> list = new List <EyouSoft.Model.PlanStructure.TicketFlight>(); //判断查询所得的航段信息是否为null if (fight != null) { //判断航段信息集合的数量是否大于0 if (fight.TicketFlights.Count > 0) { //判断以退航段信息集合的数量是否大于0 if (fight.RefundFlights.Count > 0) { //遍历所有的航段 foreach (EyouSoft.Model.PlanStructure.MTicketFlightAndState item in fight.TicketFlights) { if (item != null && item.Status == EyouSoft.Model.EnumType.PlanStructure.TicketState.已出票) { //为ticketId字段设置标识符'true','false' item.TicketId = item.TicketId + "_false"; foreach (EyouSoft.Model.TourStructure.MCustomerRefundFlight refFight in fight.RefundFlights) { //如果所有航段中有已退航段则设置ticketid的标识符为true if (item.ID == refFight.FlightId) { item.TicketId = item.TicketId.Split('_')[0]; item.TicketId = item.TicketId + "_true"; } } //将数据添加到集合中 list.Add(item); } } return(list); } else { //如果该fight对象中的已退航段信息集合的数量为0则直接将所有的ticketid的标识符设置为'false' foreach (EyouSoft.Model.PlanStructure.MTicketFlightAndState item in fight.TicketFlights) { if (item != null && item.Status == EyouSoft.Model.EnumType.PlanStructure.TicketState.已出票) { item.TicketId = item.TicketId + "_false"; list.Add(item); } } return(list); } } else { return(null); } } else { return(null); } }