Ejemplo n.º 1
0
        /// <summary>
        /// Init values for Revenue Account Spinner
        /// </summary>
        private async void InitRevenueAccountSpinnerValues(int compCode)
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    CustomProgressDialog.ShowProgDialog(mActivity,
                                                        mActivity.Resources.GetString(Resource.String.loading));

                    revenueAccOrderResponseList = await WebServiceMethods.GetRevenueOrders(compCode);

                    CustomProgressDialog.HideProgressDialog();
                }
                _revenueAccountSpinnerItemModelList = new List <SpinnerItemModel>();

                for (int i = 0; i < revenueAccOrderResponseList.Count; i++)
                {
                    SpinnerItemModel item = new SpinnerItemModel
                    {
                        Id         = (i + 1) + "",
                        TEXT       = revenueAccOrderResponseList[i].AccountName,
                        STATE      = false,
                        EXTRA_TEXT = revenueAccOrderResponseList[i].CountryCode
                    };

                    if (ledgerOrderItemObj != null)
                    {
                        if (revenueAccOrderResponseList[i].AccountId == ledgerOrderItemObj.AccountId)
                        {
                            _selectedRevenueAccountItemPosition = i;
                        }
                    }
                    _revenueAccountSpinnerItemModelList.Add(item);
                }
                SetRevenueAccountSpinnerAdapter();
            }
            catch (Exception e)
            {
                CustomProgressDialog.HideProgressDialog();
                UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR);
            }
        }