Пример #1
0
        /// <summary>
        /// Returns authentication details and infos of the current user
        /// </summary>
        /// <returns></returns>
        public async Task <List <UserEntry> > GetAuthenticationtDetails(string pUserName, string pAssword)
        {
            List <UserEntry> accountlist = new List <UserEntry>();

            using (var webclient = new AuthorizedHttpClient("", new Uri("https://authenticate.teamwork.com/")))
            {
                var data = await webclient.GetListAsync <UserEntry>(@"accounts/search.json?email=" + pUserName + "&password="******"accounts", null);

                if (data.StatusCode == HttpStatusCode.OK)
                {
                    accountlist.AddRange(data.List);
                }
                else
                {
                    throw new Exception(data.Status + " " + data.Message);
                }
            }



            using (var webclient = new AuthorizedHttpClient("", new Uri("https://authenticate.eu.teamwork.com/")))
            {
                var data = await webclient.GetListAsync <UserEntry>(@"accounts/search.json?email=" + pUserName + "&password="******"accounts", null);

                if (data.StatusCode == HttpStatusCode.OK)
                {
                    foreach (var acc in data.List)
                    {
                        acc.companyname = acc.companyname + "-EU";
                    }
                    accountlist.AddRange(data.List);
                }
                else
                {
                    throw new Exception(data.Status + " " + data.Message);
                }
            }

            if (accountlist.Count > 0)
            {
                return(accountlist);
            }
            throw new Exception("No Login found");
        }
Пример #2
0
        /// <summary>
        /// Returns authentication details and infos of the current user
        /// </summary>
        /// <returns></returns>
        public async Task <List <UserEntry> > GetAuthenticationtDetailsTest(string pUserName, string pAssword)
        {
            List <UserEntry> accountlist = new List <UserEntry>();

            using (var webclient = new AuthorizedHttpClient("", new Uri("http://sunbeam.teamwork.dev/")))
            {
                var data = await webclient.GetListAsync <UserEntry>(@"accounts/search.json?email=" + pUserName + "&password="******"accounts", null);

                if (data.StatusCode == HttpStatusCode.OK)
                {
                    accountlist.AddRange(data.List);
                }
                else
                {
                    throw new Exception(data.Status + " " + data.Message);
                }
            }

            if (accountlist.Count > 0)
            {
                return(accountlist);
            }
            throw new Exception("No Login found");
        }