/// <summary> /// 获取学生晚归信息 /// </summary> /// <param name="lno"></param> /// <param name="sno"></param> /// <returns></returns> public Latereturn GetLatereturnDetail(int lno, string sno) { using (var dbcontext = new dimsContext()) { var query = dbcontext.Latereturn .FirstOrDefault(l => l.Lno == lno && l.Sno == sno); return(query); } }
/// <summary> /// 添加快件 /// </summary> /// <param name="fastmail"></param> /// <returns></returns> public bool AddFastMail(Fastmail fastmail) { #region using (var dbcontext = new dimsContext()) { dbcontext.Fastmail.Add(fastmail); return(true); } #endregion }
public bool ModifyInfromation(Administer administer, string id) { using (var db = new dimsContext()) { var query = db.Administer .FirstOrDefault(q => q.Ano == id); query = administer; return(true); } }
/// <summary> /// 通过宿管查询楼号 /// </summary> /// <param name="ano"></param> /// <returns></returns> public string CheckBuildingThoughAno(string ano) { #region var dbcontext = new dimsContext(); var query = dbcontext.Studentbuilding .FirstOrDefault(b => b.Ano == ano); return(query.Bno); #endregion }
/// <summary> /// 获取财产信息 /// </summary> /// <param name="no"></param> /// <returns></returns> public Property GetProperty(int no) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Property .FirstOrDefault(p => p.Pno == no); return(query); } #endregion }
/// <summary> /// 通过快件号查询快件 /// </summary> /// <param name="fno"></param> /// <returns></returns> public Fastmail GetOneFastmail(int fno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Fastmail .FirstOrDefault(f => f.Fno == fno); return(query); } #endregion }
/// <summary> /// 增加保修单 /// </summary> /// <param name="repairPaper"></param> /// <returns></returns> public bool AdddRepairPaper(Repairpaper repairPaper) { #region using (var dbcontext = new dimsContext()) { dbcontext.Add(repairPaper); dbcontext.SaveChanges(); return(true); } #endregion }
/// <summary> /// 获取学生宿舍号 /// </summary> /// <param name="sno"></param> /// <returns></returns> public string GetBno(string sno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Student .FirstOrDefault(s => s.Sno == sno); return(query.Bno); } #endregion }
/// <summary> /// 添加学生 /// </summary> /// <param name="student"></param> /// <returns></returns> public bool AddStudent(Student student) { #region using (var dbcontext = new dimsContext()) { dbcontext.Student.Add(student); dbcontext.SaveChanges(); return(true); } #endregion }
/// <summary> /// 添加财产 /// </summary> /// <param name="property"></param> /// <returns></returns> public bool AddProperty(Property property) { #region using (var db = new dimsContext()) { db.Add(property); db.SaveChanges(); return(true); } #endregion }
//查询所有学生 public List <Student> GetAllStudent() { #region using (var db = new dimsContext()) { var query = db.Student .FromSql("select * from dims.Student") .ToList(); return(query); } #endregion }
/// <summary> /// 查看所有快件 /// </summary> /// <returns></returns> public List <Fastmail> GetAllFastMail() { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Fastmail .FromSql("select * from dims.Fastmail") .ToList(); return(query); } #endregion }
/// <summary> /// 查询所有的晚归信息 /// </summary> /// <returns></returns> public List <Latereturn> GetAllLaterReturn() { #region using (var db = new dimsContext()) { var query = db.Latereturn .FromSql("select * from dims.Latereturn") .ToList(); return(query); } #endregion }
public bool RegistLeave(Livingschool livingschool) { #region using (var db = new dimsContext()) { livingschool.Llivingdate = DateTime.Now; db.Livingschool.Add(livingschool); db.SaveChanges(); return(true); } #endregion }
/// <summary> /// 通过学号查询快件 /// </summary> /// <param name="sno"></param> /// <returns></returns> public List <Fastmail> GetFastmailsThoughSno(string sno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Fastmail .FromSql("select * from dims.Fastmail") .Where(f => f.Sno == sno) .ToList(); return(query); } #endregion }
/// <summary> /// 获取宿舍的所有保修单 /// </summary> /// <param name="department"></param> /// <returns></returns> public List <Repairpaper> GetRepairpaperDetail(string department) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Repairpaper .FromSql("select * from dims.Repairpaper") .Where(r => r.Bno == department) .ToList(); return(query); } #endregion }
/// <summary> /// 删除财物 /// </summary> /// <param name="pno"></param> /// <returns></returns> public bool DeletePropery(int pno) { #region using (var db = new dimsContext()) { var query = db.Property .FirstOrDefault(r => r.Pno == pno); db.Remove(query); db.SaveChanges(); return(true); } #endregion }
/// <summary> /// 查找并登记返校时间 /// </summary> /// <param name="sno"></param> /// <param name="lno"></param> /// <returns></returns> public bool RegistReturn(string sno, int lno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Latereturn .FirstOrDefault(l => l.Sno == sno && l.Lno == lno); query.Lreturntime = DateTime.Now; dbcontext.SaveChanges(); return(true); } #endregion }
/// <summary> /// 删除晚归信息 /// </summary> /// <param name="i"></param> /// <returns></returns> public bool DeleteLateReturn(int i) { #region using (var db = new dimsContext()) { var query = db.Latereturn .FirstOrDefault(l => l.Lno == i); db.Remove(query); db.SaveChanges(); return(true); } #endregion }
/// <summary> /// 根据楼栋号查询楼管 /// </summary> /// <param name="bno">楼栋号</param> /// <returns>宿管号</returns> public Administer CheckRaThoughBno(string bno) { #region using (var dbcontext = new dimsContext()) { var building = dbcontext.Studentbuilding .FirstOrDefault(b => b.Bno == bno); string ano = building.Ano; Administer administer = CheckRaThoughID(ano); return(administer); } #endregion }
/// <summary> /// 修改学生信息 /// </summary> /// <param name="student"></param> /// <param name="sno"></param> /// <returns></returns> public bool ModifyStudentInfor(Student student, string sno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Student .FirstOrDefault(s => s.Sno == sno); query = student; query.Sno = sno; dbcontext.SaveChanges(); return(true); } #endregion }
/// <summary> //管理员登录 /// </summary> /// <param name="id"></param> /// <param name="password"></param> /// <returns></returns> public bool Login(string id, string password) { #region using (var dbcontext = new dimsContext()) { foreach (var admin in dbcontext.Administer) { if (admin.Ano == id && admin.Apassword == password) { return(true); } } } #endregion return(false); }
/// <summary> /// 更改密码 /// </summary> /// <param name="id">学号</param> /// <param name="oldPassword"></param> /// <param name="newPassword"></param> /// <returns></returns> public bool NewPassword(string id, string oldPassword, string newPassword) { #region using (var dbcontext = new dimsContext()) { var student = dbcontext.Student .FirstOrDefault(s => s.Sno == id && s.Spassword == oldPassword); if (student != null) { student.Spassword = newPassword; dbcontext.SaveChanges(); return(true); } return(false); } #endregion }
/// <summary> /// 修改宿舍楼性别 /// </summary> /// <param name="sex"></param> /// <returns></returns> public bool SetDormitorySex(string sex) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Studentbuilding .FromSql("select * from dims.Studentbuilding") .ToList(); foreach (var q in query) { q.Bsex = sex; } dbcontext.SaveChanges(); return(true); } #endregion }
public bool NewPassword(string id, string oldPassword, string newPassword) { #region using (var dbcontext = new dimsContext()) { var admin = dbcontext.Administer .FirstOrDefault(a => a.Ano == id && a.Apassword == oldPassword); if (admin != null) { admin.Apassword = newPassword; dbcontext.SaveChanges(); return(true); } return(false); } #endregion }
/// <summary> /// 增加宿管 /// </summary> /// <param name="ra">代表宿管</param> /// <returns>成功返回true</returns> public bool AddRa(Administer ra) { #region try { using (var dbcontext = new dimsContext()) { dbcontext.Administer.Add(ra); dbcontext.SaveChanges(); return(true); } } catch (Exception e) { return(false); } #endregion }
/// <summary> //管理员登录 /// </summary> /// <param name="id"></param> /// <param name="password"></param> /// <returns></returns> public bool Login(string id, string password) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Student .FirstOrDefault(s => s.Sno == id && s.Spassword == password); if (query != null) { return(true); } else { return(false); } } #endregion }
public Student GetStudentDetail(string sno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Student .FirstOrDefault(s => s.Sno == sno); if (query != null) { return(query); } else { return(null); } } #endregion }
/// <summary> /// 通过id查找宿管 /// </summary> /// <param name="id">宿管id</param> /// <returns>宿管</returns> public Administer CheckRaThoughID(string id) { #region using (var dbcontext = new dimsContext()) { var ra = dbcontext.Administer .FirstOrDefault(admin => admin.Ano == id); if (ra != null) { return(ra); } else { return(null); } } #endregion }
/// <summary> /// 签收快递 /// </summary> /// <param name="sno"></param> /// <param name="fno"></param> /// <returns></returns> public bool SignFastMail(string sno, int fno) { #region using (var dbcontext = new dimsContext()) { var query = dbcontext.Fastmail .FirstOrDefault(f => f.Fno == fno && f.Sno == sno); if (query != null) { query.Fstate = "已签收"; dbcontext.SaveChanges(); return(true); } else { return(false); } } #endregion }