Exemple #1
0
 /// <summary>
 /// 获取特定公告
 /// </summary>
 public static News GetNewsList( int news_id )
 {
     using (var db = new SEMSDBContext())
     {
         return db.News.Find(news_id);
     }
 }
Exemple #2
0
 /// <summary>
 /// 获取管理员信息
 /// </summary>
 /// <returns></returns>
 public static Administrater GetAdministrater( string uid )
 {
     using (var db = new SEMSDBContext())
     {
         return db.Administrater.Find(uid);
     }
 }
Exemple #3
0
        /// <summary>
        /// 删除班级
        /// </summary>
        ///<returns>成功返回true</returns>
        public static bool DelClass(string class_id, string class_small_id)
        {
            try
            {
                using (var db = new SEMSDBContext())
                {
                    var toDel=db.Classes.Find(class_id,class_small_id);         //所有需要级联更新删除的地方数据库里都建好了。。不用这样写,删就是了
                                                                        //... on delete cascade on update cascade)...

                    //foreach (var temp in db.Student.Where(x => x.class_id == class_id && x.class_small_id == class_small_id))
                    //{
                    //    StudentBS.DelStudent(temp.student_id);
                    //    db.Student.Remove(temp);
                    //}
                    //foreach (var temp in db.Lk_evaluation_year_classes.Where(x => x.class_id == class_id && x.class_small_id == class_small_id))
                    //{
                    //    Lk_evaluation_year_classesBS.DelLk_evaluation_year_classes(temp.evaluation_year_id, temp.class_id, temp.class_small_id);
                    //    db.Lk_evaluation_year_classes.Remove(temp);
                    //}
                    db.Classes.Remove(toDel);
                    db.SaveChanges();
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
Exemple #4
0
 /// <summary>
 /// 获取所有公告列表
 /// </summary>
 public static List<News> GetNewsList()
 {
     using (var db = new SEMSDBContext())
     {
         return db.News.ToList();
     }
 }
Exemple #5
0
 /// <summary>
 /// 获取相应模块的政策
 /// </summary>
 public static Policy GetPolicy(string module_id)
 {
     using (var db = new SEMSDBContext())
     {
         return db.Policy.FirstOrDefault(x => x.module_id == module_id);
     }
 }
 /// <summary>
 /// 获取所有项目总数(所有学年学期)
 /// </summary>
 public static int GetAllEvaluation_entryCount()
 {
     using (var db = new SEMSDBContext())
     {
         return db.Evaluation_entry.Count();
     }
 }
Exemple #7
0
 /// <summary>
 /// 添加新班级
 /// </summary>
 ///<returns>成功返回true</returns>
 public static bool AddClass(Classes model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             /*var classes = new Classes()
             {
                 class_grade = model.class_grade,
                 class_id = model.class_id,
                 class_small_id = model.class_small_id
             };*/
             db.Classes.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch (DbEntityValidationException e)
     {
         Debug.WriteLine(e.Message);
         return false;
     }
     catch
     {
         return false;
     }
 }
Exemple #8
0
 /// <summary>
 /// 获取当前系统表
 /// </summary>
 public static Sysinfo GetSysinfo()
 {
     using (var db = new SEMSDBContext())
     {
         return db.Sysinfo.FirstOrDefault();
     }
 }
Exemple #9
0
 /// <summary>
 /// 返回模块成绩
 /// </summary>
 public static int GetMoudle_score(string student_id, string module_id, string evaluation_school_year, string evaluation_semester)
 {
     using (var db = new SEMSDBContext())
     {
         var score = db.Module_score.FirstOrDefault(x => x.student_id == student_id && x.module_id == module_id && x.evaluation_school_year == evaluation_school_year && x.evaluation_semester == evaluation_semester);
         return score == null ? 0 : score.score;     //如果找不到总成绩,说明成绩为0!
     }
 }
Exemple #10
0
 public static void TestChangePassword()
 {
     using (var db = new SEMSDBContext())
     {
         Administrater temp = db.Administrater.FirstOrDefault();
         Console.WriteLine(temp.admin_pwd);
         //AdministraterBS.ChangePassword(temp.admin_id, "123456", temp.admin_pwd);
         //Console.WriteLine("{0}", temp.admin_pwd);
     }
 }
Exemple #11
0
 /// <summary>
 /// 获取所有政策列表
 /// </summary>
 public static List<Policy> GetPolicyList()
 {
     using (var db = new SEMSDBContext())
     {
         var query = from p in db.Policy
                     where p.module_id == "M1"
                     select p;
         return db.Policy.ToList();
     }
 }
        /// <summary>
        /// 查找测评年
        /// </summary>
        public static Evaluation_year GetEvaluation_year( int evaluation_id )
        {
            using (var db = new SEMSDBContext())
            {
                //var query = from p in db.Evaluation_year
                //            where p.evaluation_year_id==1
                //            select p;

                return db.Evaluation_year.Find(evaluation_id);
            }
        }
 /// <summary>
 /// 根据测评年名称返回ID
 /// </summary>
 /// <param name="evaluation_year_name"></param>
 /// <returns></returns>
 public static int GetEvaluation_yearId(string evaluation_year_name)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             return db.Evaluation_year.FirstOrDefault(x => x.evaluation_year_name == evaluation_year_name).evaluation_year_id;
         }
     }
     catch
     {
         return 0;
     }
 }
