Ejemplo n.º 1
0
        /// <summary>
        /// Init values for Customerspinner
        /// </summary>
        private async void InitAccountOrderSpinnerValues(string accountCode)
        {
            try
            {
                //string[] items = Resources.GetStringArray(Resource.Array.customer_entries);
                if (CrossConnectivity.Current.IsConnected)
                {
                    CustomProgressDialog.ShowProgDialog(mActivity,
                                                        mActivity.Resources.GetString(Resource.String.loading));

                    accountOrderResponseList = await WebServiceMethods.GetAccountForOrders();

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

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

                    if (!string.IsNullOrEmpty(accountCode))
                    {
                        if (accountOrderResponseList[i].AccountCode == accountCode)
                        {
                            _selectedAccountCodeItemPosition = i;
                        }
                    }
                    _accountCodeSpinnerItemModelList.Add(item);
                }
                SetCustomerSpinnerAdapter();
            }
            catch (Exception e)
            {
                CustomProgressDialog.HideProgressDialog();
                UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR);
            }
        }