private Faculty GenerateFaculty(DataTable facultyDataTable)
 {
     Faculty faculty = new Faculty
     {
         ID = int.Parse(facultyDataTable.Rows[0]["FacultyID"].ToString()),
         Name = facultyDataTable.Rows[0]["Name"].ToString(),
         EmailID = facultyDataTable.Rows[0]["EmailID"].ToString(),
         ContactNo = facultyDataTable.Rows[0]["ContactNo"].ToString(),
         ImageURL = facultyDataTable.Rows[0]["ImageURL"].ToString(),
         Designation = (DesignationType)(Enum.Parse(typeof(DesignationType), facultyDataTable.Rows[0]["DesignationID"].ToString())),
         Department = (DepartmentType)(Enum.Parse(typeof(DepartmentType), facultyDataTable.Rows[0]["DepartmentID"].ToString())),
         Username = facultyDataTable.Rows[0]["Username"].ToString(),
         Password = facultyDataTable.Rows[0]["Password"].ToString()
     };
     return faculty;
 }
 /// <summary>
 /// This method updates the details of the faculty in the database.
 /// </summary>
 /// <param name="faculty">An object of Faculty class containing the details of the faculty.</param>
 /// <returns>It returns true if the details are updated successfully otherwise false.</returns>
 public bool UpdateFacultyDetails(Faculty faculty)
 {
     SqlParameter FacultyID = new SqlParameter("facultyID", faculty.ID);
     SqlParameter Name = new SqlParameter("name", faculty.Name);
     SqlParameter ImageURL = new SqlParameter("imageURL", faculty.ImageURL);
     SqlParameter EmailID = new SqlParameter("emailID", faculty.EmailID);
     SqlParameter ContactNo = new SqlParameter("contactNo", faculty.ContactNo);
     SqlParameter DepartmentID = new SqlParameter("departmentID", (int)faculty.Department);
     SqlParameter DesignationID = new SqlParameter("designationID", (int)faculty.Designation);
     List<SqlParameter> parameterCollection = new List<SqlParameter>(){
         FacultyID,Name,ImageURL,EmailID,ContactNo,DepartmentID,DesignationID
     };
     int result = 0;
     using(DBDataHelper helper = new DBDataHelper())
     {
         result = helper.GetRowsAffected("dbo.UpdateFacultyDetails", SQLTextType.Stored_Proc, parameterCollection);
     }
     if (result > 0)
         return true;
     else
         return false;
 }
 /// <summary>
 /// This method fetches all the faculties having a particular task.
 /// </summary>
 /// <param name="task">An object of Task class.</param>
 /// <returns>It returns a list of faculties.</returns>
 protected List<Faculty> GetAllFacultiesHavingTheTask(int taskID)
 {
     SqlParameter TaskID = new SqlParameter("taskID", taskID);
     List<SqlParameter> col = new List<SqlParameter>() { TaskID };
     DataTable facultyTable = new DataTable();
     List<Faculty> faculties = new List<Faculty>();
     using (DBDataHelper helper = new DBDataHelper())
     {
         facultyTable = helper.GetDataTable("dbo.GetAllFacultiesHavingTheTask", SQLTextType.Stored_Proc, col);
     }
     foreach (DataRow facultyRow in facultyTable.Rows)
     {
         Faculty faculty = new Faculty()
         {
             ID = int.Parse(facultyRow["FacultyID"].ToString()),
             Name = facultyRow["Name"].ToString(),
             ImageURL = facultyRow["ImageURL"].ToString(),
             EmailID = facultyRow["EmailID"].ToString(),
             ContactNo = facultyRow["ContactNo"].ToString(),
             Designation = (DesignationType)(Enum.Parse(typeof(DesignationType), facultyRow["DesignationID"].ToString())),
             Department = (DepartmentType)(Enum.Parse(typeof(DepartmentType), facultyRow["DepartmentID"].ToString()))
         };
         faculties.Add(faculty);
     }
     return faculties;
 }
 /// <summary>
 /// This method fetches all the faculties having a particular department.
 /// </summary>
 /// <param name="departmentID">An integer parameter containing the ID of the department.</param>
 /// <returns>It returns a list of faculties.</returns>
 public List<Faculty> GetAllFacultiesByDepartment(int departmentID)
 {
     SqlParameter DepartmentID = new SqlParameter("departmentID", departmentID);
     List<SqlParameter> parameterCollection = new List<SqlParameter>() { DepartmentID };
     DataTable facultyTable = new DataTable();
     using (DBDataHelper helper = new DBDataHelper())
     {
         facultyTable = helper.GetDataTable("dbo.GetAllFacultiesByDepartment", SQLTextType.Stored_Proc, parameterCollection);
     }
     List<Faculty> faculties = new List<Faculty>();
     foreach (DataRow row in facultyTable.Rows)
     {
         Faculty faculty = new Faculty()
         {
             ID = int.Parse(row["FacultyID"].ToString()),
             Name = row["Name"].ToString(),
             EmailID = row["EmailID"].ToString(),
             ContactNo = row["ContactNo"].ToString(),
             Designation = (DesignationType)(Enum.Parse(typeof(DesignationType), row["DesignationID"].ToString())),
             ImageURL = row["ImageURL"].ToString()
         };
         faculties.Add(faculty);
     }
     return faculties;
 }