private void Click_MySubmit(object sender, RoutedEventArgs e) { int nextMyCleaning = dateOfCleaningDateTime.DayOfYear; int interval = Algoritm.GetIntervalBerweenUserCleaning(countUsers); int previousCleaning = SubmitLogics.GetMinDayId(results, user, PeopleWhoLiveInOneRoom); int dayCheck = SubmitLogics.GetDayOfCleaning(results, previousCleaning).DayOfYear; if (today == dayCheck || today == dayCheck + 1) { SubmiteWorkWindow window = new SubmiteWorkWindow(user, dayCheck, PeopleWhoLiveInOneRoom); window.ShowDialog(); } else { MessageBox.Show("Wait your turn to clean!"); return; } }
public ScheduleWindow(User us, UserRepository u, RoomRepository r) { InitializeComponent(); user = us; user_repo = u; room_repo = r; PeopleWhoLiveInOneRoom = SubmitLogics.MakeList(user, user_repo.Users); countUsers = PeopleWhoLiveInOneRoom.Count; user = SubmitLogics.GetUserWitnSpecialId(user, PeopleWhoLiveInOneRoom); results = ActualSchedule.GetActualSchedule(countUsers, PeopleWhoLiveInOneRoom); int dayToAdd = SwapLogics.GetMaxDayId(results, user); dateOfCleaningDateTime = SubmitLogics.GetDayOfCleaning(results, dayToAdd); CreateButtons(results); DateTime date = DateTime.Now; mThree.Text = date.AddDays(-3).ToString("MMM dd", CultureInfo.CreateSpecificCulture("en-US")); mTwo.Text = date.AddDays(-2).ToString("MMM dd", CultureInfo.CreateSpecificCulture("en-US")); mOne.Text = date.AddDays(-1).ToString("MMM dd", CultureInfo.CreateSpecificCulture("en-US")); pOne.Text = date.AddDays(+1).ToString("MMM dd", CultureInfo.CreateSpecificCulture("en-US")); pTwo.Text = date.AddDays(+2).ToString("MMM dd", CultureInfo.CreateSpecificCulture("en-US")); pThree.Text = date.AddDays(+3).ToString("MMM dd", CultureInfo.CreateSpecificCulture("en-US")); uOne.Text = PeopleWhoLiveInOneRoom[0].Name; if (PeopleWhoLiveInOneRoom.Count == 2) { uTwo.Text = PeopleWhoLiveInOneRoom[1].Name; } if (PeopleWhoLiveInOneRoom.Count == 3) { uTwo.Text = PeopleWhoLiveInOneRoom[1].Name; uThree.Text = PeopleWhoLiveInOneRoom[2].Name; } RenewSwapsSubmits(); }