Exemplo n.º 1
0
        private void LoadData(string sono, string uid)
        {
            TextView txtInvNo = FindViewById <TextView> (Resource.Id.txtInvnp);
            Spinner  spinner  = FindViewById <Spinner> (Resource.Id.txtcode);
            EditText qty      = FindViewById <EditText> (Resource.Id.txtqty);
            //TextView desc =  FindViewById<TextView> (Resource.Id.txtdesc);
            EditText price  = FindViewById <EditText> (Resource.Id.txtprice);
            EditText amount = FindViewById <EditText> (Resource.Id.txtamount);
            //EditText taxper = FindViewById<EditText> (Resource.Id.txtinvtaxper);
            EditText taxamt = FindViewById <EditText> (Resource.Id.txttaxamt);
            //CheckBox isincl = FindViewById<CheckBox> (Resource.Id.txtinvisincl);
            TextView tax = FindViewById <TextView> (Resource.Id.txttax);

            int id = Convert.ToInt32(uid);

            using (var db = new SQLite.SQLiteConnection(pathToDatabase)) {
                var invlist = db.Table <SaleOrderDtls> ().Where(x => x.sono == sono && x.ID == id).ToList <SaleOrderDtls> ();
                if (invlist.Count > 0)
                {
                    SaleOrderDtls soItem = invlist [0];
                    int           index  = dataAdapter.GetPosition(soItem.icode + " | " + soItem.description);
                    Item          item   = items.Where(x => x.ICode == soItem.icode).FirstOrDefault();
                    spinner.SetSelection(index);
                    qty.Text    = soItem.qty.ToString();
                    price.Text  = soItem.price.ToString();
                    taxamt.Text = soItem.tax.ToString();

                    tax.Text    = item.taxgrp;
                    taxper      = item.tax;
                    isInclusive = item.isincludesive;
                    amount.Text = soItem.amount.ToString();
                    price.Text  = soItem.price.ToString();
                }
            }
        }
Exemplo n.º 2
0
        private void LoadData()
        {
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);
            DateTime invdate = Utility.ConvertToDate(trxdate.Text);
            DateTime tmr     = invdate.AddDays(1);
            Spinner  spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            //Spinner spinner2 = FindViewById<Spinner> (Resource.Id.newinv_type);
            TextView txtinvno    = FindViewById <TextView> (Resource.Id.newinv_no);
            EditText remark      = FindViewById <EditText> (Resource.Id.newinv_remark);
            EditText txtcustname = FindViewById <EditText> (Resource.Id.newinv_custname);

            trxdate.Text = invInfo.invdate.ToString("dd-MM-yyyy");

            if (invInfo.custcode == "COD" || invInfo.custcode == "CASH")
            {
                spinner.SetSelection(CashPos);
            }
            else
            {
                int pos1 = dataAdapter.GetPosition(invInfo.custcode + " | " + invInfo.description);
                spinner.SetSelection(pos1);
            }

            int pos2 = TRXTYPE == "CASH" ? 0 : 1;

            //int pos2= dataAdapter2.GetPosition (invInfo.trxtype);

            spinnerType.SetSelection(pos2);
            remark.Text      = invInfo.remark;
            txtinvno.Text    = invInfo.invno;
            txtcustname.Text = invInfo.description;
        }
Exemplo n.º 3
0
        void EditItem(string cnno, int id)
        {
            using (var db = new SQLite.SQLiteConnection(pathToDatabase))
            {
                var list = db.Table <CNNoteDtls>().Where(x => x.cnno == cnno && x.ID == id).ToList <CNNoteDtls>();
                if (list.Count > 0)
                {
                    txtqty.Text   = list [0].qty.ToString();
                    txtprice.Text = list [0].price.ToString("n2");
                    int pos1 = 0;
                    if (list [0].description.Length > 40)
                    {
                        pos1 = dAdapterItem.GetPosition(list [0].icode + " | " + list [0].description.Substring(0, 40) + "...");
                    }
                    else
                    {
                        pos1 = dAdapterItem.GetPosition(list [0].icode + " | " + list [0].description);
                    }

                    spinItem.SetSelection(pos1);
                    spinItem.Enabled    = false;
                    butFindItem.Enabled = false;
                    IsEdit          = true;
                    IDdtls          = list [0].ID;
                    txtInvMode.Text = "EDIT";
                    txtqty.RequestFocus();
                    txtqty.SelectAll();
                }
            }
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var rootView = inflater.Inflate(Resource.Layout.play_settings_fragment, container, false);

            sabiranjeSpinner  = rootView.FindViewById <Spinner>(Resource.Id.sabiranjeSpinner);
            oduzimanjeSpinner = rootView.FindViewById <Spinner>(Resource.Id.oduzimanjeSpinner);
            mnozenjeSpinner   = rootView.FindViewById <Spinner>(Resource.Id.mnozenjeSpinner);
            deljenjeSpinner   = rootView.FindViewById <Spinner>(Resource.Id.deljenjeSpinner);

            adapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.numbers_array, Android.Resource.Layout.SimpleSpinnerItem);
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            sabiranjeSpinner.Adapter  = adapter;
            oduzimanjeSpinner.Adapter = adapter;
            deljenjeSpinner.Adapter   = adapter;
            mnozenjeSpinner.Adapter   = adapter;

            sabiranjeSpinner.SetSelection(adapter.GetPosition(App.preferences.sabiranje.ToString()));
            oduzimanjeSpinner.SetSelection(adapter.GetPosition(App.preferences.oduzimanje.ToString()));
            mnozenjeSpinner.SetSelection(adapter.GetPosition(App.preferences.mnozenje.ToString()));
            deljenjeSpinner.SetSelection(adapter.GetPosition(App.preferences.deljenje.ToString()));

            sabiranjeSpinner.ItemSelected  += SabiranjeSpinner_ItemSelected;
            oduzimanjeSpinner.ItemSelected += OduzimanjeSpinner_ItemSelected;
            mnozenjeSpinner.ItemSelected   += MnozenjeSpinner_ItemSelected;
            deljenjeSpinner.ItemSelected   += DeljenjeSpinner_ItemSelected;

            return(rootView);
        }
