async void GetAccountCodeList()
        {
            if (IosUtils.IosUtility.IsReachable())
            {
                IosUtils.IosUtility.showProgressHud("");
                try
                {
                    var res = await WebServiceMethods.GetAccountCodes(EntityCode.CompCode);

                    if (res != null)
                    {
                        InvokeOnMainThread(() =>
                        {
                            accountlst   = res;
                            AccountCode  = accountlst[0];
                            accountModel = new AccountCodePickerModel(accountlst, IBAccountCodeTxt, accountlst[0]);
                            IBAccountCodePicker.Model = accountModel;
                            IBAccountCodeTxt.Text     = AccountCode.AccountName;
                        });
                        SetDateTime();
                    }
                    else
                    {
                        IosUtils.IosUtility.hideProgressHud();
                        IosUtils.IosUtility.showAlertWithInfo(IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSErrorTitle", "LSErrorTitle"),
                                                              IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSUnknownError", "LSErrorTitle"));
                    }
                }
                catch (Exception e)
                {
                    IosUtils.IosUtility.hideProgressHud();
                    IosUtils.IosUtility.showAlertWithInfo(IosUtils.LocalizedString.sharedInstance.GetLocalizedString("LSErrorTitle", "LSErrorTitle"), e.Message);
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Init values for Account Code spinner
        /// </summary>
        private async void InitAccountCodeSpinnerValues()
        {
            try
            {
                List <AccountCodesResponse> responseList = null;
                if (CrossConnectivity.Current.IsConnected)
                {
                    CustomProgressDialog.ShowProgDialog(mActivity,
                                                        mActivity.Resources.GetString(Resource.String.loading));

                    responseList = await WebServiceMethods.GetAccountCodes(_selectedCurrentEntitysItem.EXTRA_TEXT);

                    CustomProgressDialog.HideProgressDialog();
                }

                _accountCodeSpinnerItemModelList = new List <SpinnerItemModel>();

                for (int i = 0; i < responseList.Count; i++)
                {
                    SpinnerItemModel item = new SpinnerItemModel
                    {
                        Id                = (i + 1) + "",
                        TEXT              = responseList[i].AccountName,
                        EXTRA_TEXT        = responseList[i].AccountId,
                        SECOND_EXTRA_TEXT = responseList[i].AccountCode,
                        STATE             = false
                    };
                    if (accountCode != null && accountCode.Equals(responseList[i].AccountCode + ""))
                    {
                        _selectedAccountCodeItemPosition = i;
                    }
                    _accountCodeSpinnerItemModelList.Add(item);
                }
                SetAccountCodeSpinnerAdapter();
            }
            catch (Exception e)
            {
                CustomProgressDialog.HideProgressDialog();
            }
        }