Пример #1
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
 }
Пример #2
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
 }
Пример #3
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
 }
Пример #4
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
 }
Пример #5
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
 }
Пример #6
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
 }
Пример #7
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
 }
Пример #8
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
 }
Пример #9
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
 }
Пример #10
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
 }
Пример #11
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
 }
Пример #12
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
 }
Пример #13
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
 }
Пример #14
0
 /// <summary>
 /// 变更楼管
 /// </summary>
 /// <param name="newId"></param>
 /// <param name="bno"></param>
 /// <returns></returns>
 public bool ChangeRaBuiling(string newId, string bno)
 {
     #region
     using (var dbcontext = new dimsContext())
     {
         var query = dbcontext.Studentbuilding
                     .FirstOrDefault(b => b.Bno == bno);
         if (query != null)
         {
             query.Ano = newId;
             dbcontext.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     #endregion
 }
Пример #15
0
 /// <summary>
 /// 删除一个宿管
 /// </summary>
 /// <param name="id">宿管id</param>
 /// <returns></returns>
 public bool DeleteRa(string id)
 {
     #region
     try
     {
         using (var dbcontext = new dimsContext())
         {
             var ra = dbcontext.Administer
                      .FirstOrDefault(r => r.Ano == id);
             dbcontext.Administer.Remove(ra);
             dbcontext.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         return(false);
     }
     #endregion
 }
Пример #16
0
 /// <summary>
 //更改宿管信息
 /// </summary>
 /// <param name="id">宿管id</param>
 /// <param name="ra">宿管对象</param>
 /// <returns>成功返回true</returns>
 public bool ModifyRa(string id, Administer ra)
 {
     #region
     using (var dbcontext = new dimsContext())
     {
         var admin = dbcontext.Administer
                     .Single(r => r.Ano == id);
         if (admin != null)
         {
             admin = ra;
             dbcontext.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     #endregion
 }