Exemplo n.º 5
0
        private void LoadData()
        {
            EditText trxdate  = FindViewById <EditText> (Resource.Id.newinv_date);
            DateTime invdate  = Utility.ConvertToDate(trxdate.Text);
            DateTime tmr      = invdate.AddDays(1);
            Spinner  spinner  = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            Spinner  spinner2 = FindViewById <Spinner> (Resource.Id.newinv_type);
            TextView txtinvno = FindViewById <TextView> (Resource.Id.newinv_no);
            TextView custname = FindViewById <TextView> (Resource.Id.newinv_custname);
            EditText custpo   = FindViewById <EditText> (Resource.Id.newinv_po);
            EditText remark   = FindViewById <EditText> (Resource.Id.newinv_remark);

            trxdate.Text = soInfo.sodate.ToString("dd-MM-yyyy");
            var found1 = icodes.Where(x => x.IndexOf(soInfo.custcode + " | ") > -1).ToList();
            var found2 = icodes2.Where(x => x.IndexOf(soInfo.billTo + " | ") > -1).ToList();

            if (found1.Count > 0)
            {
                int pos = dataAdapter.GetPosition(found1[0]);
                spinner.SetSelection(pos);
            }
            if (found2.Count > 0)
            {
                int pos = dataAdapter2.GetPosition(found2[0]);
                spinnerBill.SetSelection(pos);
            }

            txtinvno.Text = soInfo.sono;
            custpo.Text   = soInfo.custpono;
            remark.Text   = soInfo.remark;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            jsonEvent = Intent.GetStringExtra("event");
            jsonUser  = Intent.GetStringExtra("user");
            JsonSerializerSettings settings = new JsonSerializerSettings
            {
                TypeNameHandling = TypeNameHandling.All
            };

            cEvent = (TBPEvent)JsonConvert.DeserializeObject <Event> (jsonEvent, settings);
            user   = (TBPUser)JsonConvert.DeserializeObject <User> (jsonUser, settings);

            SetContentView(Resource.Layout.MemberSignIn);
            TextView name = FindViewById <TextView> (Resource.Id.memberSignInName);

            name.Text = user.FirstName + " " + user.LastName;
            TextView eventName = FindViewById <TextView> (Resource.Id.memberSignInEvent);

            eventName.Text = cEvent.Name;
            Spinner      hours  = FindViewById <Spinner> (Resource.Id.memberSignInPoints);
            ArrayAdapter hAdapt = new ArrayAdapter <int> (this, Android.Resource.Layout.SimpleListItem1, Enumerable.Range(1, maxhours).ToList());

            hours.Adapter = hAdapt;

            if (cEvent.Points >= maxhours)
            {
                hours.SetSelection(hAdapt.GetPosition(maxhours));
            }
            else
            {
                hours.SetSelection(hAdapt.GetPosition(cEvent.Points));
            }

            Button done = FindViewById <Button> (Resource.Id.memberSignInDone);

            cat = FindViewById <Spinner> (Resource.Id.memberSignInCategory);
            ArrayAdapter adapter = new ArrayAdapter <TBPEvent.Category> (this, Android.Resource.Layout.SimpleListItem1, Enum.GetValues(typeof(TBPEvent.Category)).Cast <TBPEvent.Category>().ToList());

            cat.Adapter = adapter;
            for (int i = 0; i < cat.Count; i++)
            {
                if (cat.GetItemAtPosition(i).ToString().Equals(cEvent.Type.ToString()))
                {
                    cat.SetSelection(i);
                }
            }

            if (!cEvent.Wildcard)
            {
                cat.Enabled = false;
            }


            done.Click += (sender, e) => signInMember((int)hours.SelectedItem);
        }
Exemplo n.º 7
0
 void LoadInvoice()
 {
     if (INVOICENO == "")
     {
         if (INVACTION == "create")
         {
             CreateCashBill();
         }
         else
         {
             EnableControLs(false, false, true, false, true);
             inv = new Invoice();
         }
     }
     else
     {
         loadInvouce(INVOICENO);
         if (inv != null)
         {
             txtInvMode.Text = "EDIT";
             txtInvNo.Text   = inv.invno;
             txtInvDate.Text = inv.invdate.ToString("dd-MM-yyyy");
             txtRemark.Text  = inv.remark.ToUpper();
             if (!string.IsNullOrEmpty(inv.custcode))
             {
                 int pos1 = dAdapterCust.GetPosition(inv.custcode + " | " + inv.description.Trim());
                 if (pos1 > 0)
                 {
                     spinCust.SetSelection(pos1);
                 }
                 else
                 {
                     spinCust.SetSelection(0);
                 }
             }
             else
             {
                 spinCust.SetSelection(0);
             }
             EnableControLs(true, false, true, true, false);
         }
         else
         {
             EnableControLs(false, false, true, false, true);
             inv = new Invoice();
         }
     }
 }
Exemplo n.º 8
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            var item = Items[position];

            var vh         = viewHolder as VegeViewHolder;
            var spinnerPos = 0;
            var adapter    = new ArrayAdapter <String>(Context, Android.Resource.Layout.SimpleSpinnerItem, _quantity);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            vh.Name.Text    = item.Name;
            vh.Price.Text   = string.Format("Price: ${0}", item.Price);
            vh.ItemView.Tag = position;
            if (item.Quantity > 0)
            {
                spinnerPos          = adapter.GetPosition(item.Quantity.ToString());
                vh.TotalAmount.Text = string.Format("${0}", item.Price * item.Quantity);
            }
            else
            {
                vh.TotalAmount.Text = "";
            }
            vh.Quantity.Tag     = position;         //keep reference to list view row position
            vh.Quantity.Adapter = adapter;
            vh.Quantity.SetSelection(spinnerPos);
            vh.Image.SetImageResource(item.ImageId);
        }
Exemplo n.º 9
0
        private void ConfigureVibrationSpinner()
        {
            Log.Debug(TAG, "ConfigureVibrationSpinner");
            var spinner = FindViewById <Spinner>(Resource.Id.vibrationEnable);

            spinner.Prompt = "Enable/Disable vibration on button press";

            var           set_vibration        = SwSettings.GetVibrationEnable();
            var           set_vibration_string = "";
            List <string> inputNames           = new List <string>();

            foreach (var vib_str in SwSettings.VIBRATION_TO_STRING_MAP.Keys)
            {
                inputNames.Add(vib_str);
                if (set_vibration == SwSettings.VIBRATION_TO_STRING_MAP[vib_str])
                {
                    set_vibration_string = vib_str;
                }
            }
            var adapter = new ArrayAdapter <string>(this, Resource.Layout.spinner_item, inputNames);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(VibrationSpinnerItemSelected);
            ignore_spinner_count++;

            int spinner_position = adapter.GetPosition(set_vibration_string);

            spinner.SetSelection(spinner_position);

            spinner.Invalidate();
        }
Exemplo n.º 10
0
        private void ConfigureLayoutSpinner()
        {
            Log.Debug(TAG, "ConfigureLayoutSpinner");
            var spinner = FindViewById <Spinner>(Resource.Id.controllerLayout);

            spinner.Prompt = "Select Controller Layout";

            var           set_layout        = SwSettings.GetSelectedLayout();
            var           set_layout_string = "";
            List <string> inputNames        = new List <string>();

            foreach (var layout_str in SwSettings.LAYOUT_TO_STRING_MAP.Keys)
            {
                inputNames.Add(layout_str);
                if (set_layout == SwSettings.LAYOUT_TO_STRING_MAP[layout_str])
                {
                    set_layout_string = layout_str;
                }
            }
            var adapter = new ArrayAdapter <string>(this, Resource.Layout.spinner_item, inputNames);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(LayoutSpinnerItemSelected);
            ignore_spinner_count++;

            int spinner_position = adapter.GetPosition(set_layout_string);

            spinner.SetSelection(spinner_position);

            spinner.Invalidate();
        }
