Exemple #1
0
 /// <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);
     }
 }
Exemple #2
0
 /// <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
 }
Exemple #3
0
 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);
     }
 }
Exemple #4
0
        /// <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
        }
Exemple #5
0
 /// <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
 }
Exemple #6
0
 /// <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
 }
Exemple #7
0
 /// <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
 }
Exemple #8
0
 /// <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
 }
Exemple #9
0
 /// <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
 }
Exemple #10
0
 /// <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
 }
Exemple #11
0
 //查询所有学生
 public List <Student> GetAllStudent()
 {
     #region
     using (var db = new dimsContext())
     {
         var query = db.Student
                     .FromSql("select * from dims.Student")
                     .ToList();
         return(query);
     }
     #endregion
 }
Exemple #12
0
 /// <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
 }
Exemple #13
0
 /// <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
 }
Exemple #14
0
 public bool RegistLeave(Livingschool livingschool)
 {
     #region
     using (var db = new dimsContext())
     {
         livingschool.Llivingdate = DateTime.Now;
         db.Livingschool.Add(livingschool);
         db.SaveChanges();
         return(true);
     }
     #endregion
 }
Exemple #15
0
 /// <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
 }
Exemple #16
0
 /// <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
 }
Exemple #17
0
 /// <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
 }
Exemple #18
0
 /// <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
 }
Exemple #19
0
 /// <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
 }
Exemple #20
0
 /// <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
 }
Exemple #21
0
 /// <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
 }
Exemple #22
0
 /// <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);
 }
Exemple #23
0
 /// <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
 }
Exemple #24
0
 /// <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
 }
Exemple #25
0
 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
 }
Exemple #26
0
 /// <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
 }
Exemple #27
0
 /// <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
 }
Exemple #28
0
 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
 }
Exemple #29
0
 /// <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
 }
Exemple #30
0
 /// <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
 }