Пример #1
0
        private void Category_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(Category_button_Click));

            var fr = SimpleListViewDialogFragment <Category> .NewInstance(title : Resources.GetString(Resource.String.Category),
                                                                          lst : lstCategory,
                                                                          onSelectedItem : delegate(Category selectedItem)
            {
                category_button.Text = selectedItem.Description;
                category_button.Tag  = new JavaLangObjectWrapper <Category>(selectedItem);

                var r = db.SetAllDefault <Category>(false).Result;

                selectedItem.IsDefault = true;

                if (db.Update(selectedItem).Result)
                {
                    Toast.MakeText(this.Activity, Resource.String.Saved, ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(this.Activity, Resource.String.WasntSaved, ToastLength.Short).Show();
                }
            });

            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <Category> .TAG);
        }
Пример #2
0
        private void PaymentType_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(PaymentType_button_Click));

            var fr = SimpleListViewDialogFragment <PaymentType> .NewInstance(lstPaymentType, delegate(PaymentType selectedItem)
            {
                paymentType_button.Text = selectedItem.Description;
                paymentType_button.Tag  = new JavaLangObjectWrapper <PaymentType>(selectedItem);

                var r = db.SetAllDefault <PaymentType>(false).Result;

                selectedItem.IsDefault = true;
                if (db.Update(selectedItem).Result)
                {
                    Toast.MakeText(this.Activity, Resource.String.Saved, ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(this.Activity, Resource.String.WasntSaved, ToastLength.Short).Show();
                }
            }, Resources.GetString(Resource.String.PaymentType));

            fr.Dialog?.SetTitle(Resource.String.PaymentType);
            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <PaymentType> .TAG);
        }
Пример #3
0
        private void Owner_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(Owner_button_Click));

            var fr = SimpleListViewDialogFragment <Owner> .NewInstance(lstOwner, delegate(Owner selectedItem)
            {
                owner_button.Text = selectedItem.Name;
                owner_button.Tag  = new JavaLangObjectWrapper <Owner>(selectedItem);

                var r = db.SetAllDefault <Owner>(false).Result;

                selectedItem.IsDefault = true;

                if (db.Update(selectedItem).Result)
                {
                    Toast.MakeText(this.Activity, Resource.String.Saved, ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(this.Activity, Resource.String.WasntSaved, ToastLength.Short).Show();
                }
            }, Resources.GetString(Resource.String.Owner));

            fr.Dialog?.SetTitle(Resource.String.Owner);
            fr.Dialog?.SetTitle("Nejaky nazev");
            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <Owner> .TAG);
        }
Пример #4
0
        private void Interval_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(Interval_button_Click));

            var fr = SimpleListViewDialogFragment <Interval> .NewInstance(lstInterval, delegate(Interval selectedItem)
            {
                interval_button.Text = selectedItem.Description;
                interval_button.Tag  = new JavaLangObjectWrapper <Interval>(selectedItem);
            },
                                                                          Resources.GetString(Resource.String.Interval));

            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <Interval> .TAG);
        }
Пример #5
0
        private void Category_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(Category_button_Click));

            var fr = SimpleListViewDialogFragment <Category> .NewInstance(lstCategory, delegate(Category selectedItem)
            {
                category_button.Text = selectedItem.Description;
                category_button.Tag  = new JavaLangObjectWrapper <Category>(selectedItem);
            },
                                                                          Resources.GetString(Resource.String.Category));

            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <Category> .TAG);
        }
Пример #6
0
        private void PaymentType_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(PaymentType_button_Click));

            var fr = SimpleListViewDialogFragment <PaymentType> .NewInstance(lstPaymentType, delegate(PaymentType selectedItem)
            {
                paymentType_button.Text = selectedItem.Description;
                paymentType_button.Tag  = new JavaLangObjectWrapper <PaymentType>(selectedItem);
            },
                                                                             Resources.GetString(Resource.String.PaymentType));

            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <PaymentType> .TAG);
        }
Пример #7
0
        private void Owner_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(Owner_button_Click));

            var fr = SimpleListViewDialogFragment <Owner> .NewInstance(lstOwner, delegate(Owner selectedItem)
            {
                owner_button.Text = selectedItem.Name;
                owner_button.Tag  = new JavaLangObjectWrapper <Owner>(selectedItem);
            },
                                                                       Resources.GetString(Resource.String.Owner));

            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <Owner> .TAG);
        }
Пример #8
0
        private void Category_rem_button_Click(object sender, EventArgs e)
        {
            Log.Debug(TAG, nameof(Category_rem_button_Click));

            var fr = SimpleListViewDialogFragment <Category> .NewInstance(lstCategory, delegate(Category selectedItem)
            {
                //category_button.Text = selectedItem.Description;
                //category_button.Tag = new JavaLangObjectWrapper<Category>(selectedItem);

                bool r = db.Delete <Category>(selectedItem).Result;

                if (selectedItem.IsDefault)
                {
                    var item = db.Select <Category, int>((o) => o.Id > 0, (o) => o.Id).Result.FirstOrDefault();
                    if (item != null)
                    {
                        item.IsDefault = true;

                        if (db.Update(item).Result)
                        {
                            Toast.MakeText(this.Activity, Resource.String.Saved, ToastLength.Short).Show();
                        }
                        else
                        {
                            Toast.MakeText(this.Activity, Resource.String.WasntSaved, ToastLength.Short).Show();
                        }

                        //category_button.Text = item.Description;
                        //category_button.Tag = new JavaLangObjectWrapper<Category>(item);
                    }
                    else
                    {
                        //category_button.Text = string.Empty;
                        //category_button.Tag = null;// new JavaLangObjectWrapper<Category>(item);
                    }
                }

                LoadData();
                InitLayout();
            }, Resources.GetString(Resource.String.Category));

            fr.Show(this.Activity.FragmentManager, SimpleListViewDialogFragment <Category> .TAG);
        }