public GroupScheduleForm(GroupSchedule schedule) { InitializeComponent(); groupSchedule = schedule; txtName.Text = groupSchedule.Name; if (groupSchedule.Access) { rbGrant.Checked = true; } else { rbDeny.Checked = true; } if (!groupSchedule.DateFrom.HasValue) { dateFrom.Value = DateTime.Now; chkDateFrom.Checked = false; } else { dateFrom.Value = groupSchedule.DateFrom.Value; chkDateFrom.Checked = true; } if (!groupSchedule.DateTo.HasValue) { dateTo.Value = DateTime.Now; chkDateTo.Checked = false; } else { dateTo.Value = groupSchedule.DateTo.Value; chkDateTo.Checked = true; } if (!groupSchedule.TimeFrom.HasValue) { timeFrom.Value = DateTime.Now.Date.Add(new TimeSpan(0, 0, 0)); timeTo.Value = DateTime.Now.Date.Add(new TimeSpan(23, 59, 59)); chkTimeInterval.Checked = false; } else { timeFrom.Value = DateTime.Now.Date.Add(groupSchedule.TimeFrom.Value); timeTo.Value = DateTime.Now.Date.Add(groupSchedule.TimeTo.Value); chkTimeInterval.Checked = true; } chkMon.Checked = groupSchedule.Mondays; chkTue.Checked = groupSchedule.Tuesdays; chkWed.Checked = groupSchedule.Wednesdays; chkThu.Checked = groupSchedule.Thursdays; chkFri.Checked = groupSchedule.Fridays; chkSat.Checked = groupSchedule.Saturdays; chkSun.Checked = groupSchedule.Sundays; }
/// <summary> /// Retuns the best task placements based on travel time and employee workhours /// </summary> /// <param name="task"></param> /// <param name="groupSchedule"></param> /// <returns></returns> public Dictionary <EmployeeSchedule, int> CalcTaskPlacement(TaskItem task, GroupSchedule groupSchedule) { Dictionary <EmployeeSchedule, int> result = new Dictionary <EmployeeSchedule, int>(); //returnerer en dictionary med employeeschedules, og placering (int index) i employeeSchedule // tjek hvilken emploeeSchedule har plads til task // tjek hvor der er mindst køretid return(result); }
private void CurrentDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { DateTime?date = CurrentDatePicker.SelectedDate; if (date != null && GroupSchedules.ContainsKey(date)) { SelectedGroupSchedule = GroupSchedules[date]; LoadSchedule(); } else if (date != null) { SchedulePanel.Children.Clear(); } }
public GroupSchedule GetByGroupId(int id) { var result = new GroupSchedule() { EvenWeek = new Dictionary <DaysWeek, IEnumerable <Lesson> >(), OstWeek = new Dictionary <DaysWeek, IEnumerable <Lesson> >() }; using (var connection = new SqlConnection(_connectionString)) { using (var command = new SqlCommand("[dbo].[GetScheduleByGroupId]", connection)) { command.CommandType = CommandType.StoredProcedure; command.AddIdParameter("@Id", id); connection.Open(); using (var reader = command.ExecuteReader()) { // Считывание расписание занятий var lessons = new List <LessonSqlEntity>(); while (reader.Read()) { lessons.Add(reader.ReadLesson()); } if (lessons.Count > 0) { result.EvenWeek = lessons.Where(l => l.IsEven).GroupBy(l => l.DayWeek).ToDictionary(g => g.Key, l => l.Select(l => l.MapToLesson())); result.OstWeek = lessons.Where(l => !l.IsEven).GroupBy(l => l.DayWeek).ToDictionary(g => g.Key, l => l.Select(l => l.MapToLesson())); } if (reader.NextResult()) { // Считывание расписания сессии, если оно заполнено var exams = new List <Exam>(); while (reader.Read()) { exams.Add(reader.ReadExam()); } result.Exams = exams; } } } } return(result); }
void scheduleEdit_Click(object sender, EventArgs e) { GroupSchedule schedule = lvGroupSchedules.SelectedItems[0].Tag as GroupSchedule; using (GroupScheduleForm form = new GroupScheduleForm(schedule)) { Hide(); DialogResult result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { HasSchedulesChanges = true; lvGroupSchedules.SelectedItems[0].Text = schedule.Name; lvGroupSchedules.SelectedItems[0].SubItems[1].Text = schedule.ToString(); } Show(); } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { AreYouSureWindow newWindow = new AreYouSureWindow("Er du sikker på at du vil fjerne opgaven?"); newWindow.ShowDialog(this); if (newWindow.IsAccepted) { Assignment a = Job.Presenter.Assignment; EmployeeSchedule es = a.EmployeeSchedule; GroupSchedule g = es.GroupSchedule; es.RemoveAssignment(a); g.UnplanAssignment(a); Close(); } }
void scheduleNew_Click(object sender, EventArgs e) { GroupSchedule schedule = new GroupSchedule(currentGroup.ID, "", true); using (GroupScheduleForm form = new GroupScheduleForm(schedule)) { Hide(); DialogResult result = form.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { HasSchedulesChanges = true; ListViewItem item = new ListViewItem(new string[] { schedule.Name, schedule.ToString() }); item.Tag = schedule; lvGroupSchedules.Items.Add(item); } Show(); } }
private void SaveCurrentGroup() { if (IsNew) { currentGroup.Name = txtName.Text; currentGroup.Description = txtDescription.Text; Groups.InsertGroup(currentGroup); foreach (ListViewItem item in lvGroupZones.Items) { GroupZone zone = item.Tag as GroupZone; zone.GroupID = currentGroup.ID; GroupZones.InsertZone(zone); } foreach (ListViewItem item in lvGroupSchedules.Items) { GroupSchedule schedule = item.Tag as GroupSchedule; schedule.GroupID = currentGroup.ID; GroupSchedules.InsertSchedule(schedule); } var groups = Groups.GetAllGroups(); lvGroups.BeginUpdate(); lvGroups.Items.Clear(); groups.ForEach(group => { ListViewItem item = new ListViewItem(new string[] { group.Name, group.Description }); item.Tag = group; lvGroups.Items.Add(item); if (group.ID == currentGroup.ID) { item.Selected = true; } }); lvGroups.EndUpdate(); } else { if (HasGroupChanges) { currentGroup.Name = txtName.Text; currentGroup.Description = txtDescription.Text; Groups.UpdateGroup(currentGroup); lvGroups.SelectedItems[0].Text = currentGroup.Name; lvGroups.SelectedItems[0].SubItems[1].Text = currentGroup.Description; } if (HasZonesChanges) { GroupZones.DeleteZones(currentGroup.ID); foreach (ListViewItem item in lvGroupZones.Items) { GroupZone zone = item.Tag as GroupZone; GroupZones.InsertZone(zone); } } if (HasSchedulesChanges) { GroupSchedules.DeleteSchedules(currentGroup.ID); foreach (ListViewItem item in lvGroupSchedules.Items) { GroupSchedule schedule = item.Tag as GroupSchedule; GroupSchedules.InsertSchedule(schedule); } } } }
private void TemplateComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedGroupSchedule = TemplateComboBox.SelectedItem as GroupSchedule; LoadSchedule(); }
public void DeleteScheduleTemplate(GroupSchedule templateSchedule, Group group) { //unassigned taskDescriptions needs to be placed in clipboard in groupAdmin }
/// <summary> /// Creates a new daily schedule /// </summary> /// <param name="date"></param> /// <param name="groupschedule"></param> /// <param name="startTime"></param> public void CreateNewEmployeeSchedule(DateTime date, GroupSchedule groupschedule, TimeSpan startTime) { EmployeeSchedule employeeSchedule = new EmployeeSchedule(date, startTime); groupschedule.EmployeeSchedules.Add(employeeSchedule); }
public string GetScheduleInfo(GroupSchedule groupSchedule) { return(groupSchedule.ToString()); }
/// <summary> /// Approves the group schedule. /// </summary> /// <param name="groupSchedule">Group schedule that has to be approved</param> /// <param name="status">Status of approval</param> public void ApproveSchedule(GroupSchedule groupSchedule, bool status) { groupSchedule.Approval(status); }