예제 #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;
            }
        }
예제 #2
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);
        }
예제 #3
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));
            }
        }