public async Task<List<Model_Offers>> GetOffers(bool newUser,bool allowCaching)
        {
            QueryResponse = new OfferResponse();
            try
            {
                string Url;
                if (newUser)
                    Url = Network.URL_HOST_MOBIKWIK + Network.URL_ACTION_READ_FILE + "?id=newuser" + "&clientId=8";
                else
                    Url = Network.URL_HOST_MOBIKWIK + Network.URL_ACTION_OFFERS + "?context=products&clientId=6";

                sc = new ServerCall();

                if (allowCaching == false)
                    Url = Network.addParamToUri(Url, "disablecache", Environment.TickCount.ToString());


                string Response = await sc.GetjsonStream(Url);
                if (Response.Length > 0 & MKValidations.isValidJson(Response))
                    QueryResponse = JsonConvert.DeserializeObject<OfferResponse>(Response);
            }
            catch (Exception ex)
            {
                //use ex
            }
            return QueryResponse.data;
        }
        public async Task<Model.RootObject_ReOpenIssue> ReOpenTicket(string fieldQuery, Int32 ParentTicketID)// reopen Query
        {
            Model.RootObject_ReOpenIssue QueryResponse_reOpen = new Model.RootObject_ReOpenIssue();
            if (UtilityClasses.Network.checkNetwork())
            {

                mobileNumber = UtilityClasses.Account.readLocalData(UtilityClasses.Connection.KEY_LOCAL_STORAGE_PRIMARY_NUM);

                if (UtilityClasses.MKValidations.isValidMobileNumber(mobileNumber) && fieldQuery.Trim().Length > 0)
                {
                    //[email protected]&pwd=Aman1975&action=reply&id=3171&comment=This%20is%20testing%20API
                    String url = UtilityClasses.Network.URL_HOST_MOBIKWIK
                        + UtilityClasses.Network.URL_REPLY_TICKET + "?action=reply&uid=" + UtilityClasses.Account.UserId + "&pwd=" + UtilityClasses.Account.Password + "&id=" + ParentTicketID + "&comment=" + UtilityClasses.Network.encode(fieldQuery);

                    sc = new UtilityClasses.ServerCall();
                    string content = await sc.GetjsonStream(url);// uncomment after testing

                    QueryResponse_reOpen = JsonConvert.DeserializeObject<Model.RootObject_ReOpenIssue>(content);

                }
            }
            return QueryResponse_reOpen;
        }
        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 Task<Model.RootObject_Chat> GetFAQ_PastIssues()
        {
            answere = new Model.RootObject_Chat();
            try
            {
                UserId = UtilityClasses.Account.UserId;
                String url = UtilityClasses.Network.URL_HOST_MOBIKWIK + UtilityClasses.Network.URL_PAST_ISSUES + "?uid=" + UtilityClasses.Account.UserId + "&pwd=" + UtilityClasses.Account.Password;
                url = UtilityClasses.Network.addParamToUri(url, "disablecache", Environment.TickCount.ToString());//To disable caching in Windows OS 
                sc = new UtilityClasses.ServerCall();
                string content = await sc.GetjsonStream(url);

                answere = JsonConvert.DeserializeObject<Model.RootObject_Chat>(content);

                UtilityClasses.Account.KEY_TICKET = new Model.RootObject_Chat();
                UtilityClasses.Account.KEY_TICKET = answere;
                return answere;

            }
            catch (Exception ex)
            {

                //List<Parameter> Params = new List<Parameter>();
                //Params.Add(AccountFunctions.createParameter("Location", "ViewModel FAQ PastIssues"));
                //Params.Add(AccountFunctions.createParameter("Method", "GetFaq PastIssues, Error:" + ex.Message));
                //FlurryWP8SDK.Api.LogEvent("FAQ Exception", Params);
                return null;
            }

        }
        public async Task<int> CloseTicket(Int32 id) // check by server
        {
            String url = UtilityClasses.Network.URL_HOST_MOBIKWIK + UtilityClasses.Network.URL_REPLY_TICKET + "?uid=" + UtilityClasses.Account.UserId + "&pwd=" + UtilityClasses.Account.Password + "&action=close&id=" + id;
            sc = new UtilityClasses.ServerCall();
            string content = await sc.GetjsonStream(url);
            answere = JsonConvert.DeserializeObject<Model.RootObject_Chat>(content);

            UtilityClasses.Account.KEY_TICKET = new Model.RootObject_Chat();
            UtilityClasses.Account.KEY_TICKET = answere;
            if (answere.failure == false & answere.description.Contains("Closed"))
                return 1;
            else
                return 0;

        }
示例#6
0
        public async void UpdateFAQ_StaticData()
        {
            try
            {

                sc = new UtilityClasses.ServerCall();
                //  string content = await sc.GetjsonStream_StaticFAQ(Network.URL_FAQ_DATA);// Get Updated from server
                string content = await sc.GetjsonStream(UtilityClasses.Network.URL_FAQ_DATA);// Get Updated from server
                if (UtilityClasses.MKValidations.isValidJson(content))
                {

                    //if (File.Exists("FAQ_mapping.txt"))
                    //{
                    //    File.Delete("FAQ_mapping.txt");// Delete existing file
                    //}

                    //TextWriter file = new StreamWriter("FAQ_mapping.txt", true);// Create New 

                    //file.WriteLine(content);//Replace Data
                    //file.Close();

                    var FileName = "StaticFiles/FAQ_mapping.txt";
                    var Folder = Windows.Storage.ApplicationData.Current.LocalFolder;
                    var Fileoption = Windows.Storage.CreationCollisionOption.ReplaceExisting;
                    var File = await Folder.CreateFileAsync(FileName, Fileoption);
                    await Windows.Storage.FileIO.WriteTextAsync(File, content);
                        
                    FAQ_data =await ParseFAQMapping(); // get file data in local variable
                }
            }
            catch (Exception ex)
            {
                //List<Parameter> Params = new List<Parameter>();
                //Params.Add(AccountFunctions.createParameter("Location", "ViewModel FAQ"));
                //Params.Add(AccountFunctions.createParameter("Method", "Update static Faq question, Error:" + ex.Message));
                //FlurryWP8SDK.Api.LogEvent("FAQ Exception", Params);
            }
        }