public List <TeacherRole> GetTeacherRole()
        {
            string retriveListString = "SELECT * FROM teacherRoles";

            SqlCommand         cmd             = new SqlCommand(retriveListString, con);
            List <TeacherRole> teacherRoleList = new List <TeacherRole>();

            try
            {
                con.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int         TeacherID   = reader.GetInt32(0);
                            int         ModuleID    = reader.GetInt32(1);
                            int         RoleID      = reader.GetInt32(2);
                            TeacherRole teacherRole = new TeacherRole(TeacherID, ModuleID, RoleID);
                            teacherRoleList.Add(teacherRole);
                        }
                        reader.NextResult();
                    }
                }
                return(teacherRoleList);
            }
            finally
            {
                con.Close();
            }
        }
        public TeacherRole GetTeacherRole(int id)
        {
            string retriveString = "SELECT * from teacherRoles WHERE ID = " + id;

            SqlCommand  cmd         = new SqlCommand(retriveString, con);
            TeacherRole teacherRole = new TeacherRole();

            try
            {
                con.Open();
                using (SqlDataReader oReader = cmd.ExecuteReader())
                {
                    while (oReader.Read())
                    {
                        teacherRole.TeacherID = int.Parse(oReader["TeacherID"].ToString());
                        teacherRole.ModuleID  = int.Parse(oReader["ModuleID"].ToString());
                        teacherRole.RoleID    = int.Parse(oReader["RoleID"].ToString());
                    }

                    con.Close();
                }
                return(teacherRole);
            }
            finally
            {
                con.Close();
            }
        }
        public void UpdateTeacherRole(TeacherRole teacherRole)
        {
            string updateQuery = "UPDATE teacherRoles SET TeacherID = '" + teacherRole.TeacherID + "," + teacherRole.ModuleID + "," + teacherRole.RoleID + "' WHERE ID = " + teacherRole.ID + " ;";

            ExecuteQuery(updateQuery);
        }
        public void CreateTeacherRole(TeacherRole teacherRole)
        {
            string createQuery = "INSERT INTO teacherRoles(TeacherID, ModuleID, RoleID) VALUES(" + teacherRole.TeacherID + "," + teacherRole.ModuleID + "," + teacherRole.RoleID + ");";

            ExecuteQuery(createQuery);
        }