예제 #1
0
        public static UserInfo Signin(string accountName, string email, string password)
        {
            try
            {
                AuthenticatedServiceRequest <SingleItemServiceResponse <UserInfo> > request = new AuthenticatedServiceRequest <SingleItemServiceResponse <UserInfo> >(serviceUrl + getAC);

                request.QueryStringParams.Add("_accountName", accountName);

                HttpContext.Current.Session["AccountId"] = "0";
                var r1 = request.GetAsync();
                if (r1.statusId != "1")
                {
                    return(null);
                }
                UserInfo firstResponse = r1.record;
                AuthenticatedServiceRequest <SingleItemServiceResponse <UserInfo> > secondRequest = new AuthenticatedServiceRequest <SingleItemServiceResponse <UserInfo> >(serviceUrl + signIn);
                secondRequest.QueryStringParams.Add("_email", email);
                secondRequest.QueryStringParams.Add("_password", password);
                HttpContext.Current.Session["AccountId"] = firstResponse.accountId;
                var r2 = secondRequest.GetAsync();
                if (r2.statusId != "1")
                {
                    return(null);
                }
                UserInfo response = r2.record;
                return(response);
            }
            catch
            {
                return(null);
            }
        }
예제 #2
0
        public static Employee GetEmployee(string empId)
        {
            AuthenticatedServiceRequest <SingleItemServiceResponse <Employee> > req = new AuthenticatedServiceRequest <SingleItemServiceResponse <Employee> >(serviceUrl + getEM);

            req.QueryStringParams.Add("_recordId", empId);
            var s = req.GetAsync();

            return(s.record);
        }