Exemple #1
0
        public List <ModuleGroups> GetGroupModules()
        {
            string retriveStudentList           = "SELECT ID, GroupID, SemesterID, ModuleID FROM ModuleGroups ;";
            List <ModuleGroups> groupModuleList = new List <ModuleGroups>();
            SqlCommand          cmd             = new SqlCommand(retriveStudentList, con);

            try
            {
                con.Open();
                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            ModuleGroups groupModule = new ModuleGroups();
                            groupModule.ID         = reader.GetInt32(0);
                            groupModule.GroupID    = reader.GetString(1);
                            groupModule.SemesterID = reader.GetInt32(2);
                            groupModule.ModuleID   = reader.GetInt32(3);
                            groupModuleList.Add(groupModule);
                        }
                        reader.NextResult();
                    }
                    con.Close();
                }
                return(groupModuleList);
            }
            finally
            {
                con.Close();
            }
        }
Exemple #2
0
        public void CreateGroupModule(ModuleGroups groupModules)
        {
            string createQuery = "INSERT INTO ModuleGroups (GroupID, SemesterID, ModuleID)" +
                                 "VALUES('" + groupModules.GroupID + "', '" + groupModules.SemesterID + "', '" + groupModules.ModuleID + "') ;";

            ExecuteQuery(createQuery);
        }
Exemple #3
0
        public ModuleGroups ReadGroupModule(SqlDataReader reader)
        {
            ModuleGroups groupModule = new ModuleGroups();

            while (reader.Read())
            {
                groupModule.ID         = reader.GetInt32(0);
                groupModule.GroupID    = reader.GetString(1);
                groupModule.SemesterID = reader.GetInt32(2);
                groupModule.ModuleID   = reader.GetInt32(3);
            }
            return(groupModule);
        }
Exemple #4
0
        public ModuleGroups GetGroupModule(int id)
        {
            string retriveString = "SELECT ID, GroupID, SemesterID, ModuleID from ModuleGroups WHERE ID = " + id + " ;";

            SqlCommand   cmd         = new SqlCommand(retriveString, con);
            ModuleGroups groupModule = new ModuleGroups();

            try
            {
                con.Open();
                using (SqlDataReader oReader = cmd.ExecuteReader())
                {
                    groupModule = this.ReadGroupModule(oReader);
                    con.Close();
                }
                return(groupModule);
            }
            finally
            {
                con.Close();
            }
        }
Exemple #5
0
        public void UpdateGroupModule(ModuleGroups moduleGroups)
        {
            string updateQuery = "UPDATE ModuleGroups SET SemesterID = " + moduleGroups.SemesterID + ", ModuleID= " + moduleGroups.ModuleID + ", GroupID = '" + moduleGroups.GroupID + "' WHERE ID = " + moduleGroups.ID + " ; ";

            ExecuteQuery(updateQuery);
        }