示例#1
0
        public List <TF.RunSafty.Model.TAB_Plan_Train> GetPlaceList(List <TF.RunSafty.Model.TAB_Plan_Train> placeList)
        {
            if (placeList != null)
            {
                List <TF.RunSafty.Model.TAB_Plan_Train> resultList = new List <TF.RunSafty.Model.TAB_Plan_Train>();
                foreach (TF.RunSafty.Model.TAB_Plan_Train place in placeList)
                {
                    TF.RunSafty.Model.TAB_Plan_Train model = new TF.RunSafty.Model.TAB_Plan_Train();
                    model.dtArriveTime = place.dtArriveTime;
                    model.dtCallTime   = place.dtCallTime;
                    model.dtChuQinTime = place.dtChuQinTime;

                    model.dtCreateTime     = place.dtCreateTime;
                    model.dtFirstStartTime = place.dtFirstStartTime;
                    model.dtLastArriveTime = place.dtLastArriveTime;
                    model.dtRealStartTime  = place.dtRealStartTime;

                    model.dtStartTime = place.dtStartTime;
                    model.nDragType   = place.nDragType;
                    model.nid         = place.nid;
                    model.nKehuoID    = place.nKehuoID;

                    model.nNeedRest   = place.nNeedRest;
                    model.nPlanState  = place.nPlanState;
                    model.nPlanType   = place.nPlanType;
                    model.nRemarkType = place.nRemarkType;


                    model.nTrainmanTypeID   = place.nTrainmanTypeID;
                    model.strBak1           = place.strBak1;
                    model.strCreateSiteGUID = place.strCreateSiteGUID;
                    model.strCreateUserGUID = place.strCreateUserGUID;

                    model.strEndStation   = place.strEndStation;
                    model.strMainPlanGUID = place.strMainPlanGUID;
                    model.strPlaceID      = place.strPlaceID;
                    model.strRemark       = place.strRemark;


                    model.strStartStation    = place.strStartStation;
                    model.strTrainJiaoluGUID = place.strTrainJiaoluGUID;
                    model.strTrainNo         = place.strTrainNo;
                    model.strTrainNumber     = place.strTrainNumber;


                    model.strTrainPlanGUID = place.strTrainPlanGUID;
                    model.strTrainTypeName = place.strTrainTypeName;

                    resultList.Add(model);
                }
                return(resultList);
            }
            return(null);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TF.RunSafty.Model.TAB_Plan_Train model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(TF.RunSafty.Model.TAB_Plan_Train model)
 {
     return(dal.Add(model));
 }
示例#4
0
        public string AddEditabledTrainPlan(string data)
        {
            eJsonModel  jsonModel = new eJsonModel();
            eParamModel param     = Newtonsoft.Json.JsonConvert.DeserializeObject <eParamModel>(data);

            TF.RunSafty.Model.TAB_Plan_Train plan = new TF.RunSafty.Model.TAB_Plan_Train();
            try
            {
                DateTime dtStartTime;
                if (DateTime.TryParse(param.data.trainPlan.startTime, out dtStartTime))
                {
                    plan.dtStartTime = dtStartTime;
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.dragTypeID))
                {
                    plan.nDragType = int.Parse(param.data.trainPlan.dragTypeID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.kehuoID))
                {
                    plan.nKehuoID = int.Parse(param.data.trainPlan.kehuoID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.planTypeID))
                {
                    plan.nPlanType = int.Parse(param.data.trainPlan.planTypeID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.remarkTypeID))
                {
                    plan.nRemarkType = int.Parse(param.data.trainPlan.remarkTypeID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.trainmanTypeID))
                {
                    plan.nTrainmanTypeID = int.Parse(param.data.trainPlan.trainmanTypeID);
                }
                plan.strCreateSiteGUID  = param.data.site.siteID;
                plan.strCreateUserGUID  = param.data.user.userID;
                plan.strPlaceID         = param.data.trainPlan.placeID;
                plan.strStartStation    = param.data.trainPlan.startStationID;
                plan.strEndStation      = param.data.trainPlan.endStationID;
                plan.strTrainJiaoluGUID = param.data.trainPlan.trainjiaoluID;
                plan.strTrainNo         = param.data.trainPlan.trainNo;
                plan.strTrainNumber     = param.data.trainPlan.trainNumber;
                plan.strTrainTypeName   = param.data.trainPlan.trainTypeName;
                plan.dtCreateTime       = DateTime.Now;
                plan.dtRealStartTime    = plan.dtStartTime;
                string planGUID = Guid.NewGuid().ToString();
                plan.strTrainPlanGUID = planGUID;
                plan.nPlanState       = (int)TRsPlanState.psEdit;
                if (!string.IsNullOrEmpty(param.data.trainPlan.kaiCheTime))
                {
                    DateTime dtChuqinTime;
                    if (DateTime.TryParse(param.data.trainPlan.kaiCheTime, out dtChuqinTime))
                    {
                        plan.dtChuQinTime = dtChuqinTime;
                    }
                }

                if (this.Add(plan) > 0)
                {
                    jsonModel.data.planID = planGUID;
                    jsonModel.result      = 0;
                    jsonModel.resultStr   = "返回成功";
                }
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
            }

            Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
            //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式
            timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel, timeConverter).Replace(":null", ":\"\"");

            return(result);
        }
