public StudentsManagementWindow(student s) { InitializeComponent(); curStudent = s; IsEdit = true; Title = "Изменить студента"; InitFields(); }
private void SaveButton_Click(object sender, RoutedEventArgs e) { try { if (Check()) { if (DetectChanges()) { PControl.Save(); person p = PControl.newPerson; string acc = PControl.Account; string grName = GroupTextBox.Text; DateTime dateIn = DateInPicker.SelectedDate.Value; DateTime? dateOut = DateOutPicker.SelectedDate; if (IsEdit) { DBController.Instance.EditStudent(curStudent.Id, grName, p, dateIn, dateOut); Message.Show("Изменения успешно внесены", MessageTypes.Information); DialogResult = true; } else { curStudent = DBController.Instance.AddStudent(acc, grName, p, dateIn, dateOut); Message.Show("Студент добавлен", MessageTypes.Information); DialogResult = true; } } else { DialogResult = false; } } } catch (DBException ex) { Message.Show(ex.Message, MessageTypes.Error); } catch (Exception ex) { LogService.WriteException(ex); } }
public StudentsManagementWindow() { InitializeComponent(); curStudent = new student(); Title = "Добавить студента"; }
/// <summary> /// Deprecated Method for adding a new object to the students EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTostudents(student student) { base.AddObject("students", student); }
/// <summary> /// Create a new student object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="personId">Initial value of the PersonId property.</param> /// <param name="groupId">Initial value of the GroupId property.</param> /// <param name="dateIn">Initial value of the DateIn property.</param> public static student Createstudent(global::System.Int64 id, global::System.Int64 personId, global::System.Int64 groupId, global::System.DateTime dateIn) { student student = new student(); student.Id = id; student.PersonId = personId; student.GroupId = groupId; student.DateIn = dateIn; return student; }
public void SetData(student st) { this.Student = st; }
public void DeleteStudent(student s) { CheckConnection(); try { lock (locker) { DeletePerson(s.person); db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }
public void EditStudent(student std, studentsgroup sg, person p, DateTime dateIn, DateTime? dateOut = null) { CheckConnection(); try { lock (locker) { EditPerson(std.person, p.First_Name, p.Last_Name, p.Middle_Name, p.Birthday, p.H_Phone, p.M_Phone, p.Address, p.Email, p.SomeInformation, p.Photo); std.GroupId = sg.Id; std.DateIn = dateIn; std.DateOut = dateOut; db.SaveChanges(); } } catch (Exception ex) { throw new DBException(ErrorTypes.UnexpectedException, ex); } }