Ejemplo n.º 1
0
        public async Task <ResponseModel> TestAuthAsync()
        {
            try
            {
                string returnedData = "";
                string tokenValue   = "";

                HttpContent content = new FormUrlEncodedContent(new Dictionary <string, string> {
                    { "userID", "0000100099" }, { "password", "Slloancare@1" }
                });
                ResponseWithToken response2 = await API_Connection.PostAsync("/api/Auth/Authenticate", content);

                tokenValue = response2.tokenValue;

                var response3 = await API_Connection.GetAsync(tokenValue, "/api/MyAccount/GetAccountInfo/0000100099");

                returnedData = await response3.Content.ReadAsStringAsync();

                return(new ResponseModel(returnedData));
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public async Task <ResponseWithToken> AuthenticateAsync(string userName, string password)
        {
            HttpContent       content;
            ResponseWithToken response;
            Payment           AuthUser = new Payment();

            AuthUser.loan_number = "";
            try
            {
                content = new FormUrlEncodedContent(new Dictionary <string, string> {
                    { "userID", userName }, { "password", password }, { "ssn", "" }
                });
                response = await API_Connection.PostAsync("/api/Auth/Authenticate", content);



                return(response);
            }
            catch (Exception Ex)
            {
                response = new ResponseWithToken();
                response.errorMessage = "Problem occurred trying to validate the user credentials. Please try again.";
                return(response);
            }
        }
Ejemplo n.º 3
0
    // Gets story mode question by its ID
    public IEnumerator getStoryQ(string storyModeQuestionId)
    {
        getStoryQDone = false;
        API_Connection conn = new API_Connection();

        yield return(StartCoroutine(conn.GetData("StoryModeQuestion/" + storyModeQuestionId, null, s => {
            jsonNodeStoryQ = JSON.Parse(s);
        })));

        getStoryQDone = true;
    }
Ejemplo n.º 4
0
    // Deletes a story mode question
    public IEnumerator deleteStoryQ(StoryModeQuestion storyModeQ)
    {
        deleteStoryQDone = false;
        API_Connection conn = new API_Connection();

        yield return(StartCoroutine(conn.DeleteData("StoryModeQuestion/" + storyModeQ.storyModeQuestionId, s => {
            Debug.Log(JSON.Parse(s));
        })));

        deleteStoryQDone = true;
    }
Ejemplo n.º 5
0
        public async Task <string> trackinglog(string lcAuthToken, string log, string resourcename)
        {
            var eventId    = 1;
            var toEmail    = "";
            var actionName = "VIEW";

            var trackresponse = await API_Connection.GetAsync(lcAuthToken, "/api/Helper/AddTrackingInfo/?eventId=" + eventId + "&resourceName=" + resourcename + "&toEmail=" + toEmail + "&log=" + log + "&actionName=" + actionName);

            string returnedData = await trackresponse.Content.ReadAsStringAsync();

            return(returnedData);
        }
Ejemplo n.º 6
0
    // Adds a story mode question
    public IEnumerator addStoryQ(StoryModeQuestion storyModeQ)
    {
        addStoryQDone = false;
        API_Connection conn       = new API_Connection();
        string         jsonString = JsonUtility.ToJson(storyModeQ);

        yield return(StartCoroutine(conn.PostData("StoryModeQuestion/", jsonString, s => {
            storyModeQ.storyModeQuestionId = JSON.Parse(s);
        })));

        addStoryQDone = true;
    }
Ejemplo n.º 7
0
    // Updates an existing story mode question
    public IEnumerator updateStoryQ(StoryModeQuestion storyModeQ)
    {
        updateStoryQDone = false;
        API_Connection conn       = new API_Connection();
        string         jsonString = JsonUtility.ToJson(storyModeQ);

        yield return(StartCoroutine(conn.PutData("StoryModeQuestion/" + storyModeQ.storyModeQuestionId, jsonString, s => {
            Debug.Log(JSON.Parse(s));
        })));

        updateStoryQDone = true;
    }
Ejemplo n.º 8
0
    // Updates Existing Assignment
    public IEnumerator updateAssignment(Assignment asg)
    {
        asgUpdateDone = false;
        API_Connection conn       = new API_Connection();
        string         jsonString = JsonUtility.ToJson(asg);

        yield return(StartCoroutine(conn.PutData("assignment/" + asg.assignmentId, jsonString, s => {
            print(JSON.Parse(s));
        })));

        asgUpdateDone = true;
    }
Ejemplo n.º 9
0
    // Update an assignment question
    public IEnumerator updateQuestion(AssignmentQuestion asgQuestion)
    {
        asgQUpdateDone = false;
        API_Connection conn       = new API_Connection();
        string         jsonString = JsonUtility.ToJson(asgQuestion);

        yield return(StartCoroutine(conn.PutData("assignmentQUestion/" + asgQuestion.assignmentQuestionId, jsonString, s => {
            print(JSON.Parse(s) == asgQuestion.assignmentQuestionId);
        })));

        asgQUpdateDone = true;
    }
Ejemplo n.º 10
0
    // Add an assignment question to an assignment
    public IEnumerator addQuestion(Assignment asg, AssignmentQuestion asgQuestion)
    {
        asgQAddDone = false;
        API_Connection conn       = new API_Connection();
        string         jsonString = JsonUtility.ToJson(asgQuestion);

        yield return(StartCoroutine(conn.PutData("assignment/" + asg.assignmentId + "/addQuestion", jsonString, s => {
            asgQuestion.assignmentQuestionId = JSON.Parse(s);
        })));

        asgQAddDone = true;
    }
Ejemplo n.º 11
0
    // GET an Assignment Question
    public IEnumerator getAssignmentQuestion(string assignmentQuestionId)
    {
        JSONNode       jsonNode = null;
        API_Connection conn     = new API_Connection();

        asgQRequestDone = false;
        yield return(StartCoroutine(conn.GetData("assignmentQuestion/" + assignmentQuestionId, null, s => {    // change link
            jsonNode = JSON.Parse(s);
            jsonNodeAsgQ.Add(jsonNode);
        })));

        asgQRequestDone = true;
    }
Ejemplo n.º 12
0
    // Delete Assignment
    public IEnumerator deleteAssignment(Assignment asg)
    {
        asgDeleteDone = false;
        API_Connection conn = new API_Connection();

        yield return(StartCoroutine(conn.DeleteData("assignment/" + asg.assignmentId, s => {
            print(JSON.Parse(s));
        })));

        yield return(null);

        asgQDeleteDone = true;
    }
Ejemplo n.º 13
0
    // Adds assignment
    public IEnumerator addAssignment(Assignment asg, List <AssignmentQuestion> asgQuestions)
    {
        asgAddDone = false;
        API_Connection   conn       = new API_Connection();
        AssignmentForAPI asgAPI     = new AssignmentForAPI(asg, asgQuestions);
        string           jsonString = JsonUtility.ToJson(asgAPI);

        yield return(StartCoroutine(conn.PostData("assignment/", jsonString, s => {
            print(JSON.Parse(s));
        })));

        asgQAddDone = true;
    }
Ejemplo n.º 14
0
    // Obtains assignment list from backend
    IEnumerator setAssignmentList()
    {
        API_Connection conn     = new API_Connection();
        JSONNode       jsonNode = null;

        yield return(StartCoroutine(conn.GetData("Assignment", null, s => {
            jsonNode = JSON.Parse(s);
        })));

        assignmentList = new List <Assignment>();
        for (int i = 0; i < jsonNode.Count; i++)
        {
            assignmentList.Add(new Assignment(jsonNode[i]));
        }
    }
Ejemplo n.º 15
0
    // Get a list of assignment questions
    public IEnumerator getAssignmentQuestionList(Assignment asg)
    {
        JSONNode       jsonNode = null;
        API_Connection conn     = new API_Connection();

        asgQListRequestDone = false;
        Dictionary <string, string> queryParams = new Dictionary <string, string>();

        queryParams.Add("assignmentId", asg.assignmentId);
        yield return(StartCoroutine(conn.GetData("assignmentQuestion/", queryParams, s => {    // change link
            jsonNode = JSON.Parse(s);
            jsonNodeAsgQ.Add(jsonNode);
        })));

        asgQListRequestDone = true;
    }
Ejemplo n.º 16
0
        public async Task <ResponseModel> GetHolidayListAsync(string MobileToken)
        {
            // To do - Use DI

            try
            {
                TokenServices tokenServices = new TokenServices();
                string        lcToken       = tokenServices.GetLctoken(MobileToken);

                var response = await API_Connection.GetAsync(lcToken, "/api/OnetimePayment/GetHolidayList");

                string returnedData = await response.Content.ReadAsStringAsync();

                var HolidaysLis = JsonConvert.DeserializeObject <List <Holidays> >(returnedData);

                DateTime calenderData = new DateTime();

                List <DateTime> calenderDataList = new List <DateTime>();

                foreach (var h_list in HolidaysLis)
                {
                    if (h_list.h_Date == null)
                    {
                        h_list.h_Date = System.DateTime.Now;
                    }

                    calenderData = h_list.h_Date;

                    calenderDataList.Add(calenderData);
                }

                return(new ResponseModel(calenderDataList));
            }
            catch (Exception ex)
            {
                return(new ResponseModel(null, 1, ex.Message));
            }
        }