public List <FacultyGroup> GetFacultyGroup()
        {
            string retriveGroupList = "SELECT g.GroupID, g.CreateDate, f.FacultyID, f.FacultyName FROM GROUPS g JOIN Faculties f ON" +
                                      " g.FacultyID = f.FacultyID AND g.Status = 1";
            List <FacultyGroup> facultyGroupList = new List <FacultyGroup>();
            SqlCommand          cmd = new SqlCommand(retriveGroupList, con);

            try
            {
                con.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            string   GroupID     = reader.GetString(0);
                            DateTime CreateDate  = reader.GetDateTime(1);
                            int      FacultyID   = reader.GetInt32(2);
                            string   FacultyName = reader.GetString(3);

                            FacultyGroup facultyGroup = new FacultyGroup(GroupID, CreateDate, FacultyID, FacultyName);
                            facultyGroupList.Add(facultyGroup);
                        }
                        reader.NextResult();
                    }
                    con.Close();
                }
                return(facultyGroupList);
            }
            finally
            {
                con.Close();
            }
        }
        public FacultyGroup ReadFacultyGroup(SqlDataReader oReader)
        {
            FacultyGroup facultyGroup = new FacultyGroup();

            while (oReader.Read())
            {
                facultyGroup.GroupID     = oReader.GetString(0);
                facultyGroup.CreateDate  = oReader.GetDateTime(1);
                facultyGroup.FacultyName = oReader.GetString(2);
                facultyGroup.FacultyID   = oReader.GetInt32(3);
            }
            return(facultyGroup);
        }
        public FacultyGroup GetFacultyGroup(string id)
        {
            string retriveString = "SELECT g.GroupID as \"GroupID\", g.CreateDate as \"CreateDate\", f.FacultyName as \"FacultyName\", f.FacultyID as \"FacultyID\" from Groups g JOIN Faculties f ON f.FacultyID = g.FacultyID AND g.GroupID = '" + id + "' ;";

            SqlCommand   cmd          = new SqlCommand(retriveString, con);
            FacultyGroup facultyGroup = new FacultyGroup();

            try
            {
                con.Open();
                using (SqlDataReader oReader = cmd.ExecuteReader())
                {
                    facultyGroup = this.ReadFacultyGroup(oReader);
                    con.Close();
                }
                return(facultyGroup);
            }
            finally
            {
                con.Close();
            }
        }