Beispiel #1
0
        private async void TapGestureRecognizer_BtnSaveDates(object sender, EventArgs e)
        {
            if (this.PeriodValidationLabel.IsVisible)
            {
                this.PeriodValidationLabel.IsVisible = false;
            }

            var totalDays = this.EndDate.Date - this.StartDate.Date;

            if (totalDays.Days.Equals(10) || totalDays.Days.Equals(20) || totalDays.Days.Equals(30))
            {
                var vacationPeriod = new SpentVacations()
                {
                    IDEmployee = this.Vacation.IDEmployee, RefYear = this.Vacation.RefYear, DateStart = this.StartDate.Date, DateEnd = this.EndDate.Date, TotalDays = totalDays.Days
                };
                SaveVacationPeriod(vacationPeriod);
                ViewModelCollection.VacationDetails.Vacations.Add(vacationPeriod);
                await ViewModelCollection.VacationDetails.ExecuteLoadItemsCommand();

                this.CloseAllPopup();
            }
            else
            {
                this.PeriodValidationLabel.IsVisible = true;
            }
        }
 public Task <int> SaveSpentVacationsAsync(SpentVacations spentVacations)
 {
     if (spentVacations.ID != 0)
     {
         return(_database.UpdateAsync(spentVacations));
     }
     else
     {
         return(_database.InsertAsync(spentVacations));
     }
 }
        public VacationDetailViewModel(SpentVacations item = null)
        {
            Title                   = "Vacations Details";
            this.Vacations          = new ObservableCollection <SpentVacations>();
            LoadItemsCommand        = new Command(async() => await ExecuteLoadItemsCommand());
            TapCommand_DeletePeriod = new Command(DeleteVacationPeriodCommand);

            if (item != null)
            {
                this.Vacation = new SpentVacations();
                this.Vacation = item;
            }
            else
            {
                Vacation = new SpentVacations();
            }
        }
Beispiel #4
0
 async void SaveVacationPeriod(SpentVacations vac)
 {
     await App.Database._spentVacations.SaveSpentVacationsAsync(vac);
 }
Beispiel #5
0
        public DateRangePopup(SpentVacations Vacation)
        {
            InitializeComponent();

            this.Vacation = Vacation;
        }
 public Task <int> DeleteSpentVacationsAsync(SpentVacations spentVacations)
 {
     return(_database.DeleteAsync(spentVacations));
 }