Exemple #1
0
        public async Task <System.Collections.ObjectModel.ObservableCollection <BusinessLogic.Portable.SSModels.Supplier> > GetSuppliersByClassAsync(string classId, BusinessLogic.Portable.SSModels.UserInfo userInfo)
        {
            try
            {
                var postData = new { target = "ServiceScheduling", parameters = new[] { "GetSuppliersByClass", classId, Newtonsoft.Json.JsonConvert.SerializeObject(userInfo) } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <ObservableCollection <Supplier> >(await response.Content.ReadAsStringAsync()));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            return(null);
        }
Exemple #2
0
        public async Task <bool> InsertServiceDetailsAsync(BusinessLogic.Portable.SSModels.ServiceSchedulingDetail serviceSchedulingDetail, BusinessLogic.Portable.SSModels.Address address, BusinessLogic.Portable.SSModels.UserInfo userInfo)
        {
            try
            {
                var postData = new { target = "ServiceScheduling", method = "save", parameters = new[] { "InsertServiceDetails", JsonConvert.SerializeObject(serviceSchedulingDetail), JsonConvert.SerializeObject(address), JsonConvert.SerializeObject(userInfo) } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <bool>(await response.Content.ReadAsStringAsync()));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }
            return(false);
        }
Exemple #3
0
        async public Task <ObservableCollection <TITask> > GetTasksAsync(string userId, string companyId)
        {
            try
            {
                var postData = new { target = "TechnicalInspection", parameters = new[] { "GetTasks", userId, companyId } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <ObservableCollection <TITask> >(await response.Content.ReadAsStringAsync()));
                }
                return(null);
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
                return(null);
            }
        }
Exemple #4
0
        async public Task <UserInfo> GetUserInfoAsync(string userId)
        {
            try
            {
                var postData = new { target = "ServiceScheduling", method = "single", parameters = new[] { "GetUserInfo", userId } };
                var response = await _httpFactory.PostAsync(new HttpStringContent(JsonConvert.SerializeObject(postData), Windows.Storage.Streams.UnicodeEncoding.Utf8, "application/json"));

                response.EnsureSuccessStatusCode();
                if (response.IsSuccessStatusCode)
                {
                    return(JsonConvert.DeserializeObject <UserInfo>(await response.Content.ReadAsStringAsync()));
                }
            }
            catch (Exception ex)
            {
                new MessageDialog(ex.Message).ShowAsync();
            }

            return(null);
        }