Exemple #14
0
 /// <summary>
 /// 返回全部模块
 /// </summary>
 public static List<Module> GetModuleList( )
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             return db.Module.ToList();
         }
     }
     catch
     {
         return null;
     }
 }
 /// <summary>
 /// 查找测评项目
 /// </summary>
 /// <param name="entry_id">待查找项目的ID</param>
 /// <returns></returns>
 public static Evaluation_entry FindEvaluation_entry( int entry_id )
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             Evaluation_entry temp = db.Evaluation_entry.Find(entry_id);
             return temp;
         }
     }
     catch
     {
         return null;
     }
 }
 /// <summary>
 /// 添加测评年班级链接表
 /// </summary>
 public static bool AddLk_evaluation_year_classes(Lk_evaluation_year_classes model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Lk_evaluation_year_classes.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// 添加新测评项目
 /// </summary>
 /// <param name="module_id">要添加的项目</param>
 /// <returns></returns>
 public static bool AddEvaluation_entry(Evaluation_entry model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Evaluation_entry.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// 删除测评年
 /// </summary>
 public static bool DelEvaluation_year(int evaluation_year_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Evaluation_year.Find(evaluation_year_id);
             db.Evaluation_year.Remove(temp);
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #19
0
 /// <summary>
 /// 添加管理员用户
 /// </summary>
 public static bool AddAdministrater(Administrater model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Administrater.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// 删除测评年班级链接表
 /// </summary>
 public static bool DelLk_evaluation_year_classes(int evaluation_year_id, string class_id, string class_small_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Lk_evaluation_year_classes.Find(evaluation_year_id, class_id, class_small_id);
             db.Lk_evaluation_year_classes.Remove(temp);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #21
0
 /// <summary>
 /// 删除管理员账户
 /// </summary>
 public static bool DelAdministrater(string uid)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Administrater.Find(uid);
             db.Administrater.Remove(temp);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #22
0
 /// <summary>
 /// 添加新公告
 /// </summary>
 public static bool AddNews(News model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.News.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch (Exception ee)
     {
         throw ee.InnerException;
         //return false;
     }
 }
Exemple #23
0
 /// <summary>
 /// 删除学生信息
 /// </summary>
 /// <param name="class_id">学号</param>
 /// <returns>成功返回true</returns>
 public static bool DelStudent(string student_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Student.Find(student_id);
             db.Student.Remove(temp);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #24
0
 /// <summary>
 /// 添加新学生
 /// </summary>
 /// <param name="model">要添加的学生</param>
 /// <returns>成功返回true</returns>
 public static bool AddStudent(Student model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Student.Add(model);
             db.SaveChanges();
         }
         return true;
     }
     catch// (Exception ee)
     {
         //throw ee.InnerException;
         return false;
     }
 }
Exemple #25
0
 /// <summary>
 ///  删除公告
 /// </summary>
 public static bool DelNews(int news_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.News.Find(news_id);
             db.News.Remove(temp);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #26
0
 /// <summary>
 /// 修改管理员密码
 /// </summary>
 public static bool ChangePassword(string uid, string pwd,string oldPwd)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var admin = db.Administrater.FirstOrDefault(x => x.admin_id == uid);
             if (admin == null) return false;
             admin.admin_pwd = pwd;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
 /// <summary>
 /// 删除测评项目
 /// </summary>
 public static bool DelEvaluation_entry(int entry_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Evaluation_entry.Find(entry_id);
             //Entry_scoreBS.AllDelEntry_score(entry_id);
             db.Evaluation_entry.Remove(temp);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #28
0
 /// <summary>
 /// 修改系统表
 /// </summary>
 public static bool ModifySysinfo(Sysinfo model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Sysinfo.FirstOrDefault();
             temp.sysinfo_id = model.sysinfo_id;
             temp.sysinfo_school_year = model.sysinfo_school_year;
             temp.sysinfo_semester = model.sysinfo_semester;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #29
0
 /// <summary>
 /// 批量修改项目成绩
 /// </summary>
 /// <param name="entry_id">项目ID</param>
 /// <param name="score">待改分数</param>
 public static bool AllModifyEntry_score(int entry_id, int score)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             foreach (var temp in db.Entry_score.Where(x => x.entry_id == entry_id))
             {
                 temp.score = score;
             }
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #30
0
 /// <summary>
 /// 批量删除学生信息
 /// </summary>
 public static bool AllDelStudent(string class_id, string class_small_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             foreach (var temp in db.Student.Where(x => x.class_id == class_id && x.class_small_id == class_small_id))
             {
                 db.Student.Remove(temp);
             }
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }