Ejemplo n.º 1
0
        public string ChangeGroupPlace(string data)
        {
            JsonModel2 jsonModel = new JsonModel2();

            jsonModel.result    = 1;
            jsonModel.resultStr = "数据提交失败:未找到指定的机组信息";
            TF.Api.Utilities.Validation validater = new TF.Api.Utilities.Validation();
            try
            {
                InputParam paramModel = Newtonsoft.Json.JsonConvert.DeserializeObject <InputParam>(data);
                //验证数据正确性,非空字段不能为空
                if (validater.IsNotNullPropertiesValidated(paramModel.data))
                {
                    if (this.ChangeGroupPlace(paramModel.data.groupID, paramModel.data.sourcePlaceID, paramModel.data.destPlaceID))
                    {
                        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);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 检查接口参数是否可用 hx add 20171206
        /// </summary>
        /// <param name="userid">POLYV用户ID</param>
        /// <param name="writetoken">用户的写密钥</param>
        /// <param name="readtoken">用户的读密钥</param>
        /// <param name="secretkey"></param>
        /// <returns></returns>
        public bool CheckParameter(string userid, string writetoken, string readtoken, string secretkey, ref string refMessage)
        {
            //①检查 userid、secretkey是否正确
            string url                = string.Format("http://api.polyv.net/v2/data/{0}/viewlog", userid);
            string ts                 = ConvertDateTimeToInt(DateTime.Now).ToString().Substring(0, 13);
            string str                = string.Format("day=20160711&ptime={0}&userid={1}{2}", ts, userid, secretkey);
            string Sign               = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "sha1").ToUpper();
            string postData           = string.Format("day=20160711&ptime={0}&sign={1}", ts, Sign);
            string result             = ResponseToString(doPost(url, postData));
            JavaScriptSerializer jss  = new JavaScriptSerializer();
            JsonModel2           Json = jss.Deserialize <JsonModel2>(result);

            if (Json.code != 200)
            {
                refMessage = ReturnMessage(Json.message);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 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);
        }