Exemplo n.º 11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Toolbar.SetNavigationIcon(Resource.Drawable.ic_cancel);

            Window.SetStatusBarColor(Android.Graphics.Color.ParseColor("#00796B"));

            editName        = FindViewById <EditText>(Resource.Id.edit_category_name);
            editDescription = FindViewById <EditText>(Resource.Id.edit_category_description);

            ArrayAdapter adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, types);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerCategoryType         = FindViewById <Spinner>(Resource.Id.spinner_category_type);
            spinnerCategoryType.Adapter = adapter;

            // Initialize gridview and handle click events
            gridIcons         = FindViewById <GridView>(Resource.Id.gridviewCategory);
            iconsAdapter      = new IconsAdapter(this, categoryIcons);
            gridIcons.Adapter = iconsAdapter;

            View previousGridItem = null; // The previous selected item
            bool flag             = true;

            gridIcons.ItemClick += (sender, args) =>
            {
                if (flag)
                {
                    previousGridItem = gridIcons.GetChildAt(0);
                    flag             = false;
                }
                if (previousGridItem != args.View)
                {
                    args.View.SetBackgroundResource(Resource.Color.accent);
                    previousGridItem.SetBackgroundResource(0);
                    previousGridItem = args.View;
                }
                iconDrawable = (int)gridIcons.GetItemIdAtPosition(args.Position);
            };

            Bundle extras = Intent.Extras;

            if (extras != null)
            {
                editMode = extras.GetBoolean("EDIT_MODE");
                if (editMode)
                {
                    category             = Newtonsoft.Json.JsonConvert.DeserializeObject <Category>(extras.GetString("CATEGORY_OBJECT"));
                    editName.Text        = category.Name;
                    editDescription.Text = category.Description;
                    spinnerCategoryType.SetSelection(adapter.GetPosition(category.Type.ToString()));
                    gridIcons.Tag = category.Icon;
                }
            }
            else
            {
                category      = new Category();
                gridIcons.Tag = iconDrawable;
            }
        }
Exemplo n.º 12
0
        private void loadTransaction(int transactionPK)
        {
            //go through each transaction and set the values for the selected transaction
            foreach (Transaction trans in Transactions.transactions)
            {
                if (trans.PK == transactionPK)
                {
                    title.Text = trans.Title;

                    var amount2 = trans.Amount.ToString();

                    if (amount2.Contains("-"))
                    {
                        amount.Text = amount2.Substring(1);
                    }
                    else
                    {
                        amount.Text = amount2;
                    }

                    date.Text = trans.Date.ToString("MM-dd-yyyy");
                    category.SetSelection(transactionCategoryAdapter.GetPosition(trans.Category));
                    type_toaccount.SetSelection(transactionTypeToAccountAdapter.GetPosition(trans.Type_ToAccount));
                    notes.Text = trans.Notes;
                    break;
                }
            }
        }
Exemplo n.º 13
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.settings_activity, container, false);

            _spnColor = view.FindViewById <Spinner>(Resource.Id.spnColor);
            _txtSize  = view.FindViewById <EditText>(Resource.Id.txtSize);
            _btnSave  = view.FindViewById <Button>(Resource.Id.btnSave);

            _settingsRepository = GetInstance <ISettingsRepository>(Context);

            var colors  = new[] { Color.Black, Color.DarkRed, Color.Blue };
            var adapter = new ArrayAdapter <Color>(Context, Resource.Layout.support_simple_spinner_dropdown_item, colors);

            adapter.SetDropDownViewResource(Resource.Layout.support_simple_spinner_dropdown_item);
            _spnColor.Adapter = adapter;

            _btnSave.Click += OnSave_Clicked;

            var savedColor = _settingsRepository.Color;
            var positionForCurrentColor = adapter.GetPosition(savedColor);

            _spnColor.SetSelection(positionForCurrentColor);

            var savedSize = _settingsRepository.Size;

            _txtSize.Text = savedSize.ToString();

            return(view);
        }
Exemplo n.º 14
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(Resource.Layout.PopupWindow, container, false);

            using (EditText editTextTime = view.FindViewById <EditText>(Resource.Id.editTextTime))
            {
                editTextTime.Text = note.TimeOfNote.Split(' ')[1];
            }
            using (EditText editTextDay = view.FindViewById <EditText>(Resource.Id.editTextDate))
            {
                editTextDay.Text = note.TimeOfNote.Split(' ')[0];
            }
            using (EditText editTextNote = view.FindViewById <EditText>(Resource.Id.editTextOfNote))
            {
                editTextNote.Text = note.TextOfNote;
            }
            using (Spinner spinner = view.FindViewById <Spinner>(Resource.Id.spinner1))
            {
                spinner.ItemSelected += (s, e) =>
                {
                    using (Spinner spinnerID = view.FindViewById <Spinner>(Resource.Id.spinnerRoomID))
                    {
                        spinnerID.SetSelection(e.Position);
                    }
                };
                spinner.Adapter = adapterRoomName;
                int a = adapterRoomName.GetPosition(note.RoomName);
                spinner.SetSelection(adapterRoomName.GetPosition(note.RoomName));
                adapterRoomName.Dispose();
            }
            using (Spinner spinner = view.FindViewById <Spinner>(Resource.Id.spinnerRoomID))
            {
                spinner.Adapter = adapterRoomID;
                //spinner.SetSelection(adapterRoomID.GetPosition(room.RoomID));
                adapterRoomID.Dispose();
            }

            using (Button btn = view.FindViewById <Button>(Resource.Id.button2))
            {
                btn.Click += BtnSaveChanges_Click;
            }

            this.view = view;
            return(view);
        }
