private async void ShowUserCurrency()
        {
            try
            {
                string countryCode = PickerModel.selectedModel.CountryCode;
                ShowUserCurrencyResponse userCurrencyResponseObj = null;
                if (IosUtils.IosUtility.IsReachable())
                {
                    IosUtility.showProgressHud("");

                    userCurrencyResponseObj = await WebServiceMethods.GetUserCurrencyFromCountryCode(countryCode);

                    InvokeOnMainThread(() =>
                    {
                        if (userCurrencyResponseObj != null && !string.IsNullOrEmpty(userCurrencyResponseObj.CurrencyName))
                        {
                            TxtCurrency.Text = userCurrencyResponseObj.CurrencyName;
                        }
                    });
                    IosUtility.hideProgressHud();
                }
            }
            catch (Exception e)
            {
                IosUtility.hideProgressHud();
                IosUtils.IosUtility.showAlertWithInfo(IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSErrorTitle", "LSErrorTitle"),
                                                      IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSUnknownError", "LSErrorTitle"));
            }
        }
示例#2
0
        private async void ShowUserCurrency(string countryCode)
        {
            try
            {
                ShowUserCurrencyResponse userCurrencyResponseObj = null;
                if (CrossConnectivity.Current.IsConnected)
                {
                    CustomProgressDialog.ShowProgDialog(mActivity,
                                                        mActivity.Resources.GetString(Resource.String.loading));

                    userCurrencyResponseObj = await WebServiceMethods.GetUserCurrencyFromCountryCode(countryCode);

                    if (userCurrencyResponseObj != null && !string.IsNullOrEmpty(userCurrencyResponseObj.CurrencyName))
                    {
                        edt_currency.Text = userCurrencyResponseObj.CurrencyName;
                    }
                    CustomProgressDialog.HideProgressDialog();
                }
            }
            catch (Exception e)
            {
                CustomProgressDialog.HideProgressDialog();
                UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR);
            }
        }
        /// <summary>
        /// Returns list of user currency
        /// </summary>
        /// <returns></returns>
        public async static Task <ShowUserCurrencyResponse> GetUserCurrencyFromCountryCode(string countryCode)
        {
            try
            {
                ShowUserCurrencyAPIParams param = new ShowUserCurrencyAPIParams
                {
                    countryCode    = countryCode,
                    connectionName = WebserviceConstants.CONNECTION_NAME
                };
                var response = await WebServiceHandler.GetWebserviceResult(
                    WebserviceConstants.GET_USER_CURRENCY_FROM_COUNTRY_CODE, HttpMethod.Post, param)
                               as FinalResponse;

                List <ShowUserCurrencyResponse> userCurrencyResponseList = new List <ShowUserCurrencyResponse>();;

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    DataSet resultIds = response.ResultDs;
                    foreach (DataTable dt in resultIds.Tables)
                    {
                        foreach (DataRow dr in dt.Rows)
                        {
                            try
                            {
                                ShowUserCurrencyResponse userCurrencyResponse = new ShowUserCurrencyResponse();
                                userCurrencyResponse.CountryCode = dr["CountryCode"] != DBNull.Value ?
                                                                   dr["CountryCode"].ToString() : "";
                                userCurrencyResponse.CurrencyCode = dr["CurrencyCode"] != DBNull.Value ?
                                                                    dr["CurrencyCode"].ToString() : "";
                                userCurrencyResponse.CurrencyCodeID = dr["CurrencyCodeID"] != DBNull.Value ?
                                                                      Convert.ToInt32(dr["CurrencyCodeID"].ToString()) : 0;
                                userCurrencyResponse.CurrencyUnit = dr["CurrencyUnit"] != DBNull.Value ?
                                                                    dr["CurrencyUnit"].ToString() : "";
                                userCurrencyResponse.RSS_Data = dr["RSS_Data"] != DBNull.Value ?
                                                                Convert.ToBoolean(dr["RSS_Data"].ToString()) : false;
                                userCurrencyResponse.CurrencyName = dr["CurrencyName"] != DBNull.Value ?
                                                                    dr["CurrencyName"].ToString() : "";

                                userCurrencyResponseList.Add(userCurrencyResponse);
                            }
                            catch (Exception e)
                            {
                            }
                        }
                    }
                }

                return(userCurrencyResponseList[0]);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }