public void ChangeTo(Matter old, Matter anew) { if (old.IdMatter != anew.IdMatter && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Предмет \"{anew}\" уже существует!"); } old.Name = anew.Name; base.Sort(); if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdMatter", "P" + anew.IdMatter.ToString() }, { "Name", anew.Name } }; server.UpdateInto("Matters", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(Semester old, Semester anew) { if (old.IdSemester != anew.IdSemester && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Семестр \"{anew}\" уже существует!"); } old.Number = anew.Number; base.Sort(); // -- Changed = true; // добавлено 29.06.2019 if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdSemester", "P" + anew.IdSemester.ToString() }, { "Number", anew.Number } }; server.UpdateInto("Semesters", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(Specialization old, Specialization anew) { if (old.IdSpecialization != anew.IdSpecialization && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Специализация \"{anew}\" уже существует!"); } old.Name = anew.Name; old.IdSpeciality = anew.IdSpeciality; base.Sort(); // -- Changed = true; // добавлено 29.06.2019 if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdSpecialization", "P" + anew.IdSpecialization.ToString() }, { "Name", anew.Name }, { "IdSpeciality", "P" + anew.IdSpeciality.ToString() } }; server.UpdateInto("Specializations", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(StudyGroup old, StudyGroup anew) { if (old.IdStudyGroup != anew.IdStudyGroup && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Группа \"{anew}\" уже существует!"); } old.Number = anew.Number; old.TrainingPeriod = anew.TrainingPeriod; old.IdSpeciality = anew.IdSpeciality; old.IdSpecialization = anew.IdSpecialization; base.Sort(); if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdStudyGroup", "P" + anew.IdStudyGroup.ToString() }, { "Number", anew.Number }, { "TrainingPeriod", anew.TrainingPeriod }, { "IdSpeciality", "P" + anew.IdSpeciality.ToString() }, { "IdSpecialization", "P" + anew.IdSpecialization.ToString() } }; server.UpdateInto("StudyGroups", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(Teacher old, Teacher anew) { if (old.IdTeacher != anew.IdTeacher && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Преподаватель \"{anew}\" уже существует!"); } old.FullName = anew.FullName; old.IdMatter = anew.IdMatter; old.Login = anew.Login; old.Password = anew.Password; base.Sort(); if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdTeacher", "P" + anew.IdTeacher.ToString() }, { "FullName", anew.FullName }, { "IdMatter", "P" + anew.IdMatter.ToString() }, { "Login", anew.Login }, { "Password", anew.Password } }; server.UpdateInto("Teachers", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(Speciality old, Speciality anew) { if (old.IdSpeciality != anew.IdSpeciality && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Специальность \"{anew}\" уже существует!"); } old.Name = anew.Name; old.Number = anew.Number; base.Sort(); if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdSpeciality", "P" + anew.IdSpeciality.ToString() }, { "Name", anew.Name }, { "Number", anew.Number } }; server.UpdateInto("Specialities", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(Student old, Student anew) { if (old.IdStudent != anew.IdStudent && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Студент \"{anew}\" уже существует!"); } old.FullName = anew.FullName; old.BirthDay = anew.BirthDay; old.EducationCertificate = anew.EducationCertificate; old.ReceiptDate = anew.ReceiptDate; old.Address = anew.Address; old.PhoneNumber = anew.PhoneNumber; old.SocialStatus = anew.SocialStatus; old.Notes = anew.Notes; old.Photo = anew.Photo.DeepClone(); old.IdSpeciality = anew.IdSpeciality; old.IdSpecialization = anew.IdSpecialization; old.IdStudyGroup = anew.IdStudyGroup; base.Sort(); // -- Changed = true; // добавлено 29.06.2019 if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdStudent", "P" + anew.IdStudent.ToString() }, { "FullName", anew.FullName }, { "BirthDay", anew.BirthDay }, { "EducationCertificate", anew.EducationCertificate }, { "ReceiptDate", anew.ReceiptDate }, { "Address", anew.Address }, { "PhoneNumber", anew.PhoneNumber }, { "SocialStatus", anew.SocialStatus }, { "Notes", anew.Notes }, { "Photo", anew.Photo ?? new byte[] { } }, { "IdSpeciality", "P" + anew.IdSpeciality.ToString() }, { "IdSpecialization", "P" + anew.IdSpecialization.ToString() }, { "IdStudyGroup", "P" + anew.IdStudyGroup.ToString() } }; server.UpdateInto("Students", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(MattersCourse old, MattersCourse anew) { if (old.IdMattersCourse != anew.IdMattersCourse && base.FindAll(x => x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Курс \"{anew}\" уже существует!"); } old.IdSpeciality = anew.IdSpeciality; old.IdSpecialization = anew.IdSpecialization; old.IdMatter = anew.IdMatter; old.CourseType = anew.CourseType; old.RatingSystem = anew.RatingSystem; old.HoursCount = anew.HoursCount; base.Sort(); // -- Changed = true; // добавлено 29.06.2019 if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdMattersCourse", "P" + anew.IdMatter.ToString() }, { "IdSpeciality", "P" + anew.IdSpeciality.ToString() }, { "IdSpecialization", "P" + anew.IdSpecialization.ToString() }, { "IdMatter", "P" + anew.IdMatter.ToString() }, { "CourseType", anew.CourseType }, { "RatingSystem", anew.RatingSystem }, { "HoursCount", anew.HoursCount } }; server.UpdateInto("MattersCourses", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }
public void ChangeTo(Performance old, Performance anew) { if (old.IdPerformance != anew.IdPerformance && base.FindAll(x => x.IdStudent != anew.IdStudent && x.ToString().Trim() == anew.ToString().Trim()).Count > 0) { throw new Exception($"Успеваемость \"{anew}\" уже существует!"); } old.IdSemester = anew.IdSemester; old.IdMatter = anew.IdMatter; old.Grade = anew.Grade; old.IdStudent = anew.IdStudent; base.Sort(); // -- Changed = true; // добавлено 29.06.2019 if (!Loaded) { return; } var server = new OleDbServer { Connection = Helper.ConnectionString }; var columns = new Dictionary <string, object> { { "IdPerformance", "P" + anew.IdPerformance.ToString() }, { "IdSemester", "P" + anew.IdSemester.ToString() }, { "IdMatter", "P" + anew.IdMatter.ToString() }, { "Grade", anew.Grade }, { "IdStudent", "P" + anew.IdStudent.ToString() } }; server.UpdateInto("Performances", columns); if (!string.IsNullOrWhiteSpace(server.LastError)) { throw new Exception(server.LastError); } }