Exemplo n.º 15
0
 protected override void OnRestoreInstanceState(Bundle savedInstanceState)
 {
     base.OnRestoreInstanceState(savedInstanceState);
     includeClosed = savedInstanceState.GetBoolean("includeClosed");
     myIssues      = savedInstanceState.GetBoolean("myIssues");
     SFilterByStatus.SetSelection(statusAdapter.GetPosition(savedInstanceState.GetString("StatusFilter")));
     SFilterByMonth.SetSelection(monthsAdapter.GetPosition(savedInstanceState.GetString("MonthFilter")));
 }
Exemplo n.º 16
0
 static void LlenaCampos(string fname, string lname, string email, string location, string genero)
 {
     inputEmail.Text    = email;
     inputName.Text     = fname;
     inputLastname.Text = lname;
     inputLocation.Text = location;
     spinner.SetSelection(adapter.GetPosition(genero));
 }
Exemplo n.º 17
0
 public void prepearObteinedData(User user)
 {
     mNombre.Text     = user.Nombre;
     mArea.Text       = user.Area;
     mCuenta.Text     = user.Cuenta;
     mContrasena.Text = user.Contrasena;
     mPerfil.SetSelection(adapter.GetPosition(user.Perfil));
 }
Exemplo n.º 18
0
        private async void LoadData()
        {
            try
            {
                DiaglogService.ShowLoading(this);
                var userResponse = await apiService.GetAsync <UserForDetailedDto>(Settings.ApiUrl, Settings.Prefix, "/Users/GetUser/" + userId, "Bearer", Settings.Token);

                if (!userResponse.IsSuccess)
                {
                    DiaglogService.StopLoading();
                    DiaglogService.ShowMessage(this, "Error loading user", userResponse.Message, "Accept");
                    return;
                }
                userInformation = JsonConvert.DeserializeObject <UserForDetailedDto>(userResponse.Result.ToString());
                if (userInformation != null)
                {
                    nameEditText.Text     = userInformation.Name;
                    lastNameEditText.Text = userInformation.LastName;
                    idNumberEditText.Text = userInformation.IdNumber;
                    emailEditText.Text    = userInformation.Email;
                }


                var response = await apiService.GetListAsync <IdTypeForDetailedDto>(Settings.ApiUrl, Settings.Prefix, "/Users/GetUserIdTypes", "Bearer", Settings.Token);

                if (!response.IsSuccess)
                {
                    DiaglogService.StopLoading();
                    DiaglogService.ShowMessage(this, "Error loading id types", response.Message, "Accept");
                    return;
                }
                idTypesList = new List <IdTypeForDetailedDto>();
                idTypesList = JsonConvert.DeserializeObject <List <IdTypeForDetailedDto> >(response.Result.ToString());

                if (idTypesList.Count > 0)
                {
                    var usersAdapter = new ArrayAdapter <string>(this, global::Android.Resource.Layout.SimpleDropDownItem1Line, idTypesList.Select(x => x.Name).ToList());
                    idTypeSelected               = idTypesList.FirstOrDefault(x => x.Id == userInformation.IdTypeID);
                    idTypesSpinner.Adapter       = usersAdapter;
                    idTypesSpinner.ItemSelected += IdTypesSpinner_ItemSelected;

                    int spinnerPosition = usersAdapter.GetPosition(idTypeSelected.Name);
                    idTypesSpinner.SetSelection(spinnerPosition);
                }
                else
                {
                    DiaglogService.ShowMessage(this, "Error", "Please add a category", "Accept");
                    Finish();
                }

                DiaglogService.StopLoading();
            }
            catch (System.Exception ex)
            {
                DiaglogService.StopLoading();
                DiaglogService.ShowMessage(this, "Error", CommonHelpers.GetErrorMessage("Error loading users", ex), "Ok");
            }
        }
        private void InitalizeSpinners()
        {
            adapterAccount         = new ArrayAdapter <Account>(this, Resource.Layout.spinner_item, listOfAccounts);
            adapterAccountTransfer = new ArrayAdapter <Account>(this, Resource.Layout.spinner_item, listOfAccounts);
            adapterCategory        = new ArrayAdapter <Category>(this, Resource.Layout.spinner_item, EditMode ? (transaction.Type == "Income" ? listOfIncomeCategories : listOfExpenseCategories) : listOfIncomeCategories);
            adapterPaymentType     = new ArrayAdapter <string>(this, Resource.Layout.spinner_item, paymentTypes);

            adapterAccount.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            adapterCategory.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            adapterPaymentType.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            adapterAccountTransfer.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            spinnerTransactionAccount         = FindViewById <Spinner>(Resource.Id.spinner_transaction_account);
            spinnerTransactionCategory        = FindViewById <Spinner>(Resource.Id.spinner_transaction_category);
            spinnerTransactionPaymentType     = FindViewById <Spinner>(Resource.Id.spinner_transaction_payment_type);
            spinnerTransactionAccountTransfer = FindViewById <Spinner>(Resource.Id.spinner_transaction_account_transfer);

            spinnerTransactionAccount.Adapter         = adapterAccount;
            spinnerTransactionCategory.Adapter        = adapterCategory;
            spinnerTransactionPaymentType.Adapter     = adapterPaymentType;
            spinnerTransactionAccountTransfer.Adapter = adapterAccountTransfer;

            spinnerTransactionAccount.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(SpinnerTransactionAccount_ItemClick);

            if (EditMode)
            {
                spinnerTransactionAccount.SetSelection(GetIndex(spinnerTransactionAccount, SilverCoinsManager.GetAccount(transaction.Account).Name));
                spinnerTransactionCategory.SetSelection(GetIndex(spinnerTransactionCategory, SilverCoinsManager.GetCategory(transaction.Category).Name));
                spinnerTransactionPaymentType.SetSelection(adapterPaymentType.GetPosition(transaction.PaymentType));
                if (transaction.AccountTransfer != 0)
                {
                    spinnerTransactionAccountTransfer.SetSelection(GetIndex(spinnerTransactionAccountTransfer, SilverCoinsManager.GetAccount(transaction.AccountTransfer).Name));
                }

                switch (transaction.Type)
                {
                case "Income":
                    spinnerTransactionAccountTransfer.Visibility = ViewStates.Gone;
                    break;

                case "Expense":
                    spinnerTransactionAccountTransfer.Visibility = ViewStates.Gone;
                    break;

                case "Transfer":
                    spinnerTransactionCategory.Visibility = ViewStates.Gone;
                    break;

                default:
                    break;
                }
            }
            else
            {
                spinnerTransactionAccountTransfer.Visibility = ViewStates.Gone;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_data_labels);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.dataLabels);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widget
            mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart);

            mDataLabelSpinner = (Spinner)FindViewById(Resource.Id.dataLabelSpinner);

            // set the binding for X-axis of FlexChart
            mChart.BindingX = "Name";

            // initialize series elements and set the binding to variables of
            // ChartPoint
            ChartSeries seriesSales = new ChartSeries();

            seriesSales.Chart      = mChart;
            seriesSales.SeriesName = "Sales";
            seriesSales.Binding    = "Sales";

            // add series to list
            mChart.Series.Add(seriesSales);

            // setting the source of data/items in FlexChart
            mChart.ItemsSource = ChartPoint.GetList();

            mChart.ChartType = ChartType.Bar;

            mChart.DataLabel.Content     = "{x},{y}";
            mChart.DataLabel.Border      = true;
            mChart.DataLabel.BorderStyle = new ChartStyle()
            {
                Stroke = Color.Green, StrokeThickness = 2, Fill = Color.Transparent
            };

            // create custom adapter for spinner and initialize with string array
            ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartDataLabelPositionSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mDataLabelSpinner.Adapter = adapter1;

            int defaultPosition = adapter1.GetPosition("Left");

            mDataLabelSpinner.SetSelection(defaultPosition);
            mDataLabelSpinner.ItemSelected += MDataLabelSpinner_ItemSelected;
        }
