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 string ParsePairTypeFromEnum(TypeOfPair pairType) { string res = null; switch (pairType) { case TypeOfPair.First: res = "Перша"; break; case TypeOfPair.Second: res = "Друга"; break; case TypeOfPair.Third: res = "Третя"; break; case TypeOfPair.Fourth: res = "Четверта"; break; case TypeOfPair.Fifth: res = "П'ята"; break; } return(res); }
private TypeOfPair ParsePairType(string pairType) { TypeOfPair res = TypeOfPair.First; switch (pairType) { case "Перша": res = TypeOfPair.First; break; case "Друга": res = TypeOfPair.Second; break; case "Третя": res = TypeOfPair.Third; break; case "Четверта": res = TypeOfPair.Fourth; break; case "П'ята": res = TypeOfPair.Fifth; break; } return(res); }
private string ConvertPairTypeToTime(TypeOfPair pairType) { string res = null; switch (pairType) { case TypeOfPair.First: res = "08:30:00"; break; case TypeOfPair.Second: res = "10:25:00"; break; case TypeOfPair.Third: res = "12:20:00"; break; case TypeOfPair.Fourth: res = "14:15:00"; break; case TypeOfPair.Fifth: res = "16:10:00"; break; } return(res); }
public StudingTheSubject(Guid id, Guid subjId, Guid grId, Guid teachId, DayOfWeek day, TypeOfWeek typeOfWeek, TypeOfPair typeOfPair, int classroom) : base(id) { _subjectId = subjId; _groupId = grId; _teacherId = teachId; _day = day; _typeOfWeek = typeOfWeek; _typeOfPair = typeOfPair; _classroom = classroom; }
public List <StudingTheSubject> GetPair(DateTime date) { List <StudingTheSubject> result = new List <StudingTheSubject>(); DataTable pairTable = TableData.SelectByRule("StudingTheSubject", "StudentProgressDB", new List <string>() { "TeacherID", "Day", "TypeOfWeek", "TypeOfPair" }, new List <string>() { _teacherId.ToString(), date.DayOfWeek.ToString(), GetTypeOfWeek(date).ToString(), GetTypeOfPair(date).ToString() }); if (pairTable.Rows.Count == 0) { return(result); } foreach (DataRow pair in pairTable.Rows) { Guid pairId = Guid.Parse(pair[0].ToString()); if (StudingTheSubject.Items.Keys.Contains(pairId)) { result.Add(StudingTheSubject.Items[pairId]); } else { Guid subjId = Guid.Parse(pair[1].ToString()); Guid grId = Guid.Parse(pair[2].ToString()); DayOfWeek day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), pair[4].ToString(), true); TypeOfWeek weekType = (TypeOfWeek)Enum.Parse(typeof(TypeOfWeek), pair[5].ToString(), true); TypeOfPair pairType = (TypeOfPair)Enum.Parse(typeof(TypeOfPair), pair[6].ToString(), true); int room = Int32.Parse(pair[7].ToString()); result.Add(new StudingTheSubject(pairId, subjId, grId, _teacherId, day, weekType, pairType, room)); } } return(result); }
public static List <StudingTheSubject> GetAllPairs(Teacher teacher) { List <StudingTheSubject> pairs = new List <StudingTheSubject>(); DataTable pairsTable = TableData.SelectByRule("StudingTheSubject", "StudentProgressDB", new List <string>() { "TeacherID" }, new List <string>() { teacher.Id.ToString() }); if (pairsTable.Rows.Count == 0) { return(pairs); } foreach (DataRow pair in pairsTable.Rows) { Guid pairId = Guid.Parse(pair[0].ToString()); if (StudingTheSubject.Items.Keys.Contains(pairId)) { pairs.Add(StudingTheSubject.Items[pairId]); } else { Guid grId = Guid.Parse(pair[2].ToString()); Guid teachId = Guid.Parse(pair[3].ToString()); Guid subjId = Guid.Parse(pair[1].ToString()); DayOfWeek day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), pair[4].ToString()); TypeOfWeek weekType = (TypeOfWeek)Enum.Parse(typeof(TypeOfWeek), pair[5].ToString()); TypeOfPair pairType = (TypeOfPair)Enum.Parse(typeof(TypeOfPair), pair[6].ToString()); int room = Int32.Parse(pair[7].ToString()); pairs.Add(new StudingTheSubject(pairId, subjId, grId, teachId, day, weekType, pairType, room)); } } return(pairs); }
private string ParsePairTypeFromEnum(TypeOfPair pairType) { string res = null; switch (pairType) { case TypeOfPair.First: res = "Перша"; break; case TypeOfPair.Second: res = "Друга"; break; case TypeOfPair.Third: res = "Третя"; break; case TypeOfPair.Fourth: res = "Четверта"; break; case TypeOfPair.Fifth: res = "П'ята"; break; } return res; }
private string ConvertPairTypeToTime(TypeOfPair pairType) { string res = null; switch(pairType) { case TypeOfPair.First: res = "08:30:00"; break; case TypeOfPair.Second: res = "10:25:00"; break; case TypeOfPair.Third: res = "12:20:00"; break; case TypeOfPair.Fourth: res = "14:15:00"; break; case TypeOfPair.Fifth: res = "16:10:00"; break; } return res; }