Beispiel #1
0
        public GTXResult saveUserYSBQCListReportData(JToken json, string userYsbqcId, string reportCode, string dataKey = "data")
        {
            List <GTXNameValue> nameList = new List <GTXNameValue>();
            GTXNameValue        nv       = new GTXNameValue();

            nv.key = dataKey;
            byte[] bytes   = Encoding.Default.GetBytes(JsonConvert.SerializeObject(json, Newtonsoft.Json.Formatting.None));
            string _result = HttpUtility.UrlEncode(Convert.ToBase64String(bytes));

            nv.value = _result;
            nameList.Add(nv);

            GTXResult gr = GTXMethod.GetUserReportData(userYsbqcId, reportCode);

            if (gr.IsSuccess)
            {
                List <GDTXUserYSBQCReportData> dataList = JsonConvert.DeserializeObject <List <GDTXUserYSBQCReportData> >(gr.Data.ToString());
                foreach (GDTXUserYSBQCReportData data in dataList)
                {
                    if (data.DataKey == dataKey)
                    {
                        continue;
                    }
                    GTXNameValue data_nv = new GTXNameValue();
                    data_nv.key   = data.DataKey;
                    data_nv.value = HttpUtility.UrlEncode(data.DataValue);
                    nameList.Add(data_nv);
                }
            }
            GTXResult saveresult = GTXMethod.SaveUserReportData(JsonConvert.SerializeObject(nameList), userYsbqcId, reportCode);

            return(saveresult);
        }
Beispiel #2
0
        public string getUserYSBQCReportData_String(int id, string reportCode, string dataKey = "data")
        {
            string    re_str = "";
            GTXResult gr     = GTXMethod.GetUserReportData(id.ToString(), reportCode);

            if (gr.IsSuccess)
            {
                List <GDTXUserYSBQCReportData> dataList = JsonConvert.DeserializeObject <List <GDTXUserYSBQCReportData> >(gr.Data.ToString());
                if (dataList.Count > 0)
                {
                    byte[] outputb   = Convert.FromBase64String(dataList[0].DataValue);
                    string dataValue = Encoding.Default.GetString(outputb);
                    re_str = dataValue;
                }
            }
            return(re_str);
        }
Beispiel #3
0
        public JToken getUserYSBQCReportData(int id, string reportCode, string dataKey = "data")
        {
            GTXResult gr = GTXMethod.GetUserReportData(id.ToString(), reportCode);

            if (gr.IsSuccess)
            {
                List <GDTXUserYSBQCReportData> dataList = JsonConvert.DeserializeObject <List <GDTXUserYSBQCReportData> >(gr.Data.ToString());
                if (dataList.Count > 0)
                {
                    GDTXUserYSBQCReportData data = dataList.Where(a => a.DataKey == dataKey).FirstOrDefault();
                    byte[] outputb   = Convert.FromBase64String(data.DataValue);
                    string dataValue = Encoding.Default.GetString(outputb);
                    JToken re_json   = JsonConvert.DeserializeObject <JToken>(dataValue);
                    return(re_json);
                }
            }
            return(JToken.FromObject(new object()));
        }