Пример #1
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;
            }
        }
Пример #2
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;
     }
 }
Пример #3
0
 /// <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;
     }
 }
Пример #4
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;
     }
 }
Пример #5
0
 /// <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;
     }
 }
Пример #6
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;
     }
 }
Пример #7
0
 /// <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;
     }
 }
Пример #8
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;
     }
 }
Пример #9
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;
     }
 }
Пример #10
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;
     }
 }
Пример #11
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;
     }
 }
Пример #12
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;
     }
 }
Пример #13
0
 /// <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;
     }
 }
Пример #14
0
 /// <summary>
 /// 批量删除项目成绩
 /// </summary>
 public static bool AllDelEntry_score(int entry_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             foreach (var temp in db.Entry_score.Where(x => x.entry_id == entry_id))
             {
                 db.Entry_score.Remove(temp);
             }
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #15
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;
     }
 }
Пример #16
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;
     }
 }
Пример #17
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;
     }
 }
Пример #18
0
 /// <summary>
 /// 添加测评年
 /// </summary>
 public static bool AddEvaluation_year(int evaluation_year_id, string evaluation_year_name)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Evaluation_year.Add(new Evaluation_year()
             {
                 evaluation_year_id = evaluation_year_id,
                 evaluation_year_name = evaluation_year_name
             });
             db.SaveChanges();
             return true;
         }
     }
     catch
     {
         return false;
     }
 }
Пример #19
0
 /// <summary>
 /// 修改测评年班级链接表
 /// </summary>
 public static bool ModifyLk_evaluation_year_classes(int lk_evaluation_year_classes, string class_id, string class_small_id, Lk_evaluation_year_classes model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Lk_evaluation_year_classes.Find(lk_evaluation_year_classes, class_id, class_small_id);
             temp.class_id = model.class_id;
             temp.class_small_id = model.class_small_id;
             temp.evaluation_school_year = model.evaluation_school_year;
             temp.evaluation_semester = model.evaluation_semester;
             temp.evaluation_year_id = model.evaluation_year_id;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #20
0
 /// <summary>
 /// 添加项目成绩
 /// </summary>
 /// <param name="model">要添加的项目成绩</param>
 ///<returns>成功返回true</returns>
 public static bool AddEntry_score(Entry_score model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Entry_score.Add(model);
             /*db.Entry_score.Add(new Entry_score()
             {
                 entry_id=model.entry_id,
                 score=model.score,
                 student_id=model.student_id
             });*/
             db.SaveChanges();
         }
         return true;
     }
     catch (Exception e)
     {
         //throw e.InnerException;
         return false;
     }
 }
Пример #21
0
        /// <summary>
        /// 修改相应模块的政策
        /// </summary>
        public static bool ModifyPolicy(string module_id, Policy model)
        {
            try
            {
                using (var db = new SEMSDBContext())
                {
                    var temp = db.Policy.Find(module_id);
                    temp.policy_basic = model.policy_basic;
                    temp.policy_excellent = model.policy_excellent;
                    temp.policy_good = model.policy_good;
                    temp.policy_pass = model.policy_pass;

                    //model.module_id = temp.module_id;
                    //model.Module = temp.Module;

                    db.SaveChanges();
                }
                return true;
            }
            catch(DbEntityValidationException dbEx)
            {
                return false;
            }
        }
Пример #22
0
 /// <summary>
 /// 修改测评年
 /// </summary>
 public static bool ModifyEvaluation_year(int evaluation_year_id, Evaluation_year model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Evaluation_year.Find(evaluation_year_id);
             temp.evaluation_year_id = model.evaluation_year_id;
             temp.evaluation_year_name = model.evaluation_year_name;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #23
0
 /// <summary>
 /// 修改班级信息
 /// </summary>
 ///<returns>成功返回true</returns>
 public static bool ModifyClass(string main_id, string small_id, Classes newModel)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             Classes toChange = db.Classes.Find(main_id, small_id);
             toChange.class_grade = newModel.class_grade;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #24
0
 /// <summary>
 /// 修改管理员身份描述
 /// </summary>
 public static bool ModifyAdmin_descr(string uid,string descr)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             db.Administrater.FirstOrDefault(x => x.admin_id == uid).admin_descr = descr;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #25
0
 /// <summary>
 /// 修改班级信息
 /// </summary>
 ///<returns>成功返回true</returns>
 public static bool ModifyClass(string class_id, string class_small_id, string newClass_grade)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var classes = db.Classes.Find(class_id, class_small_id);  //.FirstOrDefault(x => x.class_id == class_id);
             classes.class_grade = newClass_grade;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #26
0
 /// <summary>
 /// 修改学生信息
 /// </summary>
 /// <param name="class_id">学号</param>
 /// <param name="model">修改后的学生信息</param>
 /// <returns>成功返回true</returns>
 public static bool ModifyStudent(string student_id, Student model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             Student temp = db.Student.Find(student_id);
             //db.Student.Attach(temp);
             temp.student_name = model.student_name;
             temp.student_sex = model.student_sex;
             temp.class_id = model.class_id;
             temp.class_small_id = model.class_small_id;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #27
0
 /// <summary>
 /// 修改项目成绩
 /// </summary>
 public static bool ModifyEntry_score( string student_id, int entry_id, int score )
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Entry_score.Find(student_id, entry_id);
             temp.score = score;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #28
0
 /// <summary>
 /// 删除项目成绩
 /// </summary>
 /// <param name="entry_id">项目ID</param>
 /// <param name="student_id">学号</param>
 public static bool DelEntry_score(string student_id, int entry_id)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Entry_score.FirstOrDefault(x => x.student_id == student_id && x.entry_id == entry_id);
             db.Entry_score.Remove(temp);
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #29
0
 /// <summary>
 /// 修改公告
 /// </summary>
 public static bool ModifyNews(int news_id, News model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.News.Find(news_id);
             temp.admin_id = model.admin_id;
             temp.new_date = model.new_date;
             temp.news_content = model.news_content;
             temp.news_title = model.news_title;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Пример #30
0
 /// <summary>
 /// 修改测评项目
 /// </summary>
 public static bool ModifyEvaluation_entry(int entry_id, Evaluation_entry model)
 {
     try
     {
         using (var db = new SEMSDBContext())
         {
             var temp = db.Evaluation_entry.Find(entry_id);
             //db.Evaluation_entry.Attach(temp);
             temp.entry_date = model.entry_date;
             temp.entry_description = model.entry_description;
             temp.entry_school_year = model.entry_school_year;
             temp.entry_semester = model.entry_semester;
             temp.module_id = model.module_id;
             db.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }