コード例 #1
0
        private TrainNo GetTrainNo(TF.RunSafty.Model.VIEW_Base_TrainNo trainNo)
        {
            TrainNo model = new TrainNo();

            model.trainjiaoluID   = trainNo.strTrainJiaoluGUID;
            model.trainjiaoluName = trainNo.strTrainJiaoluName;
            model.placeID         = trainNo.strPlaceID;
            model.placeName       = trainNo.strPlaceName;
            model.trainTypeName   = trainNo.strTrainTypeName;
            model.trainNumber     = trainNo.strTrainNumber;
            model.trainNo         = trainNo.strTrainNo;
            model.remark          = trainNo.strRemark;
            if (trainNo.dtStartTime.HasValue)
            {
                model.startTime = trainNo.dtStartTime.Value;
            }
            model.startStationID   = trainNo.strStartStation;
            model.startStationName = trainNo.strStartStationName;
            model.endStationID     = trainNo.strEndStation;
            model.endStationName   = trainNo.strEndStationName;
            model.trainmanTypeID   = trainNo.nTrainmanTypeID.ToString();
            model.trainmanTypeName = trainNo.strTrainmanTypeName;
            model.planTypeID       = trainNo.nPlanType.ToString();
            model.planTypeName     = trainNo.strPlanTypeName;
            model.dragTypeID       = trainNo.nDragType.ToString();
            model.dragTypeName     = trainNo.nDragTypeName;
            model.kehuoID          = trainNo.nKehuoID.ToString();
            model.kehuoName        = trainNo.strKehuoName;
            model.remarkTypeID     = trainNo.nRemarkType.ToString();
            model.remarkTypeName   = trainNo.strRemarkTypeName;
            model.trainNoID        = trainNo.strGUID;
            if (trainNo.dtPlanStartTime.HasValue)
            {
                model.kaiCheTime = trainNo.dtPlanStartTime.Value;
            }
            else
            {
                if (trainNo.dtStartTime.HasValue)
                {
                    model.kaiCheTime = trainNo.dtStartTime.Value;
                }
            }
            model.strWorkDay   = trainNo.strWorkDay;
            model.dtCallTime   = trainNo.dtCallTime;
            model.dtArriveTime = trainNo.dtArriveTime;
            model.nNeedRest    = trainNo.nNeedRest;
            return(model);
        }
