public void DeleteOneRegistraion()
        {
            Registration regObj = new Registration();
            Student studentObj = new Student();

            studnetUI.Query();
            Console.Write("Enter Student ID: ");
            regObj.STUDENTID = int.Parse(Console.ReadLine());
            studentObj.ID = regObj.STUDENTID;

            registraionData.QueryByStudent(studentObj);
            Console.Write("Enter Course ID: ");
            regObj.COURSEID = int.Parse(Console.ReadLine());

            registraionData.DeleteOneRegistraion(regObj);
        }
        public void Insert(Registration regObj)
        {
            string insertQuery = "INSERT INTO Registraton (STUDENTID, COURSEID) VALUES (@STUDENTID, @COURSEID)";

            SqlCommand insertCommand = new SqlCommand(insertQuery);

            SqlParameter studentIDParam = new SqlParameter("@STUDENTID", SqlDbType.Int);
            studentIDParam.Value = regObj.STUDENTID;

            SqlParameter courseIDParam = new SqlParameter("@COURSEID", SqlDbType.Int);
            courseIDParam.Value = regObj.COURSEID;

            insertCommand.Parameters.Add(studentIDParam);
            insertCommand.Parameters.Add(courseIDParam);

            dataAccess.Execute(insertCommand);
        }
        public void DeleteOneRegistraion(Registration regObj)
        {
            string deleteQuery = "DELETE Registraton WHERE STUDENTID = @STUDENTID AND COURSEID = @COURSEID";

            SqlCommand deleteCommand = new SqlCommand(deleteQuery);

            SqlParameter studentIDParam = new SqlParameter("@STUDENTID", SqlDbType.Int);
            studentIDParam.Value = regObj.STUDENTID;

            SqlParameter courseIDParam = new SqlParameter("@COURSEID", SqlDbType.Int);
            courseIDParam.Value = regObj.COURSEID;

            deleteCommand.Parameters.Add(studentIDParam);
            deleteCommand.Parameters.Add(courseIDParam);

            dataAccess.Execute(deleteCommand);
        }
        public void Insert()
        {
            Registration regObj = new Registration();

            studnetUI.Query();
            Console.WriteLine();

            Console.Write("Insert Student ID: ");
            regObj.STUDENTID = int.Parse(Console.ReadLine());

            courseUI.Query();
            Console.WriteLine();

            Console.Write("Insert Course ID: ");
            regObj.COURSEID = int.Parse(Console.ReadLine());

            registraionData.Insert(regObj);

            QueryFullTable();
        }
        public void Update()
        {
            Registration regObj = new Registration();

            QueryByStudent();

            Console.Write("Enter Studend ID: ");
            regObj.STUDENTID = int.Parse(Console.ReadLine());

            Console.Write("Enter Course ID to Change: ");
            regObj.COURSEID = int.Parse(Console.ReadLine());

            courseUI.Query();

            Console.Write("Enter New Course ID: ");
            int newId = int.Parse(Console.ReadLine());

            registraionData.Update(regObj, newId);
        }
        public void Update(Registration regObj, int changedCourseID)
        {
            string updateQuery = "UPDATE Registraton SET COURSEID = @COURSEID WHERE STUDENTID = @STUDENTID AND COURSEID = @COURSEIDTOSET";

            SqlCommand updateCommand = new SqlCommand(updateQuery);

            SqlParameter studentIDParam = new SqlParameter("@STUDENTID", SqlDbType.Int);
            studentIDParam.Value = regObj.STUDENTID;

            SqlParameter courseToSetIDParam = new SqlParameter("@COURSEIDTOSET", SqlDbType.Int);
            courseToSetIDParam.Value = regObj.COURSEID;

            SqlParameter changedCourseIDParam = new SqlParameter("@COURSEID", SqlDbType.Int);
            changedCourseIDParam.Value = changedCourseID;

            updateCommand.Parameters.Add(courseToSetIDParam);
            updateCommand.Parameters.Add(studentIDParam);
            updateCommand.Parameters.Add(changedCourseIDParam);

            dataAccess.Execute(updateCommand);
        }