Exemplo n.º 21
0
        private void LoadData()
        {
            EditText trxdate  = FindViewById <EditText> (Resource.Id.newinv_date);
            DateTime invdate  = Utility.ConvertToDate(trxdate.Text);
            DateTime tmr      = invdate.AddDays(1);
            Spinner  spinner  = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            Spinner  spinner2 = FindViewById <Spinner> (Resource.Id.newinv_type);
            TextView txtinvno = FindViewById <TextView> (Resource.Id.newinv_no);
            EditText remark   = FindViewById <EditText> (Resource.Id.newinv_custname);

            trxdate.Text = doInfo.dodate.ToString("dd-MM-yyyy");
            int pos1 = dataAdapter.GetPosition(doInfo.custcode + " | " + doInfo.description);
            int pos2 = dataAdapter2.GetPosition(doInfo.trxtype);

            spinner.SetSelection(pos1);
            spinner2.SetSelection(pos2);
            remark.Text   = doInfo.remark;
            txtinvno.Text = doInfo.dono;
        }
Exemplo n.º 22
0
        private void LoadData(string sono, string uid)
        {
            TextView txtInvNo = FindViewById <TextView> (Resource.Id.txtInvnp);
            Spinner  spinner  = FindViewById <Spinner> (Resource.Id.txtcode);
            EditText qty      = FindViewById <EditText> (Resource.Id.txtqty);

            int id = Convert.ToInt32(uid);

            using (var db = new SQLite.SQLiteConnection(pathToDatabase)) {
                var invlist = db.Table <DelOrderDtls> ().Where(x => x.dono == sono && x.ID == id).ToList <DelOrderDtls> ();
                if (invlist.Count > 0)
                {
                    DelOrderDtls doItem = invlist [0];
                    int          index  = dataAdapter.GetPosition(doItem.icode + " | " + doItem.description);
                    Item         item   = items.Where(x => x.ICode == doItem.icode).FirstOrDefault();
                    spinner.SetSelection(index);
                    qty.Text = doItem.qty.ToString();
                }
            }
        }
 public void SetupMonthSpinner()
 {
     adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, months);
     adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
     monthspinner.Adapter       = adapter;
     monthspinner.ItemSelected += Monthspinner_ItemSelected;
     if (SelectedMonth != null)
     {
         int spinnerPosition = adapter.GetPosition(SelectedMonth.Substring(0, 3));
         monthspinner.SetSelection(spinnerPosition);
     }
 }
