private void SearchByGradesMethon(object parameter)
        {
            IDataAccess idata = new DataServerse();
               List<StuInfoTable> resultList = idata.Search(stu => stu.Grades==SSModel.SGrades);

               SSModel.StuCollection = new ObservableCollection<StuInfoTable>(resultList);
        }
        public void AddStudent(StuInfoTable stuTable)
        {
            StudentsInfoDBEntities StuDB = new StudentsInfoDBEntities();
               try
               {
               IDataAccess idata = new DataServerse();
               int getId = idata.Search((StuInfoTable stu) => stu.ID == stuTable.ID).Take(1).Count();
               if (getId != 1)
               {
                   StuDB.StuInfoTable.Add(stuTable);
                   StuDB.SaveChanges();
                   MessageBox.Show("成功添加1条信息!");
               }
               else
                   MessageBox.Show("学号已存在!");

               }
               catch (Exception e)
               {
               MessageBox.Show("添加数据发生异常:" + e.Message);
               }
               finally
               {
               StuDB.Dispose();
               }
        }
        private void DeleteDataMethod(object parameter)
        {
            DataGrid dg = parameter as DataGrid;
               IDataAccess idata = new DataServerse();

               StuInfoTable select = dg.SelectedItem as StuInfoTable;

               if (select != null)
               {
               int result = idata.DeleteStudent(select);

               if (result != 0)
                   SSModel.StuCollection.Remove(select);
               }
        }
        private void AddStuMethod(object parameter)
        {
            IDataAccess iData = new DataServerse();
               StuInfoTable stuTable = new StuInfoTable()
               {
               ID = StudentModel.ID,
               Name = StudentModel.Name,
               Age = StudentModel.Age,
               Sex = StudentModel.Sex,
               Birthday = StudentModel.Birthday,
               PhoneNumber = StudentModel.PhoneNumber,
               Address = StudentModel.Address,
               Grades = StudentModel.Grades
               };

                iData.AddStudent(stuTable);
        }