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 = "Добавить студента";
 }
示例#4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the students EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTostudents(student student)
 {
     base.AddObject("students", student);
 }
示例#5
0
 /// <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;
 }
示例#6
0
 public void SetData(student st)
 {
     this.Student = st;
 }
示例#7
0
文件: DBModel.cs 项目: Deiwos3/IMS
 public void DeleteStudent(student s)
 {
     CheckConnection();
     try
     {
         lock (locker)
         {
             DeletePerson(s.person);
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw new DBException(ErrorTypes.UnexpectedException, ex);
     }
 }
示例#8
0
文件: DBModel.cs 项目: Deiwos3/IMS
 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);
     }
 }