Exemplo n.º 1
0
        public static async Task <List <TSUserOpenEx> > CmdGetLiveUsers()
        {
            try
            {
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);



                List <TSUserOpenEx> result = await httpClient.MyGetJsonAsync <List <TSUserOpenEx> >("user/getliveusers");

                foreach (var item in result)
                {
                    GlobalFunctions.CmdAdjustDate(item, false);
                }

                return(result);
            }
            catch (Exception ex)
            {
                LocalFunctions.AddError(ex.Message, MethodBase.GetCurrentMethod(), true, false);
                return(new List <TSUserOpenEx>());
            }
        }
Exemplo n.º 2
0
        public static async Task CmdGetFeedback()
        {
            try
            {
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);


                LocalData.currFeedback = await httpClient.MyGetJsonAsync <TSFeedback>("feedback/get");

                if (!LocalData.currFeedback.UserID.Equals(Guid.Empty))
                {
                    GlobalFunctions.CmdAdjustDate(LocalData.currFeedback, false);
                }


                if (string.IsNullOrEmpty(LocalData.currFeedback.Text))
                {
                    LocalData.oldFeedbackText = string.Empty;
                }
                else
                {
                    LocalData.oldFeedbackText = LocalData.currFeedback.Text.ToLower();
                }
            }
            catch (Exception ex)
            {
                LocalFunctions.AddError(ex.Message, MethodBase.GetCurrentMethod(), true, false);
                LocalData.currFeedback = new TSFeedback();
            }
        }
Exemplo n.º 3
0
        public static async Task <List <TSFeedbackEx> > CmdGetAllFeedback()
        {
            try
            {
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);


                List <TSFeedbackEx> result = await httpClient.MyGetJsonAsync <List <TSFeedbackEx> >("feedback/getAll");



                foreach (var item in result)
                {
                    GlobalFunctions.CmdAdjustDate(item, false);
                }


                for (int i = 0; i < result.Count; i++)
                {
                    result[i].N = i + 1;
                }

                return(result);
            }
            catch (Exception ex)
            {
                LocalFunctions.AddError(ex.Message, MethodBase.GetCurrentMethod(), true, false);
                return(new List <TSFeedbackEx>());
            }
        }
Exemplo n.º 4
0
        public static async Task <string> CmdUpdateTodo(TSTodo ParTSTodo)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);

            GlobalFunctions.CmdTrimEntity(ParTSTodo);

            TSTodo tsTodoForSend = GlobalFunctions.CopyObject <TSTodo>(ParTSTodo);

            GlobalFunctions.CmdAdjustDate(tsTodoForSend, true);


            string result = await httpClient.PutJsonAsync <string>("todo/update", tsTodoForSend);


            httpClient.DefaultRequestHeaders.Accept.Clear();


            return(result);
        }
Exemplo n.º 5
0
        public static async Task <TSUser> CmdTSUserAuthorize(TSUser ParTSUser)
        {
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", LocalData.CurrJWT);
            try
            {
                TSUser result = await httpClient.MyPostJsonGetJsonAsync("user/authorize", ParTSUser);


                GlobalFunctions.CmdAdjustDate(result, false);

                return(result);
            }
            catch (Exception ex)
            {
                LocalFunctions.AddError(ex.Message, MethodBase.GetCurrentMethod(), true, false);
            }

            return(new TSUser());
        }