Ejemplo n.º 1
0
        /*
         * Create By 蒋予飞
         * 列举所有教务
         */
        public List <Dean> listAllDeans()
        {
            DeanDBContext deanDB = new DeanDBContext();
            var           dean   = deanDB.deans.ToList();

            return(dean);
        }
Ejemplo n.º 2
0
        /*
         * Create By 蒋予飞
         * 通过ID获取教务
         */
        public Dean getDeanById(string id)
        {
            DeanDBContext deanDB = new DeanDBContext();
            Dean          dean   = deanDB.deans.Find(id);

            return(dean);
        }
Ejemplo n.º 3
0
 /*
  * Create By 蒋予飞
  * 添加教务
  */
 public int addDean(Dean dean)
 {
     try
     {
         DeanDBContext deanDB = new DeanDBContext();
         deanDB.deans.Add(dean);
         return(deanDB.SaveChanges());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Ejemplo n.º 4
0
 /*
  * Create By 蒋予飞
  * 通过ID删除教务
  */
 public int deleteDeanById(string id)
 {
     try
     {
         DeanDBContext deanDB = new DeanDBContext();
         Dean          dean   = deanDB.deans.Find(id);
         deanDB.deans.Remove(dean);
         return(deanDB.SaveChanges());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Ejemplo n.º 5
0
 /*
  * Create By 蒋予飞
  * 按教务ID更新密码
  */
 public int changeDeanPasswdById(string id, string password)
 {
     try
     {
         DeanDBContext deanDB = new DeanDBContext();
         Dean          dean   = deanDB.deans.Find(id);
         dean.password = password;
         return(deanDB.SaveChanges());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Ejemplo n.º 6
0
 /*
  * Create By 蒋予飞
  * 更新教务信息
  */
 public int updateDean(Dean indean)
 {
     try
     {
         DeanDBContext deanDB = new DeanDBContext();
         Dean          dean   = deanDB.deans.Find(indean.id);
         dean.name     = indean.name;
         dean.password = indean.password;
         dean.majorId  = indean.majorId;
         dean.remark   = indean.remark;
         return(deanDB.SaveChanges());
     }
     catch (Exception e)
     {
         return(-1);
     }
 }
Ejemplo n.º 7
0
        /*
         * Create By 高晔
         * 创建和初始化本地数据库
         */
        public static void initLocalDB()
        {
            StudentDBContext studentDB = new StudentDBContext();

            studentDB.students.Find("");
            AdminDBContext adminDB = new AdminDBContext();

            adminDB.admins.Find("");
            DeanDBContext deanDB = new DeanDBContext();

            deanDB.deans.Find("");
            ProfessorDBContext professorDB = new ProfessorDBContext();

            professorDB.professors.Find("");
            SettingDBContext settingDBContext = new SettingDBContext();
            //settingDBContext.settings.Find("");
            MajorDBContext majorDBContext = new MajorDBContext();

            majorDBContext.majors.Find(0);
        }