Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        private void InitializeListeners()
        {
            try
            {
                // Revenue Account Spinner
                spin_revenue_account_val.ItemSelected += (sender, args) =>
                {
                    _selectedRevenueAccountItem = _revenueAccountSpinnerItemModelList[args.Position];

                    revAccOrderResponseObj = revenueAccOrderResponseList[args.Position];

                    _revenueAccountSpinnerItemModelList[args.Position].STATE = true;
                    // update spinner item list state
                    for (int i = 0; i < _revenueAccountSpinnerItemModelList.Count; i++)
                    {
                        if (i == args.Position)
                        {
                            _revenueAccountSpinnerItemModelList[i].STATE = true;
                        }
                        else
                        {
                            _revenueAccountSpinnerItemModelList[i].STATE = false;
                        }
                    }
                    _revenueAccountSpinnerAdapter.NotifyDataSetChanged();

                    InitTaxRatesSpinnerValues();
                };

                // Show tax rates  Spinner
                spin_tax_rates_val.ItemSelected += (sender, args) =>
                {
                    _selectedTaxRatesItem = _taxRatesSpinnerItemModelList[args.Position];

                    showTaxRatesResponseObj = showTaxRatesResponseList[args.Position];

                    _taxRatesSpinnerItemModelList[args.Position].STATE = true;
                    // update spinner item list state
                    for (int i = 0; i < _taxRatesSpinnerItemModelList.Count; i++)
                    {
                        if (i == args.Position)
                        {
                            _taxRatesSpinnerItemModelList[i].STATE = true;
                        }
                        else
                        {
                            _taxRatesSpinnerItemModelList[i].STATE = false;
                        }
                    }
                    _taxRatesSpinnerAdapter.NotifyDataSetChanged();

                    CalculateVat();
                };
            }
            catch (Exception e)
            {
                UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), ConstantsDroid.LogType.ERROR);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Init values for Revenue Account Spinner
        /// </summary>
        private async void InitTaxRatesSpinnerValues()
        {
            try
            {
                if (CrossConnectivity.Current.IsConnected)
                {
                    CustomProgressDialog.ShowProgDialog(mActivity,
                                                        mActivity.Resources.GetString(Resource.String.loading));

                    string countryCode = string.IsNullOrEmpty(revAccOrderResponseObj.CountryCode) ?
                                         ledgerObj.CountryCode : revAccOrderResponseObj.CountryCode;
                    showTaxRatesResponseList = await WebServiceMethods.ShowTaxRates(countryCode);

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

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

                    _taxRatesSpinnerItemModelList.Add(item);
                }
                SetTaxRatesSpinnerAdapter();
            }
            catch (Exception e)
            {
                CustomProgressDialog.HideProgressDialog();
                UtilityDroid.PrintLog(Tag, e.StackTrace.ToString(), Global.ConstantsDroid.LogType.ERROR);
            }
        }
Ejemplo n.º 6
0
        public Dialog CreateDialog(Activity activity,
                                   string title, string message,
                                   string cancelBtnText, string submitBtnText,
                                   System.EventHandler cancelBtnEventHandler, System.EventHandler submitBtnEventHandler,
                                   bool showcancelButton, bool showSubmitButton)
        {
            try
            {
                // Begin building a new dialog.
                var builder = new AlertDialog.Builder(activity);

                //Get the layout inflater
                var inflater = activity.LayoutInflater;

                //Inflate the layout for this dialog
                var dialogView = inflater.Inflate(Resource.Layout.custom_dialog_lay, null);


                if (dialogView != null)
                {
                    //Initialize the properties
                    _titleTV   = dialogView.FindViewById <TextView>(Resource.Id.titleTV);
                    _messageTV = dialogView.FindViewById <TextView>(Resource.Id.messageTV);
                    _submitBtn = dialogView.FindViewById <Button>(Resource.Id.submitBtn);
                    _cancelBtn = dialogView.FindViewById <Button>(Resource.Id.cancelBtn);

                    _titleTV.Text   = title;
                    _messageTV.Text = message;
                    _submitBtn.Text = submitBtnText;
                    _cancelBtn.Text = cancelBtnText;

                    _submitBtn.Click += submitBtnEventHandler;
                    _cancelBtn.Click += cancelBtnEventHandler;

                    _submitBtn.Text = submitBtnText;
                    _cancelBtn.Text = cancelBtnText;


                    if (showSubmitButton)
                    {
                        _submitBtn.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        _submitBtn.Visibility = ViewStates.Gone;
                    }

                    if (showcancelButton)
                    {
                        _cancelBtn.Visibility = ViewStates.Visible;
                    }
                    else
                    {
                        _cancelBtn.Visibility = ViewStates.Gone;
                    }
                    builder.SetView(dialogView);
                }


                //Create the builder
                var dialog = builder.Create();

                //Now return the constructed dialog to the calling activity
                return(dialog);
            }
            catch (Exception e)
            {
                UtilityDroid.PrintLog(TAG, e.StackTrace, Global.ConstantsDroid.LogType.ERROR);
                return(null);
            }
        }