public async Task<Model.RootObject_QuerySubmitResponse> SendQuery(string category, string mobileNo, string email, string fieldQuery, string placeholderQuery)// New Query { try { QueryResponse = new Model.RootObject_QuerySubmitResponse(); if (UtilityClasses.Network.checkNetwork()) { if (UtilityClasses.MKValidations.isValidMobileNumber(mobileNo) && fieldQuery.Trim().Length > 0 && !fieldQuery.Equals(placeholderQuery)) { var deviceInformation = new EasClientDeviceInformation(); String url = UtilityClasses.Network.URL_HOST_MOBIKWIK + "sendSupport.do?ticket=new&category=" + category + "&cell=" + mobileNumber + "&email=" + email + "&clientId=" + deviceInformation.Id.ToString() + "&issue=" + UtilityClasses.Network.encode(fieldQuery); sc = new UtilityClasses.ServerCall(); string content = await sc.GetjsonStream(url);// uncomment after testing //comment after testing //var res = App.GetResourceStream(new Uri("ResponseFAQ_Chat.txt", UriKind.Relative));//comment after testing //var content = new StreamReader(res.Stream).ReadToEnd().Trim();//comment after testing QueryResponse = JsonConvert.DeserializeObject<Model.RootObject_QuerySubmitResponse>(content); } } } catch (Exception ex) { //List<Parameter> Params = new List<Parameter>(); //Params.Add(AccountFunctions.createParameter("Location", "ViewModel FAQ PastIssues")); //Params.Add(AccountFunctions.createParameter("Method", "SendQuery, Error:" + ex.Message)); //FlurryWP8SDK.Api.LogEvent("FAQ Exception", Params); } return QueryResponse; }
public async void SendUserQuery() { try { if (MKValidations.isValidMobileNumber(mobileNo) && fieldQuery.Text.Trim().Length > MinimumCharacter && !fieldQuery.Text.Equals(placeholderQuery)) { ViewModel_PhoneUI.UIFunctions.showProgressIndicator("Submitting your query..."); ViewModel_PhoneUI.UIFunctions.ShowOverlay(ContentOverlay); disableApplicationBar(); // BackEnabled = false; // need to update if (Account.Category == string.Empty) Account.Category = "Others"; Model.RootObject_QuerySubmitResponse response = new Model.RootObject_QuerySubmitResponse(); vm = new ViewModel.VM_faq_PastIssues(); response = await vm.SendQuery(Account.Category, mobileNo, email, fieldQuery.Text.Trim(), placeholderQuery); enableApplicationBar(); ViewModel_PhoneUI.UIFunctions.HideOverlay(ContentOverlay); ViewModel_PhoneUI.UIFunctions.hideProgressIndicator(); BackEnabled = true; if (response.status != null) if (String.Equals(response.status, "error", StringComparison.OrdinalIgnoreCase)) { showMessage("Sorry", response.body.id, 0); //if (res != null) // this.NavigationService.GoBack(); } else//response.status, "ok" { showMessage("Ticket id: " + response.body.id, "Thank you, We will get back to you shortly!", 1); //NavigationService.Navigate(new Uri("/Views/FAQ_Chat.xaml?Ticket=" + response.body.id + "&UserChat=" + fieldQuery.Text.Trim() + "&MobikwikChat=" + response.body.message, UriKind.Relative)); } else ViewModel_PhoneUI.UIFunctions.showMessage(Network.CHECK_CONNECTION_MESSAGE); } else { showMessage("Invalid input", "Please enter a valid query with minimum 20 characters. ", 0);//Code for suitable Navigation } } catch (Exception ex) { //List<Parameter> Params = new List<Parameter>(); //Params.Add(AccountFunctions.createParameter("Location", "Help")); //Params.Add(AccountFunctions.createParameter("Method", "Send User Query, Error:" + ex.Message)); //FlurryWP8SDK.Api.LogEvent("FAQ Exception", Params); } }