Ejemplo n.º 1
0
        //payments
        public async Task <List <PaymentsSts> > GetPaymentsByAgentId(int agentId)
        {
            List <PaymentsSts>          list       = new List <PaymentsSts>();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("agentId", agentId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetPaymentsByAgentId", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    list.Add(JsonConvert.DeserializeObject <PaymentsSts>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    }));
                }
            }
            return(list);
        }
Ejemplo n.º 2
0
        public async Task <int> GetLastNum(string Code, int agentId)
        {
            int count = 0;
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Code", Code);
            parameters.Add("agentId", agentId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList("packageUser/GetLastNum", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    count = int.Parse(c.Value);
                    break;
                }
            }
            return(count);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// ///////////////////////////////////////
        /// </summary>
        /// <returns></returns>
        ///

        public async Task <List <Versions> > GetAll()
        {
            List <Versions> list = new List <Versions>();

            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetAll");

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

            //List<Versions> memberships = null;

            //HttpResponseMessage response = new HttpResponseMessage();
            //using (var client = new HttpClient())
            //{
            //    Uri uri = new Uri(Global.APIUri + urimainpath + "GetAll");
            //    response = await ApiConnect.ApiGetConnect(uri);

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

            //        memberships = JsonConvert.DeserializeObject<List<Versions>>(jsonString);

            //        return memberships;
            //    }
            //    else //web api sent error response
            //    {
            //        memberships = new List<Versions>();
            //    }
            //    return memberships;
            //}
        }
Ejemplo n.º 4
0
        public async Task <Programs> GetByID(int programId)
        {
            Programs item = new Programs();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("programId", programId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetByID", parameters);

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


            return(item);
            //Programs obj = new Programs();

            //HttpResponseMessage response = new HttpResponseMessage();
            //using (var client = new HttpClient())
            //{

            //    Uri uri = new Uri(Global.APIUri + urimainpath + "GetByID?programId=" + programId);

            //    response = await ApiConnect.ApiGetConnect(uri);
            //    if (response.IsSuccessStatusCode)
            //    {
            //       var jsonString = await response.Content.ReadAsStringAsync();
            //        obj = JsonConvert.DeserializeObject<Programs>(jsonString);
            //        return obj;
            //    }

            //    return obj;
            //}
        }
Ejemplo n.º 5
0
        public async Task <int> Save(UsersLogs obj)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();
            string method = "UsersLogs/Save";

            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(obj);

            //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 + "UsersLogs/Save?Object=" + 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 "";
            //}
        }
Ejemplo n.º 6
0
        /// <summary>
        /// ///////////////////////////////////////
        /// </summary>
        /// <returns></returns>
        ///

        public async Task <List <AgentPackage> > GetAll()
        {
            List <AgentPackage> list = new List <AgentPackage>();
            //  Dictionary<string, string> parameters = new Dictionary<string, string>();
            //parameters.Add("mainBranchId", mainBranchId.ToString());
            //parameters.Add("userId", userId.ToString());
            //parameters.Add("date", date.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetAll");

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    list.Add(JsonConvert.DeserializeObject <AgentPackage>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    }));
                }
            }
            return(list);
        }
Ejemplo n.º 7
0
        public async Task <List <CountryPackageDate> > GetByCustomerPackId(int customerId, int packageId)
        {
            List <CountryPackageDate>   list       = new List <CountryPackageDate>();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("customerId", customerId.ToString());
            parameters.Add("packageId", packageId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetByCustomerPackId", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    list.Add(JsonConvert.DeserializeObject <CountryPackageDate>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    }));
                }
            }
            return(list);
        }
Ejemplo n.º 8
0
        public async Task <int> updatecustomerdata(SendDetail SendDetaildata, string activeState)
        {
            int item = 0;
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            var myContent3 = JsonConvert.SerializeObject(SendDetaildata);

            parameters.Add("object", myContent3);
            parameters.Add("activeState", activeState);
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "updatecustomerdata", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = int.Parse(c.Value);
                }
            }
            return(item);
        }
Ejemplo n.º 9
0
        public async Task <GroupObject> GetByID(int valId)
        {
            GroupObject item = new GroupObject();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

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

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <GroupObject>(c.Value, new IsoDateTimeConverter {
                        DateTimeFormat = "dd/MM/yyyy"
                    });
                    break;
                }
            }
            return(item);
        }
Ejemplo n.º 10
0
        public async Task <string> isExistCode(string packageCode)
        {
            string item = "";
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("packageCode", packageCode);
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "isExistCode", parameters);

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

            return(item);

            //string obj = "";

            //HttpResponseMessage response = new HttpResponseMessage();
            //using (var client = new HttpClient())
            //{

            //    Uri uri = new Uri(Global.APIUri + urimainpath + "isExistCode?packageCode=" + packageCode);

            //    response = await ApiConnect.ApiGetConnect(uri);
            //    if (response.IsSuccessStatusCode)
            //    {
            //        var jsonString = await response.Content.ReadAsStringAsync();
            //        obj = JsonConvert.DeserializeObject<string>(jsonString);
            //        return obj;
            //    }

            //    return obj;
            //}
        }
Ejemplo n.º 11
0
        public async Task <SendDetail> ActivateServerOffline(int packageUserId, string activeState)
        {
            SendDetail item = new SendDetail();
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("packageUserId", packageUserId.ToString());
            parameters.Add("activeState", activeState);

            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "ActivateServerOffline", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <SendDetail>(c.Value, new JsonSerializerSettings {
                        DateParseHandling = DateParseHandling.None
                    });
                }
            }
            return(item);
        }
Ejemplo n.º 12
0
        public async Task <SendDetail> Activateserver(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(urimainpath + "ActivateServer", parameters);

            foreach (Claim c in claims)
            {
                if (c.Type == "scopes")
                {
                    item = JsonConvert.DeserializeObject <SendDetail>(c.Value, new JsonSerializerSettings {
                        DateParseHandling = DateParseHandling.None
                    });
                }
            }
            return(item);
        }
Ejemplo n.º 13
0
        public async Task <PayOp> getLastPayOp(int packageUserId)
        {
            PayOp item = new PayOp();

            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("packageUserId", packageUserId.ToString());
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "getLastPayOp", parameters);

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

            return(item);
        }
Ejemplo n.º 14
0
        public async Task <int> GetLastNumOfCode(string type)
        {
            int item = 0;
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("type", type);
            //#################
            IEnumerable <Claim> claims = await APIResult.getList(urimainpath + "GetLastNumOfCode", parameters);

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

            return(item);

            //HttpResponseMessage response = new HttpResponseMessage();
            //using (var client = new HttpClient())
            //{

            //    Uri uri = new Uri(Global.APIUri + urimainpath + "GetLastNumOfCode?type=" + type);

            //    response = await ApiConnect.ApiGetConnect(uri);
            //    if (response.IsSuccessStatusCode)
            //    {
            //        string message = await response.Content.ReadAsStringAsync();
            //        message = JsonConvert.DeserializeObject<string>(message);
            //        return int.Parse(message);
            //    }
            //    return 0;
            //}
        }