예제 #1
0
        public string LoadTrainNo(string data)
        {
            JsonModel3 jsonModel = new JsonModel3();

            try
            {
                ParamModel3 paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModel3>(data);
                TF.RunSafty.Model.TAB_Base_TrainNo train = new TF.RunSafty.Model.TAB_Base_TrainNo();
                TF.RunSafty.BLL.TAB_Base_TrainNo   bllTrain = new TF.RunSafty.BLL.TAB_Base_TrainNo();
                DateTime dtBegin, dtEnd;
                string   strTrainjiao = paramModel.data.trainjiaoluID;
                dtBegin = DateTime.Parse(paramModel.data.beginTime);
                dtEnd   = DateTime.Parse(paramModel.data.endTime);
                //缺省计划状态为1编辑。在指定了状态后可以为指定的状态
                int PlanState = paramModel.data.planState <= 0 ? 1 : paramModel.data.planState;

                bllTrain.GetTrainnoByTime(strTrainjiao, dtBegin, dtEnd, PlanState);
                jsonModel.result    = 0;
                jsonModel.resultStr = "返回成功";
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
                jsonModel.result    = 1;
                jsonModel.resultStr = "提交失败" + ex.Message;
            }
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel);

            return(result);
        }
예제 #2
0
        public string AddTrainNo(string data)
        {
            JsonModel jsonModel = new JsonModel();

            TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation();
            try
            {
                TF.RunSafty.Model.InterfaceModel.ParamModel paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <TF.RunSafty.Model.InterfaceModel.ParamModel>(data);
                //验证数据正确性,非空字段不能为空
                if (validater.IsNotNullPropertiesValidated(paramModel.data))
                {
                    TF.RunSafty.Model.TAB_Base_TrainNo train = new TF.RunSafty.Model.TAB_Base_TrainNo();
                    Train t = new Train();
                    if (this.AddByParamModel(paramModel, train))
                    {
                        t.trainnoID         = train.strGUID;
                        jsonModel.result    = 0;
                        jsonModel.resultStr = "返回成功";
                        jsonModel.data      = t;
                    }
                }
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
                jsonModel.result    = 1;
                jsonModel.resultStr = "提交失败" + ex.Message;
            }
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel);

            return(result);
        }
예제 #3
0
        public string DeleteTrainNo(string data)
        {
            JsonModel2 jsonModel = new JsonModel2();

            try
            {
                ParamModel2 paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModel2>(data);
                TF.RunSafty.Model.TAB_Base_TrainNo train = new TF.RunSafty.Model.TAB_Base_TrainNo();
                if (this.Delete(paramModel.data.trainnoID))
                {
                    jsonModel.result    = 0;
                    jsonModel.resultStr = "返回成功";
                }
            }
            catch (Exception ex)
            {
                TF.CommonUtility.LogClass.logex(ex, "");
                jsonModel.result    = 1;
                jsonModel.resultStr = "提交失败" + ex.Message;
            }
            string result = Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel);

            return(result);
        }
예제 #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TF.RunSafty.Model.TAB_Base_TrainNo model)
 {
     return(dal.Update(model));
 }
예제 #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(TF.RunSafty.Model.TAB_Base_TrainNo model)
 {
     return(dal.Add(model));
 }
예제 #6
0
        public void SetModelValue(TF.RunSafty.Model.InterfaceModel.ParamModel paramModel, TF.RunSafty.Model.TAB_Base_TrainNo train)
        {
            train.dtCreateTime = DateTime.Now;
            if (!string.IsNullOrEmpty(paramModel.data.dragTypeID))
            {
                train.nDragType = int.Parse(paramModel.data.dragTypeID);
            }
            if (!string.IsNullOrEmpty(paramModel.data.kehuoID))
            {
                train.nKehuoID = int.Parse(paramModel.data.kehuoID);
            }
            if (!string.IsNullOrEmpty(paramModel.data.planTypeID))
            {
                train.nPlanType = int.Parse(paramModel.data.planTypeID);
            }
            train.nRemarkType        = int.Parse(paramModel.data.remarkTypeID);
            train.nTrainmanTypeID    = int.Parse(paramModel.data.trainmanTypeID);
            train.strEndStation      = paramModel.data.endStationID;
            train.strPlaceID         = paramModel.data.placeID;
            train.strRemark          = paramModel.data.remark;
            train.strStartStation    = paramModel.data.startStationID;
            train.strTrainJiaoluGUID = paramModel.data.trainjiaoluID;
            train.strTrainNo         = paramModel.data.trainNo;
            train.strTrainNumber     = paramModel.data.trainNumber;
            train.strTrainTypeName   = paramModel.data.trainTypeName;
            DateTime dt = DateTime.Parse(paramModel.data.startTime);

            train.dtStartTime     = dt;
            train.dtRealStartTime = dt;
            DateTime dtChuQinTime;

            if (DateTime.TryParse(paramModel.data.kaiCheTime, out dtChuQinTime))
            {
                train.dtPlanStartTime = dtChuQinTime;
            }
        }
예제 #7
0
        public bool AddByParamModel(TF.RunSafty.Model.InterfaceModel.ParamModel paramModel, TF.RunSafty.Model.TAB_Base_TrainNo train)
        {
            string strGUID = Guid.NewGuid().ToString();

            train.strGUID = strGUID;
            SetModelValue(paramModel, train);
            return(this.Add(train));
        }
예제 #8
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  BasicMethod
        #region  ExtensionMethod
        public bool UpdateByParamModel(TF.RunSafty.Model.InterfaceModel.ParamModel paramModel)
        {
            TF.RunSafty.Model.TAB_Base_TrainNo train = this.GetModel(paramModel.data.trainNoID);
            SetModelValue(paramModel, train);
            return(this.Update(train));
        }