Ejemplo n.º 1
0
        /// <summary>
        /// Find the designated department of the given user
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static Department GetDepartmentByUserId(string userId)
        {
            Staff      staff = StaffDepartmentDAO.GetStaffByUserId(userId);
            Department dep   = DbFactory.Instance.context.Departments.Where(x => x.departmentId == staff.departmentId).First();

            return(dep);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Update the department information
 /// </summary>
 /// <param name="depId"></param>
 /// <param name="staffId"></param>
 /// <param name="phoneNumber"></param>
 /// <param name="fax"></param>
 /// <returns></returns>
 public static Boolean UpdateDepartmentContacts(string depId, int staffId, int phoneNumber, int fax)
 {
     try
     {
         Department dep = StaffDepartmentDAO.getDepartmentById(depId);
         dep.staffIdContact  = staffId;
         dep.departmentPhone = phoneNumber;
         dep.departmentFax   = fax;
         DbFactory.Instance.context.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }