本文整理汇总了C#中SEMS.DAL.SEMSDBContext类的典型用法代码示例。如果您正苦于以下问题:C# SEMSDBContext类的具体用法?C# SEMSDBContext怎么用?C# SEMSDBContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SEMSDBContext类属于SEMS.DAL命名空间,在下文中一共展示了SEMSDBContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNewsList
/// <summary>
/// 获取特定公告
/// </summary>
public static News GetNewsList( int news_id )
{
using (var db = new SEMSDBContext())
{
return db.News.Find(news_id);
}
}
示例2: GetAdministrater
/// <summary>
/// 获取管理员信息
/// </summary>
/// <returns></returns>
public static Administrater GetAdministrater( string uid )
{
using (var db = new SEMSDBContext())
{
return db.Administrater.Find(uid);
}
}
示例3: DelClass
/// <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;
}
}
示例4: GetPolicy
/// <summary>
/// 获取相应模块的政策
/// </summary>
public static Policy GetPolicy(string module_id)
{
using (var db = new SEMSDBContext())
{
return db.Policy.FirstOrDefault(x => x.module_id == module_id);
}
}
示例5: GetAllEvaluation_entryCount
/// <summary>
/// 获取所有项目总数(所有学年学期)
/// </summary>
public static int GetAllEvaluation_entryCount()
{
using (var db = new SEMSDBContext())
{
return db.Evaluation_entry.Count();
}
}
示例6: AddClass
/// <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;
}
}
示例7: GetSysinfo
/// <summary>
/// 获取当前系统表
/// </summary>
public static Sysinfo GetSysinfo()
{
using (var db = new SEMSDBContext())
{
return db.Sysinfo.FirstOrDefault();
}
}
示例8: GetMoudle_score
/// <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!
}
}
示例9: TestChangePassword
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);
}
}
示例10: GetPolicyList
/// <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();
}
}
示例11: GetEvaluation_year
/// <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);
}
}
示例12: GetEvaluation_yearId
/// <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;
}
}
示例13: GetModuleList
/// <summary>
/// 返回全部模块
/// </summary>
public static List<Module> GetModuleList( )
{
try
{
using (var db = new SEMSDBContext())
{
return db.Module.ToList();
}
}
catch
{
return null;
}
}
示例14: FindEvaluation_entry
/// <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;
}
}
示例15: AddLk_evaluation_year_classes
/// <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;
}
}