private void btn_add_Click(object sender, EventArgs e) { if (cb_day.Text == String.Empty || cb_pairNum.Text == String.Empty || cb_weekType.Text == String.Empty || cb_subject.Text == String.Empty || cb_group.Text == String.Empty || tb_room.Text == String.Empty) { MessageBox.Show("Заповніть всі поля атрибутів пари!", "Повідомлення", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } DayOfWeek day = ParseDayOfWeek(cb_day.Text); TypeOfPair pairType = ParsePairType(cb_pairNum.Text); TypeOfWeek weekType = ParseWeekType(cb_weekType.Text); Group gr = _groups[cb_group.SelectedIndex]; Subject subj = _subjects[cb_subject.SelectedIndex]; int room = Int32.Parse(tb_room.Text); StudingTheSubject sts = new StudingTheSubject(subj.Id, gr.Id, _teacher.Id, day, weekType, pairType, room); try { _proxy.AddPair(sts); ClearPairDetails(); LoadPairs(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_dontExist_Click(object sender, EventArgs e) { if (lv_students.SelectedIndices.Count == 0) { MessageBox.Show("Оберіть студента для фіксації відвідуваності!"); return; } Student student = _students[lv_students.SelectedIndices[0]]; StudingTheSubject pairStudent = null; foreach (var pair in _currentPair) { if (pair.GroupId == student.GroupId) { pairStudent = pair; break; } } try { _proxy.AttendStudent(student, false, pairStudent); } catch (Exception ex) { MessageBox.Show(ex.Message); } LoadStudents(); LoadStudents(); }
public void AttendStudent(Student student, bool presence, StudingTheSubject pair) { try { student.Attend(presence, pair); } catch (Exception ex) { throw new FaultException(ex.Message); } }
public int DeletePair(StudingTheSubject pair) { try { return(pair.Delete()); } catch (Exception ex) { throw new FaultException(ex.Message); } }
public int EditPair(StudingTheSubject pair, string[] newvalues) { try { return(pair.Edit(newvalues)); } catch (Exception ex) { throw new FaultException(ex.Message); } }
public int AddPair(StudingTheSubject pair) { try { return(StudingTheSubject.CreateNew(pair)); } catch (Exception ex) { throw new FaultException(ex.Message); } }
private void btn_delete_Click(object sender, EventArgs e) { if (lv_timeTable.SelectedIndices.Count == 0) { MessageBox.Show("Оберіть пару для видалення!"); return; } StudingTheSubject pair = _pairs[lv_timeTable.SelectedIndices[0]]; try { _proxy.DeletePair(pair); } catch (Exception ex) { MessageBox.Show(ex.Message, "Повідомлення", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } LoadPairs(); return; }
private void LoadStudents() { lv_students.Items.Clear(); _students = _proxy.GetAllStudents().ToList <Student>(); Guid groupId = _groups[lb_groups.SelectedIndex].Id; List <Student> studentOfGroup = new List <Student>(); foreach (Student st in _students) { if (st.GroupId == groupId) { studentOfGroup.Add(st); List <string> item = new List <string> { st.SName, st.Name, st.PName }; List <Presence> studentPresences = _proxy.GetAllPresences(st).ToList <Presence>(); StudingTheSubject pairStudent = null; foreach (var pair in _currentPair) { if (pair.GroupId == st.GroupId) { pairStudent = pair; break; } } foreach (var presence in studentPresences) { if (presence.PairId == pairStudent.Id && presence.Date == DateTime.Now.Date) { item.Add(presence.Presencing.ToString()); } } lv_students.Items.Add(new ListViewItem(item.ToArray <string>())); } } _students = studentOfGroup; }
public int DeletePair(StudingTheSubject pair) { try { return pair.Delete(); } catch (Exception ex) { throw new FaultException(ex.Message); } }
public int EditPair(StudingTheSubject pair, string[] newvalues) { try { return pair.Edit(newvalues); } catch (Exception ex) { throw new FaultException(ex.Message); } }
public int AddPair(StudingTheSubject pair) { try { return StudingTheSubject.CreateNew(pair); } catch (Exception ex) { throw new FaultException(ex.Message); } }