Beispiel #1
0
        public async Task <SetValues> GetByID(int valId)
        {
            SetValues item = new SetValues();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Id", valId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList("setValues/GetByID", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <SetValues>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    });
                    break;
                }
            }
            return(item);


            //SetValues Object = new SetValues();

            //// ... Use HttpClient.
            //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
            //using (var client = new HttpClient())
            //{
            //    ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            //    client.BaseAddress = new Uri(Global.APIUri);
            //    client.DefaultRequestHeaders.Clear();
            //    client.DefaultRequestHeaders.Add("Connection", "Keep-Alive");
            //    client.DefaultRequestHeaders.Add("Keep-Alive", "3600");
            //    HttpRequestMessage request = new HttpRequestMessage();
            //    request.RequestUri = new Uri(Global.APIUri + "setValues/GetByID");
            //    request.Headers.Add("Id", valId.ToString());
            //    request.Headers.Add("APIKey", Global.APIKey);
            //    request.Method = HttpMethod.Get;
            //    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            //    var response = await client.SendAsync(request);

            //    if (response.IsSuccessStatusCode)
            //    {
            //        var jsonString = await response.Content.ReadAsStringAsync();

            //        Object = JsonConvert.DeserializeObject<SetValues>(jsonString);

            //        return Object;
            //    }

            //    return Object;
            //}
        }
Beispiel #2
0
        // email
        public async Task <int> SaveValueByNotes(SetValues obj)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string method = "setValues/SaveValueByNotes";

            var myContent = JsonConvert.SerializeObject(obj);

            parameters.Add("Object", myContent);
            return(await APIResult.post(method, parameters));



            //// ... Use HttpClient.
            //ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
            ////
            //var myContent = JsonConvert.SerializeObject(newObject);

            //using (var client = new HttpClient())
            //{
            //    ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
            //    client.BaseAddress = new Uri(Global.APIUri);
            //    client.DefaultRequestHeaders.Clear();
            //    client.DefaultRequestHeaders.Add("Connection", "Keep-Alive");
            //    client.DefaultRequestHeaders.Add("Keep-Alive", "3600");
            //    HttpRequestMessage request = new HttpRequestMessage();
            //    // encoding parameter to get special characters
            //    myContent = HttpUtility.UrlEncode(myContent);
            //    request.RequestUri = new Uri(Global.APIUri
            //                                 + "setValues/SaveValueByNotes?newObject="
            //                                 + myContent);
            //    request.Headers.Add("APIKey", Global.APIKey);
            //    request.Method = HttpMethod.Post;
            //    //set content type
            //    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            //    var response = await client.SendAsync(request);

            //    if (response.IsSuccessStatusCode)
            //    {
            //        var message = await response.Content.ReadAsStringAsync();
            //        message = JsonConvert.DeserializeObject<string>(message);
            //        return message;
            //    }
            //    return "";
            //}
        }
Beispiel #3
0
        //public async Task<SendDetail> GetSerialsAndDetails(string packageSaleCode, string customerServerCode)
        //{
        //    SendDetail item = new SendDetail();
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("packageSaleCode", packageSaleCode);
        //    parameters.Add("customerServerCode", customerServerCode);

        //    //#################
        //    IEnumerable<Claim> claims = await APIResult.getList("packageUser/ActivateServer", parameters);

        //    foreach (Claim c in claims)
        //    {
        //        if (c.Type == "scopes")
        //        {
        //            item = JsonConvert.DeserializeObject<SendDetail>(c.Value, new JsonSerializerSettings { DateParseHandling = DateParseHandling.None });

        //        }
        //    }
        //    return item;

        //}

        // checkincconn

        //public async Task<string> checkincconn()
        //{

        //    string item = "";

        //    //#################
        //    IEnumerable<Claim> claims = await APIResult.getList("Activate/checkincconn");

        //    foreach (Claim c in claims)
        //    {
        //        if (c.Type == "scopes")
        //        {
        //            item = c.Value;
        //            break;
        //        }
        //    }
        //    return item;



        //}
        public async Task <SetValues> getactivesite( )
        {
            SetValues item = new SetValues();


            //#################
            IEnumerable <Claim> claims = await APIResult.getList("Activate/getactivesite");

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <SetValues>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    });
                    break;
                }
            }
            return(item);
        }