示例#5
0
        public string Add(string data)
        {
            JsonModel  jsonModel = new JsonModel();
            ParamModel param     = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModel>(data);

            TF.RunSafty.BLL.Plan.TAB_Plan_Train bllPlan = new TF.RunSafty.BLL.Plan.TAB_Plan_Train();
            TF.RunSafty.Model.TAB_Plan_Train    plan    = new TF.RunSafty.Model.TAB_Plan_Train();
            try
            {
                DateTime dtStartTime;
                if (DateTime.TryParse(param.data.trainPlan.startTime, out dtStartTime))
                {
                    plan.dtStartTime = dtStartTime;
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.dragTypeID))
                {
                    plan.nDragType = int.Parse(param.data.trainPlan.dragTypeID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.kehuoID))
                {
                    plan.nKehuoID = int.Parse(param.data.trainPlan.kehuoID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.planTypeID))
                {
                    plan.nPlanType = int.Parse(param.data.trainPlan.planTypeID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.remarkTypeID))
                {
                    plan.nRemarkType = int.Parse(param.data.trainPlan.remarkTypeID);
                }
                if (!string.IsNullOrEmpty(param.data.trainPlan.trainmanTypeID))
                {
                    plan.nTrainmanTypeID = int.Parse(param.data.trainPlan.trainmanTypeID);
                }
                plan.strCreateSiteGUID  = param.data.site.siteID;
                plan.strCreateUserGUID  = param.data.user.userID;
                plan.strPlaceID         = param.data.trainPlan.placeID;
                plan.strStartStation    = param.data.trainPlan.startStationID;
                plan.strEndStation      = param.data.trainPlan.endStationID;
                plan.strTrainJiaoluGUID = param.data.trainPlan.trainjiaoluID;
                plan.strTrainNo         = param.data.trainPlan.trainNo;
                plan.strTrainNumber     = param.data.trainPlan.trainNumber;
                plan.strTrainTypeName   = param.data.trainPlan.trainTypeName;
                plan.strCreateUserGUID  = param.data.user.userID;
                plan.nPlanState         = (int)TRsPlanState.psReceive;
                plan.dtCreateTime       = DateTime.Now;
                plan.dtRealStartTime    = plan.dtStartTime;
                string planGUID = Guid.NewGuid().ToString();
                plan.strTrainPlanGUID = planGUID;
                if (bllPlan.Add(plan) > 0)
                {
                    jsonModel.data.planID = planGUID;
                    jsonModel.result      = 0;
                    jsonModel.resultStr   = "返回成功";
                }
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
            }
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel).Replace(":null", ":\"\"");

            return(result);
        }