Exemplo n.º 24
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            bStartServer        = FindViewById <Button>(Resource.Id.bStartServer);
            bNewVersion         = FindViewById <Button>(Resource.Id.bNewVersion);
            bNewVersion.Enabled = false;
            bStopServer         = FindViewById <Button>(Resource.Id.bStopServer);
            bLoadPlaylist       = FindViewById <Button>(Resource.Id.bLoadPlaylist);
            etLogs   = FindViewById <EditText>(Resource.Id.etLogs);
            tvStatus = FindViewById <TextView>(Resource.Id.tvStatusServer);
            sIps     = FindViewById <Spinner>(Resource.Id.sIps);

            bStartServer.Click  += StartServerOnClick;
            bStopServer.Click   += StopServerOnClick;
            bLoadPlaylist.Click += LoadPlaylistOnClick;
            bNewVersion.Click   += NewVersion;

            var ips = Tools.GetIPAddresses();

            if (ips.Length > 0)
            {
                var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerItem);

                foreach (var ipAddress in ips)
                {
                    adapter.Add(ipAddress.ToString());
                }
                sIps.Adapter = adapter;

                string ip = SettingManager.GetValue(SettingManager.LastIp);
                if (string.IsNullOrEmpty(ip))
                {
                    ip = ips[0].ToString();
                }
                sIps.SetSelection(adapter.GetPosition(ip));

                // if (httpServer == null) {
                bStartServer.PerformClick();

                /* } else {
                 *   etLogs.Text = logs;
                 *   if (httpServer != null && !httpServer.IsWork) {
                 *       tvStatus.Text = GetString(Resource.String.StartStatus);
                 *       bStartServer.Enabled = false;
                 *       bStopServer.Enabled = true;
                 *   }
                 * }*/
            }
            System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
        }
Exemplo n.º 25
0
        public void SetupitemsSpinner()
        {
            adapter = new ArrayAdapter <string>(Context, Android.Resource.Layout.SimpleSpinnerDropDownItem, lstitems);
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            itemspinner.Adapter = adapter;

            itemspinner.ItemSelected += Itemspinner_ItemSelected;
            if (ExpenseItemName != null && FragTagName == "Edit Expense")
            {
                int spinnerPosition = adapter.GetPosition(ExpenseItemName);
                itemspinner.SetSelection(spinnerPosition + 1);
            }
        }
Exemplo n.º 26
0
        private void LoadData()
        {
            EditText trxdate = FindViewById <EditText> (Resource.Id.newinv_date);
            DateTime invdate = Utility.ConvertToDate(trxdate.Text);
            Spinner  spinner = FindViewById <Spinner> (Resource.Id.newinv_custcode);
            EditText remark  = FindViewById <EditText> (Resource.Id.newinv_custname);
            TextView cninvno = FindViewById <TextView> (Resource.Id.newcninv_no);
            TextView cnno    = FindViewById <TextView> (Resource.Id.newinv_no);

            trxdate.Text = cnInfo.invdate.ToString("dd-MM-yyyy");
            int pos1 = dataAdapter.GetPosition(cnInfo.custcode + " | " + cnInfo.description);

            spinner.SetSelection(pos1);
            remark.Text  = cnInfo.remark;
            cninvno.Text = cnInfo.invno;
            cnno.Text    = cnInfo.cnno;
            if (!string.IsNullOrEmpty(cnInfo.invno))
            {
                spinner.Enabled = false;
                Button butFind = FindViewById <Button> (Resource.Id.newinv_bfind);
                butFind.Enabled = false;
            }
        }
Exemplo n.º 27
0
 private void loadAccount(int accountPK)
 {
     //go through each account and update the account with the new balance
     foreach (Account act in MainActivity.accounts)
     {
         if (act.PK == accountPK)
         {
             name.Text         = act.Name;
             note.Text         = act.Note;
             startBalance.Text = act.InitialBalance.ToString();
             accountType.SetSelection(accountTypeAdapter.GetPosition(act.Type));
             break;
         }
     }
 }
        public void SetupCurrencySpinner()
        {
            adapter = new ArrayAdapter <CurrencySymbols>(this, Resource.Layout.spinner_row, lstCurrencySymbols);
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            currencyspinner.Adapter = adapter;


            prefs = PreferenceManager.GetDefaultSharedPreferences(this);
            var mString = prefs.GetString("CurrencyTextSelected", "");

            var val             = lstCurrencySymbols.Where(x => x.Currency == mString).FirstOrDefault();
            int spinnerPosition = adapter.GetPosition(val);

            currencyspinner.SetSelection(spinnerPosition);
            // currencyspinner.OnItemSelectedListener = AdapterView.IOnItemSelectedListener;
        }
Exemplo n.º 29
0
        void SetupClassSpinner(View view)
        {
            spinItem     = view.FindViewById <Spinner> (Resource.Id.txtClass);
            dAdapterItem = new ArrayAdapter <String> (this.Activity, Resource.Layout.spinner_item, classcodes);
            dAdapterItem.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
            spinItem.Adapter       = dAdapterItem;
            spinItem.ItemSelected += SpinItem_ItemSelected;
            string selectclass = ((GlobalvarsApp)Application.Context).ITEMCLASS;

            if (!string.IsNullOrEmpty(selectclass))
            {
                int pos = dAdapterItem.GetPosition(selectclass);
                if (pos > -1)
                {
                    spinItem.SetSelection(pos);
                }
            }
        }
Exemplo n.º 30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.new_project_layout);
            projects = RedMineManager.Get <ProjectsContainer>("/projects.json");

            toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
            toolbar.SetTitle(Resource.String.NewProject);
            SetSupportActionBar(toolbar);

            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_arrow_back_white_18dp);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            ImageView BSubmit = new ImageView(this);

            BSubmit.SetImageResource(Resource.Drawable.ic_save_white_18dp);

            LinearLayout LLControls = FindViewById <LinearLayout>(Resource.Id.right_controls);

            LLControls.AddView(BSubmit);

            ETName         = FindViewById <EditText>(Resource.Id.name);
            ETIdentifier   = FindViewById <EditText>(Resource.Id.identifier);
            ETHomePage     = FindViewById <EditText>(Resource.Id.home_page);
            CBIsPublic     = FindViewById <CheckBox>(Resource.Id.is_public);
            SParent        = FindViewById <Spinner>(Resource.Id.parent);
            ETDescrtiption = FindViewById <EditText>(Resource.Id.description);

            BSubmit.Click += BSubmit_Click;

            var query = from r in projects.projects
                        select r.name;

            List <string> parents = new List <string> {
                "None"
            };

            parents.AddRange(query.ToList());

            var parentAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, parents);

            SParent.Adapter = parentAdapter;
            SParent.SetSelection(parentAdapter.GetPosition("None"));
        }
Exemplo n.º 31
0
        // Replace the contents of a view (invoked by the layout manager)
        public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
        {
            var item = Items[position];

            var vh = viewHolder as VegeViewHolder;
            var spinnerPos = 0;
            var adapter =new ArrayAdapter<String>(Context, Android.Resource.Layout.SimpleSpinnerItem, _quantity);
            adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);

            vh.Name.Text = item.Name;
            vh.Price.Text = string.Format("Price: ${0}",item.Price);
            vh.ItemView.Tag = position;
            if (item.Quantity > 0) {
                spinnerPos = adapter.GetPosition (item.Quantity.ToString ());
                vh.TotalAmount.Text = string.Format ("${0}", item.Price * item.Quantity);
            } else {
                vh.TotalAmount.Text = "";
            }
            vh.Quantity.Tag = position; //keep reference to list view row position
            vh.Quantity.Adapter = adapter;
            vh.Quantity.SetSelection (spinnerPos);
            vh.Image.SetImageResource (item.ImageId);
        }
Exemplo n.º 32
0
 void SetupClassSpinner(View view)
 {
     spinItem = view.FindViewById<Spinner> (Resource.Id.txtClass);
     dAdapterItem = new ArrayAdapter<String> (this.Activity, Resource.Layout.spinner_item, classcodes);
     dAdapterItem.SetDropDownViewResource (Resource.Layout.SimpleSpinnerDropDownItemEx);
     spinItem.Adapter = dAdapterItem;
     spinItem.ItemSelected+= SpinItem_ItemSelected;
     string selectclass = ((GlobalvarsApp)Application.Context).ITEMCLASS;
     if (!string.IsNullOrEmpty (selectclass)) {
         int pos = dAdapterItem.GetPosition (selectclass);
         if (pos>-1)
             spinItem.SetSelection (pos);
     }
 }