Beispiel #1
0
 public int PatchRecoveryStuInfo(List <Guid> stuids)
 {
     using (var db = new sim.StuInfoEntities()) {
         return(db.StuInfo.Where(c => stuids.Contains(c.StuID)).Update(c => new sim.StuInfo {
             IsState = 1
         }));
     }
 }
Beispiel #2
0
 public bool DeleteStuInfo(Guid stuid)
 {
     using (var db = new sim.StuInfoEntities()) {
         sim.StuInfo si = GetStuInfo(stuid);
         si.IsState = 0;
         return(ModifyStuInfo(si));
     }
 }
Beispiel #3
0
 public bool RecoveryStuInfo(Guid stuid)
 {
     using (var db = new sim.StuInfoEntities()) {
         sim.StuInfo si = GetStuInfo(stuid, false);
         si.IsState = 1;
         return(ModifyStuInfo(si));
     }
 }
Beispiel #4
0
 public int GetStuCount(Guid schid, Guid bjid, string stunumber, string stucode, string stuidentity, string stuname, bool bstate = true)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (bstate)
         {
             return(db.vwStuInfo.Count(si => si.StuID_SchID == schid && si.StuID_BJID == bjid && si.IsState == 1 && si.StuName.Contains(stuname) && si.StuCode.Contains(stucode) && si.StuIdentity.Contains(stuidentity) && si.StuNumber.Contains(stunumber)));
         }
         else
         {
             return(db.vwStuInfo.Count(si => si.StuID_SchID == schid && si.StuID_BJID == bjid && si.StuName.Contains(stuname) && si.StuCode.Contains(stucode) && si.StuIdentity.Contains(stuidentity) && si.StuNumber.Contains(stunumber)));
         }
     }
 }
Beispiel #5
0
 /// <summary>
 /// 获取班级学生
 /// </summary>
 /// <param name="schid"></param>
 /// <param name="bjid"></param>
 /// <param name="stunumber"></param>
 /// <param name="stucode"></param>
 /// <param name="stuidentity"></param>
 /// <param name="stuname"></param>
 /// <param name="maxrecord"></param>
 /// <returns></returns>
 public List <sim.vwStuInfo> GetStuList(Guid schid, Guid bjid, string stunumber, string stucode, string stuidentity, string stuname, int maxrecord = 1000, bool bstate = true)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (bstate)
         {
             return(db.vwStuInfo.Where(si => si.StuID_SchID == schid && si.StuID_BJID == bjid && si.IsState == 1 && si.StuName.Contains(stuname) && si.StuCode.Contains(stucode) && si.StuIdentity.Contains(stuidentity) && si.StuNumber.Contains(stunumber)).OrderBy(si => si.StuNumber).Take(maxrecord).ToList());
         }
         else
         {
             return(db.vwStuInfo.Where(si => si.StuID_SchID == schid && si.StuID_BJID == bjid && si.StuName.Contains(stuname) && si.StuCode.Contains(stucode) && si.StuIdentity.Contains(stuidentity) && si.StuNumber.Contains(stunumber)).OrderBy(si => si.StuNumber).Take(maxrecord).ToList());
         }
     }
 }
Beispiel #6
0
 public sim.vwStuInfo GetStuInfo(Guid stuid, bool bstate = true)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (bstate)
         {
             return(db.vwStuInfo.SingleOrDefault(si => si.StuID == stuid && si.IsState == 1));
         }
         else
         {
             return(db.vwStuInfo.SingleOrDefault(si => si.StuID == stuid));
         }
     }
 }
Beispiel #7
0
 public int GetStuCount(string stunumber, string stucode, string stuidentity, string stuname, bool bstate = true)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (bstate)
         {
             return(db.StuInfo.Count(si => si.IsState == 1 && si.StuName.Contains(stuname) || si.StuCode.Contains(stucode) || si.StuIdentity.Contains(stuidentity) || si.StuNumber.Contains(stunumber)));
         }
         else
         {
             return(db.StuInfo.Count(si => si.StuName.Contains(stuname) || si.StuCode.Contains(stucode) || si.StuIdentity.Contains(stuidentity) || si.StuNumber.Contains(stunumber)));
         }
     }
 }
Beispiel #8
0
 /// <summary>
 /// 模糊查询
 /// </summary>
 /// <param name="stunumber">学号</param>
 /// <param name="stucode">学籍号</param>
 /// <param name="stuidentity">身份证号</param>
 /// <param name="stuname">姓名</param>
 /// <returns></returns>
 public List <sim.StuInfo> GetStuList(string stunumber, string stucode, string stuidentity, string stuname, int maxrecord = 1000, bool bstate = true)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (bstate)
         {
             return(db.StuInfo.Where(si => si.IsState == 1 && si.StuName.Contains(stuname) || si.StuCode.Contains(stucode) || si.StuIdentity.Contains(stuidentity) || si.StuNumber.Contains(stunumber)).OrderByDescending(si => si.StuID_BJID).ThenBy(si => si.StuNumber).Take(maxrecord).ToList());
         }
         else
         {
             return(db.StuInfo.Where(si => si.StuName.Contains(stuname) || si.StuCode.Contains(stucode) || si.StuIdentity.Contains(stuidentity) || si.StuNumber.Contains(stunumber)).OrderByDescending(si => si.StuID_BJID).ThenBy(si => si.StuNumber).Take(maxrecord).ToList());
         }
     }
 }
Beispiel #9
0
 public bool AddStuInfo(sim.StuInfo si)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (!IsExistStu(si.StuID, si.StuCode, si.StuIdentity))
         {
             db.StuInfo.Add(si);
             if (db.SaveChanges() == 1)
             {
                 return(true);
             }
         }
         return(false);
     }
 }
Beispiel #10
0
 public bool ModifyStuInfo(sim.StuInfo si)
 {
     using (var db = new sim.StuInfoEntities()) {
         if (!IsExistStu(si.StuID, si.StuCode, si.StuIdentity))
         {
             DbEntityEntry <sim.StuInfo> entityEntry = db.Entry(si);
             entityEntry.State = EntityState.Modified;
             if (db.SaveChanges() == 1)
             {
                 return(true);
             }
         }
         return(false);
     }
 }
Beispiel #11
0
 public int GetStuCount(Expression <Func <sim.vwStuInfo, bool> > filterexpression)
 {
     using (var db = new sim.StuInfoEntities()) {
         return(db.vwStuInfo.Count(filterexpression));
     }
 }
Beispiel #12
0
 /// <summary>
 /// 开放式条件查询学生信息
 /// </summary>
 /// <param name="filterexpression"></param>
 /// <returns></returns>
 public List <sim.vwStuInfo> GetStuList(Expression <Func <sim.vwStuInfo, bool> > filterexpression, int top = 1000)
 {
     using (var db = new sim.StuInfoEntities()) {
         return(db.vwStuInfo.Where(filterexpression).OrderByDescending(si => si.StuID_BJID).ThenBy(si => si.StuNumber).Take(top).ToList());
     }
 }
Beispiel #13
0
 public bool IsExistStu(Guid stuid, string stucode, string stuidentity)
 {
     using (var db = new sim.StuInfoEntities()) {
         return(db.StuInfo.Any(si => (si.StuCode == stucode || si.StuIdentity == stuidentity) && si.StuID != stuid));
     }
 }