コード例 #1
0
    public override string QueryResult()
    {
        JsonModel jsonModel = new JsonModel();

        try
        {
            ParamModel paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <ParamModel>(this.Data);
            TF.RunSafty.BLL.Tab_Plan_Rest          bllPlace  = new TF.RunSafty.BLL.Tab_Plan_Rest();
            List <TF.RunSafty.Model.TAB_Plan_Rest> placeList = bllPlace.GetPlanTrain(paramModel.data.dtStartTime, paramModel.data.dtEndTime, paramModel.data.strJiaoluGUID);
            jsonModel.result    = 0;
            jsonModel.resultStr = "提交成功";
            planArrays p = new planArrays();
            jsonModel.data       = p;
            p.strTrainJiaoLuGUID = paramModel.data.strJiaoluGUID;
            p.strCurPlanGUID     = "";
            p.planArray          = bllPlace.GetPlaceList(placeList);
        }
        catch (Exception ex)
        {
            TF.CommonUtility.LogClass.logex(ex, "");
            jsonModel.result    = 1;
            jsonModel.resultStr = "提交失败" + ex.Message;
        }
        Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter();
        //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式
        timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
        return(Newtonsoft.Json.JsonConvert.SerializeObject(jsonModel, timeConverter));
    }
コード例 #2
0
    public override string QueryResult()
    {
        JsonModel jsonModel = new JsonModel();

        TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation();
        try
        {
            PlanRestModel paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <PlanRestModel>(this.Data);
            //验证数据正确性,非空字段不能为空
            if (validater.IsNotNullPropertiesValidated(paramModel.data))
            {
                TF.RunSafty.BLL.Tab_Plan_Rest bllTrain = new TF.RunSafty.BLL.Tab_Plan_Rest();
                if (bllTrain.UpdateByParamModel(paramModel, ""))
                {
                    jsonModel.result    = 0;
                    jsonModel.resultStr = "返回成功";
                }
                else
                {
                    jsonModel.result    = 2;
                    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);
    }