コード例 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TF.RunSafty.Model.VIEW_Base_TrainNo DataRowToModel(DataRow row)
 {
     TF.RunSafty.Model.VIEW_Base_TrainNo model = new TF.RunSafty.Model.VIEW_Base_TrainNo();
     if (row != null)
     {
         if (row["strTrainJiaoluName"] != null)
         {
             model.strTrainJiaoluName = row["strTrainJiaoluName"].ToString();
         }
         if (row["strTrainmanTypeName"] != null)
         {
             model.strTrainmanTypeName = row["strTrainmanTypeName"].ToString();
         }
         if (row["strGUID"] != null)
         {
             model.strGUID = row["strGUID"].ToString();
         }
         if (row["strTrainJiaoluGUID"] != null)
         {
             model.strTrainJiaoluGUID = row["strTrainJiaoluGUID"].ToString();
         }
         if (row["strTrainNo"] != null)
         {
             model.strTrainNo = row["strTrainNo"].ToString();
         }
         if (row["strTrainNumber"] != null)
         {
             model.strTrainNumber = row["strTrainNumber"].ToString();
         }
         if (row["dtStartTime"] != null && row["dtStartTime"].ToString() != "")
         {
             DateTime dtStartTime;
             if (DateTime.TryParse(row["dtStartTime"].ToString(), out dtStartTime))
             {
                 model.dtStartTime = dtStartTime;
             }
         }
         if (row["strStartStation"] != null)
         {
             model.strStartStation = row["strStartStation"].ToString();
         }
         if (row["strEndStation"] != null)
         {
             model.strEndStation = row["strEndStation"].ToString();
         }
         if (row["dtCreateTime"] != null && row["dtCreateTime"].ToString() != "")
         {
             DateTime dtCreateTime;
             if (DateTime.TryParse(row["dtCreateTime"].ToString(), out dtCreateTime))
             {
                 model.dtCreateTime = dtCreateTime;
             }
         }
         if (row["strTrainTypeName"] != null)
         {
             model.strTrainTypeName = row["strTrainTypeName"].ToString();
         }
         if (row["nTrainmanTypeID"] != null && row["nTrainmanTypeID"].ToString() != "")
         {
             model.nTrainmanTypeID = int.Parse(row["nTrainmanTypeID"].ToString());
         }
         if (row["strStartStationName"] != null)
         {
             model.strStartStationName = row["strStartStationName"].ToString();
         }
         if (row["nKehuoID"] != null && row["nKehuoID"].ToString() != "")
         {
             model.nKehuoID = int.Parse(row["nKehuoID"].ToString());
         }
         if (row["dtRealStartTime"] != null && row["dtRealStartTime"].ToString() != "")
         {
             // model.dtRealStartTime = DateTime.Parse(row["dtRealStartTime"].ToString());
             DateTime dtRealStartTime;
             if (DateTime.TryParse(row["dtRealStartTime"].ToString(), out dtRealStartTime))
             {
                 model.dtRealStartTime = dtRealStartTime;
             }
         }
         if (row["nPlanType"] != null && row["nPlanType"].ToString() != "")
         {
             model.nPlanType = int.Parse(row["nPlanType"].ToString());
         }
         if (row["nDragType"] != null && row["nDragType"].ToString() != "")
         {
             model.nDragType = int.Parse(row["nDragType"].ToString());
         }
         if (row["nRemarkType"] != null && row["nRemarkType"].ToString() != "")
         {
             model.nRemarkType = int.Parse(row["nRemarkType"].ToString());
         }
         if (row["strRemark"] != null)
         {
             model.strRemark = row["strRemark"].ToString();
         }
         if (row["strCreateSiteGUID"] != null)
         {
             model.strCreateSiteGUID = row["strCreateSiteGUID"].ToString();
         }
         if (row["strCreateUserGUID"] != null)
         {
             model.strCreateUserGUID = row["strCreateUserGUID"].ToString();
         }
         if (row["strEndStationName"] != null)
         {
             model.strEndStationName = row["strEndStationName"].ToString();
         }
         if (row["nDragTypeName"] != null)
         {
             model.nDragTypeName = row["nDragTypeName"].ToString();
         }
         if (row["strPlaceID"] != null)
         {
             model.strPlaceID = row["strPlaceID"].ToString();
         }
         if (row["strPlaceName"] != null)
         {
             model.strPlaceName = row["strPlaceName"].ToString();
         }
         if (row["strKehuoName"] != null)
         {
             model.strKehuoName = row["strKehuoName"].ToString();
         }
         if (row["strPlanTypeName"] != null)
         {
             model.strPlanTypeName = row["strPlanTypeName"].ToString();
         }
         if (row["strRemarkTypeName"] != null)
         {
             model.strRemarkTypeName = row["strRemarkTypeName"].ToString();
         }
         if (row["dtPlanStartTime"] != null && row["dtPlanStartTime"].ToString() != "")
         {
             model.dtPlanStartTime = DateTime.Parse(row["dtPlanStartTime"].ToString());
         }
         else
         {
             model.dtPlanStartTime = model.dtStartTime;
         }
         if (row["dtCallTime"] != null && row["dtCallTime"].ToString() != "")
         {
             model.dtCallTime = DateTime.Parse(row["dtCallTime"].ToString());
         }
         if (row["dtArriveTime"] != null && row["dtArriveTime"].ToString() != "")
         {
             model.dtArriveTime = DateTime.Parse(row["dtArriveTime"].ToString());
         }
         if (row["nNeedRest"] != null && row["nNeedRest"].ToString() != "")
         {
             model.nNeedRest = int.Parse(row["nNeedRest"].ToString());
         }
         if (row["strWorkDay"] != null)
         {
             model.strWorkDay = row["strWorkDay"].ToString();
         }
     }
     return(model);
 }