private void btnSend_Click(object sender, RoutedEventArgs e) { var realtrip = new Trip(); var trip = new TripModel(); //fyller modellen med information realtrip.origin = (int)cbCountryDeparture.SelectedValue; realtrip.destination = (int)cbCountryArrival.SelectedValue; realtrip.start = (DateTime)dpStartDate.SelectedDate; realtrip.end = (DateTime)dpEndDate.SelectedDate; var prepay = tbPrepaySum.Text; int prepaySum; int.TryParse(prepay, out prepaySum); realtrip.prepayment = prepaySum; realtrip.note = tbMotivation.Text; realtrip.boss = (int)cbBosses.SelectedItem; realtrip.user = HandleItems.GetCurrentUserId(); //validerar informationen som hämtats ut or boxarna if (Validering.CheckPrepaySum((int)realtrip.prepayment)) { var FullTrip = new FullTrip(); FullTrip.myTrip = ModelTransformer.Trip2TripModel(realtrip); foreach (Vacation item in lbVacations.Items) { FullTrip.myVacation.Add(ModelTransformer.Vacation2VacationModel(item)); } // DB!!! //TripRepository.AddTrip(realtrip); //foreach(var item in FullTrip.myVacation) //{ // var vacation = ModelTransformer.VacationModel2Vacation(item); // vacation.tripID = realtrip.tripID; // VacationsRepository.AddVacation(vacation); //} Serializer.Save(FullTrip); ClearFieldsAndReloadBoxes(); } }
public RapportHantering() { InitializeComponent(); HandleItems.FillBossList(cbBosses); LoadReseUtlägg(); HandleItems.FillCbsWithCountries(cbCountryArrival, cbCountryDeparture); HandleItems.FillListBoxWithAwaitingApproval(lbReportsDenied); var bosses = UserHandling.getBosses(); for (int i = 0; i < bosses.Count; i++) { if (bosses[i].userID == HandleItems.GetCurrentUserId()) { bossFound = true; } } if (bossFound == false) { tab3.Visibility = Visibility.Hidden; tab4.Visibility = Visibility.Hidden; tab5.Visibility = Visibility.Hidden; } if (HandleItems.GetCurrentUserId() == 0) { tab3.Visibility = Visibility.Hidden; tab4.Visibility = Visibility.Hidden; tab5.Visibility = Visibility.Hidden; tbSearchAnstIdDenied.IsEnabled = false; btnGetReportsDenied.IsEnabled = false; tbSearchAnstIdApproved.IsEnabled = false; btnGetReportsApproved.IsEnabled = false; anvInstallningar.IsEnabled = false; } }
private void Button_Click_2(object sender, RoutedEventArgs e) { AddUser.UpdateUser(HandleItems.GetCurrentUserId(), tbxUpdatePhone, tbxUpdateEmail); FillUserInformation(); }
private void Button_Click_1(object sender, RoutedEventArgs e) { AddUser.ChangePassword(HandleItems.GetCurrentUserId(), tbxNewPassword1, tbxNewPassword2, tbxOldPassword); }
public void FillUserInformation() { AddUser.FillUserInformation(HandleItems.GetCurrentUserId(), tbxUpdatePhone, tbxUpdateEmail); }