Exemplo n.º 1
0
        private void TxtSalaryDateOnTouch(object sender, View.TouchEventArgs e)
        {
            try
            {
                if (e.Event.Action != MotionEventActions.Down)
                {
                    return;
                }

                var dialogList = new MaterialDialog.Builder(this).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light);

                TypeDialog = "SalaryDate";

                var arrayAdapter = WoWonderTools.GetSalaryDateList(this).Select(item => item.Value).ToList();

                dialogList.Title(GetText(Resource.String.Lbl_SalaryDate));
                dialogList.Items(arrayAdapter);
                dialogList.NegativeText(GetText(Resource.String.Lbl_Close)).OnNegative(this);
                dialogList.AlwaysCallSingleChoiceCallback();
                dialogList.ItemsCallback(this).Build().Show();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Exemplo n.º 2
0
 public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
 {
     try
     {
         if (TypeDialog == "Categories")
         {
             CategoryId       = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesName == itemString.ToString())?.CategoriesId;
             TxtCategory.Text = itemString.ToString();
         }
         else if (TypeDialog == "JobType")
         {
             JobTypeId       = WoWonderTools.GetJobTypeList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
             TxtJobType.Text = itemString.ToString();
         }
         else if (TypeDialog == "SalaryDate")
         {
             SalaryDateId       = WoWonderTools.GetSalaryDateList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
             TxtSalaryDate.Text = itemString.ToString();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                switch (TypeDialog)
                {
                case "Categories":
                    CategoryId       = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesName == itemString.ToString())?.CategoriesId;
                    TxtCategory.Text = itemString.ToString();
                    break;

                case "JobType":
                    JobTypeId       = WoWonderTools.GetJobTypeList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    TxtJobType.Text = itemString.ToString();
                    break;

                case "SalaryDate":
                    SalaryDateId       = WoWonderTools.GetSalaryDateList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    TxtSalaryDate.Text = itemString.ToString();
                    break;
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                if (TypeDialog == "Categories")
                {
                    CategoryId       = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesName == itemString.ToString())?.CategoriesId;
                    TxtCategory.Text = itemString.ToString();
                }
                else if (TypeDialog == "JobType")
                {
                    JobTypeId       = WoWonderTools.GetJobTypeList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    TxtJobType.Text = itemString.ToString();
                }
                else if (TypeDialog == "SalaryDate")
                {
                    SalaryDateId       = WoWonderTools.GetSalaryDateList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    TxtSalaryDate.Text = itemString.ToString();
                }
                else if (TypeDialog == "Currency")
                {
                    TxtCurrency.Text = itemString.ToString();
                    CurrencyId       = itemId.ToString();
                }
                else if (TypeDialog == "AddQuestion")
                {
                    TxtAddQuestion.Text = GetText(Resource.String.Lbl_AddQuestion) + "(" + MAdapter.ItemCount + ")";

                    var addQuestionId = WoWonderTools.GetAddQuestionList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    //SetQuestionOne(addQuestionId);
                    MAdapter.QuestionList.Add(new QuestionJob()
                    {
                        Id           = MAdapter.ItemCount,
                        QuestionType = addQuestionId
                    });
                    MAdapter.NotifyItemInserted(MAdapter.QuestionList.IndexOf(MAdapter.QuestionList.Last()));
                }
                else if (TypeDialog == "AddQuestionAdapter")
                {
                    TxtAddQuestion.Text = GetText(Resource.String.Lbl_AddQuestion) + "(" + MAdapter.ItemCount + ")";

                    var addQuestionId = WoWonderTools.GetAddQuestionList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();

                    var data = MAdapter.QuestionList.FirstOrDefault(a => a.Id == ItemQuestionJob.Id && a.QuestionType == ItemQuestionJob.QuestionType);
                    if (data != null)
                    {
                        data.QuestionType = addQuestionId;
                        MAdapter.NotifyItemChanged(MAdapter.QuestionList.IndexOf(data));
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void OnSelection(MaterialDialog p0, View p1, int itemId, ICharSequence itemString)
        {
            try
            {
                switch (TypeDialog)
                {
                case "Categories":
                    CategoryId       = CategoriesController.ListCategoriesJob.FirstOrDefault(categories => categories.CategoriesName == itemString.ToString())?.CategoriesId;
                    TxtCategory.Text = itemString.ToString();
                    break;

                case "JobType":
                    JobTypeId       = WoWonderTools.GetJobTypeList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    TxtJobType.Text = itemString.ToString();
                    break;

                case "SalaryDate":
                    SalaryDateId       = WoWonderTools.GetSalaryDateList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    TxtSalaryDate.Text = itemString.ToString();
                    break;

                case "Currency":
                    TxtCurrency.Text = itemString.ToString();
                    CurrencyId       = WoWonderTools.GetIdCurrency(itemString.ToString());
                    break;

                case "AddQuestion":
                {
                    TxtAddQuestion.Text = GetText(Resource.String.Lbl_AddQuestion) + "(" + MAdapter.ItemCount + ")";

                    var addQuestionId = WoWonderTools.GetAddQuestionList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();
                    //SetQuestionOne(addQuestionId);
                    MAdapter.QuestionList.Add(new QuestionJob
                        {
                            Id           = MAdapter.ItemCount,
                            QuestionType = addQuestionId
                        });
                    MAdapter.NotifyItemInserted(MAdapter.QuestionList.IndexOf(MAdapter.QuestionList.Last()));
                    break;
                }

                case "AddQuestionAdapter":
                {
                    TxtAddQuestion.Text = GetText(Resource.String.Lbl_AddQuestion) + "(" + MAdapter.ItemCount + ")";

                    var addQuestionId = WoWonderTools.GetAddQuestionList(this)?.FirstOrDefault(a => a.Value == itemString.ToString()).Key.ToString();

                    var data = MAdapter.QuestionList.FirstOrDefault(a => a.Id == ItemQuestionJob.Id && a.QuestionType == ItemQuestionJob.QuestionType);
                    if (data != null)
                    {
                        data.QuestionType = addQuestionId;
                        MAdapter.NotifyItemChanged(MAdapter.QuestionList.IndexOf(data));
                    }

                    break;
                }
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }