private List <PlansOfClient> GetPlans(List <TF.RunSafty.Model.VIEW_Plan_Trainman> vPlans) { List <PlansOfClient> plans = new List <PlansOfClient>(); TF.RunSafty.Model.InterfaceModel.TrainPlan tPlan = null; TF.RunSafty.Model.InterfaceModel.PlansOfClient pClient = null; if (vPlans != null) { foreach (VIEW_Plan_Trainman plan in vPlans) { tPlan = new TF.RunSafty.Model.InterfaceModel.TrainPlan(); tPlan.dragTypeID = plan.nDragType.ToString(); tPlan.dragTypeName = plan.nDragTypeName; tPlan.endStationID = plan.strEndStation; tPlan.endStationName = plan.strEndStationName; tPlan.kehuoID = plan.nKehuoID.ToString(); tPlan.kehuoName = plan.strKehuoName; tPlan.placeName = plan.strPlaceName; tPlan.planStateID = plan.nPlanState.ToString(); tPlan.planStateName = plan.strStateName; tPlan.planTypeID = plan.nPlanType.ToString(); tPlan.planTypeName = plan.strPlanTypeName; tPlan.remarkTypeID = plan.nRemarkType.ToString(); tPlan.remarkTypeName = plan.strRemarkTypeName; tPlan.startStationID = plan.strStartStation; tPlan.startStationName = plan.strStartStationName; if (plan.dtStartTime.HasValue) { tPlan.startTime = plan.dtStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } tPlan.trainmanTypeID = plan.nTrainmanTypeID.ToString(); tPlan.trainmanTypeName = plan.strTrainmanTypeName; tPlan.trainNo = plan.strTrainNo; tPlan.trainNumber = plan.strTrainNumber; tPlan.trainTypeName = plan.strTrainTypeName; tPlan.planID = plan.strTrainPlanGUID; tPlan.placeID = plan.strPlaceID; tPlan.strWaiQinClientGUID = plan.strWaiQinClientGUID; tPlan.strWaiQinClientNumber = plan.strWaiQinClientNumber; tPlan.strWaiQinClientName = plan.strWaiQinClientName; NameGroup group = new NameGroup(); group.groupID = plan.strGroupGUID; group.trainman1 = new Trainman(); group.trainman1.trainmanID = plan.strTrainmanGUID1; group.trainman1.trainmanName = plan.strTrainmanName1; group.trainman1.trainmanNumber = plan.strTrainmanNumber1; group.trainman2 = new Trainman(); group.trainman2.trainmanID = plan.strTrainmanGUID2; group.trainman2.trainmanName = plan.strTrainmanName2; group.trainman2.trainmanNumber = plan.strTrainmanNumber2; group.trainman3 = new Trainman(); group.trainman3.trainmanID = plan.strTrainmanGUID3; group.trainman3.trainmanName = plan.strTrainmanName3; group.trainman3.trainmanNumber = plan.strTrainmanNumber3; group.trainman4 = new Trainman(); group.trainman4.trainmanID = plan.strTrainmanGUID4; group.trainman4.trainmanName = plan.strTrainmanName4; group.trainman4.trainmanNumber = plan.strTrainmanNumber4; if (plan.dtArriveTime.HasValue) { group.arriveTime = plan.dtArriveTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } group.groupID = plan.strGroupGUID; group.place = new ChuqinPlace(); group.place.placeID = plan.strPlaceID; group.place.placeName = plan.strPlaceName; group.station = new Station(); group.trainPlanID = plan.strTrainPlanGUID; pClient = new PlansOfClient(); pClient.trainPlan = tPlan; pClient.group = group; plans.Add(pClient); } } return(plans); }
/// <summary> /// 分页获取数据列表 /// </summary> //public DataSet GetList(int PageSize,int PageIndex,string strWhere) //{ //return dal.GetList(PageSize,PageIndex,strWhere); //} #endregion BasicMethod #region ExtensionMethod //GetPlans函数实际上不应该出现在这个类中,有空的话建议移出去 /// <summary> /// /// </summary> /// <param name="vPlans"></param> /// <returns></returns> private List <PlansOfClient> GetPlans(List <TF.RunSafty.Model.VIEW_Plan_Trainman> vPlans) { List <PlansOfClient> plans = new List <PlansOfClient>(); TF.RunSafty.Model.InterfaceModel.TrainPlan tPlan = null; TF.RunSafty.Model.InterfaceModel.PlansOfClient pClient = null; if (vPlans != null) { foreach (TF.RunSafty.Model.VIEW_Plan_Trainman plan in vPlans) { tPlan = new TF.RunSafty.Model.InterfaceModel.TrainPlan(); if (plan.dtCreateTime.HasValue) { tPlan.createTime = plan.dtCreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } tPlan.createSiteGUID = plan.strCreateSiteGUID; tPlan.createSiteName = plan.strCreateSiteName; tPlan.createUserGUID = plan.strCreateUserGUID; tPlan.createUserName = plan.strCreateUserName; if (plan.nDragType.HasValue) { tPlan.dragTypeID = plan.nDragType.ToString(); } tPlan.endStationID = plan.strEndStation; tPlan.endStationName = plan.strEndStationName; tPlan.trainJiaoluName = plan.strTrainJiaoluName; tPlan.trainJiaoluGUID = plan.strTrainJiaoluGUID; tPlan.kehuoID = plan.nKehuoID.ToString(); tPlan.kehuoName = plan.strKehuoName; tPlan.mainPlanGUID = plan.strMainPlanGUID; tPlan.placeID = plan.strPlaceID; tPlan.placeName = plan.strPlaceName; tPlan.planID = plan.strTrainPlanGUID; tPlan.planStateID = plan.nPlanState.ToString(); tPlan.planStateName = plan.strPlanStateName; tPlan.planTypeID = plan.nPlanType.ToString(); tPlan.planTypeName = plan.strPlanTypeName; tPlan.remarkTypeID = plan.nRemarkType.ToString(); tPlan.remarkTypeName = plan.strRemarkTypeName; tPlan.strRemark = plan.strRemark; tPlan.startStationID = plan.strStartStation; tPlan.startStationName = plan.strStartStationName; tPlan.dragTypeName = plan.nDragTypeName; tPlan.planID = plan.strTrainPlanGUID; tPlan.strWaiQinClientGUID = plan.strWaiQinClientGUID; tPlan.strWaiQinClientNumber = plan.strWaiQinClientNumber; tPlan.strWaiQinClientName = plan.strWaiQinClientName; if (plan.dtStartTime.HasValue) { tPlan.startTime = plan.dtStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtSendTime.HasValue) { tPlan.sendPlanTime = plan.dtSendTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtRecvTime.HasValue) { tPlan.recvPlanTime = plan.dtRecvTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtCreateTime.HasValue) { tPlan.createTime = plan.dtCreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtChuQinTime.HasValue) { tPlan.kaiCheTime = plan.dtChuQinTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } else { //tPlan.kaiCheTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtFirstStartTime.HasValue) { tPlan.firstStartTime = plan.dtFirstStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtRealStartTime.HasValue) { tPlan.realStartTime = plan.dtRealStartTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtBeginWorkTime.HasValue) { tPlan.beginWorkTime = plan.dtBeginWorkTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } rests rest = new rests(); if (plan.dtArriveTime.HasValue) { tPlan.dtArriveTime = plan.dtArriveTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); rest.dtArriveTime = plan.dtArriveTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.dtCallTime.HasValue) { tPlan.dtCallTime = plan.dtCallTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); rest.dtCallTime = plan.dtCallTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } if (plan.nNeedRest.HasValue) { tPlan.nNeedRest = plan.nNeedRest.Value; rest.nNeedRest = plan.nNeedRest.ToString(); } tPlan.trainmanTypeID = plan.nTrainmanTypeID.ToString(); tPlan.trainNo = plan.strTrainNo; tPlan.trainNumber = plan.strTrainNumber; tPlan.trainTypeName = plan.strTrainTypeName; tPlan.trainmanTypeName = plan.strTrainmanTypeName; NameGroup group = new NameGroup(); group.groupID = plan.strGroupGUID; group.trainman1 = new Trainman(); group.trainman1.trainmanID = plan.strTrainmanGUID1; group.trainman1.trainmanName = plan.strTrainmanName1; group.trainman1.trainmanNumber = plan.strTrainmanNumber1; group.trainman1.callWorkState = plan.nMsgState1.Value; group.trainman1.callWorkID = plan.strMsgID1; group.trainman1.telNumber = plan.strMobileNumber1; group.trainman2 = new Trainman(); group.trainman2.trainmanID = plan.strTrainmanGUID2; group.trainman2.trainmanName = plan.strTrainmanName2; group.trainman2.trainmanNumber = plan.strTrainmanNumber2; group.trainman2.callWorkState = plan.nMsgState2.Value; group.trainman2.callWorkID = plan.strMsgID2; group.trainman2.telNumber = plan.strMobileNumber2; group.trainman3 = new Trainman(); group.trainman3.trainmanID = plan.strTrainmanGUID3; group.trainman3.trainmanName = plan.strTrainmanName3; group.trainman3.trainmanNumber = plan.strTrainmanNumber3; group.trainman3.callWorkState = plan.nMsgState3.Value; group.trainman3.callWorkID = plan.strMsgID3; group.trainman3.telNumber = plan.strMobileNumber3; group.trainman4 = new Trainman(); group.trainman4.trainmanID = plan.strTrainmanGUID4; group.trainman4.trainmanName = plan.strTrainmanName4; group.trainman4.trainmanNumber = plan.strTrainmanNumber4; group.trainman4.callWorkState = plan.nMsgState4.Value; group.trainman4.callWorkID = plan.strMsgID4; group.trainman4.telNumber = plan.strMobileNumber4; if (plan.dtArriveTime.HasValue) { group.arriveTime = plan.dtArriveTime.Value.ToString("yyyy-MM-dd HH:mm:ss"); } group.groupID = plan.strGroupGUID; group.place = new ChuqinPlace(); group.place.placeID = plan.strPlaceID; group.place.placeName = plan.strPlaceName; group.station = new Station(); group.trainPlanID = plan.strTrainPlanGUID; pClient = new PlansOfClient(); pClient.trainPlan = tPlan; pClient.group = group; pClient.rest = rest; plans.Add(pClient); } } return(plans); }