Exemple #1
0
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Int32 records = 0;

            if (validateData())
            {
                Entities.Course oSubject = new Entities.Course();
                oSubject.id            = Convert.ToInt32(txtCode.Text);
                oSubject.description   = txtName.Text;
                oSubject.state         = Convert.ToInt16(cboState.SelectedValue);
                oSubject.oProgram.code = Convert.ToInt32(cboprogram.SelectedValue);
                if (CourseBLL.getInstance().exists(oSubject.id))
                {
                    records = CourseBLL.getInstance().modify(oSubject);
                }
                else
                {
                    records = CourseBLL.getInstance().insert(oSubject);
                }

                blockControls();
                loadData();

                if (records > 0)
                {
                    lblMessage.Text = "Datos almacenados correactamente";
                }
            }
        }
 public override void AddCourse(Course course)
 {
     if (course.WeeklyHours + TotalWeeklyHours() > MaxWeeklyHours)
     {
         throw new Exception("Your selection exceeds the maximum weekly hours: " + MaxWeeklyHours);
     }
     else
     {
         Courses.Add(course);
     }
 }
 public override void AddCourse(Course course)
 {
     if (Courses.Count == MaxNumCourses)
     {
         throw new Exception("Your selection exceeds the maximum number of courses: " + MaxNumCourses);
     }
     else
     {
         Courses.Add(course);
     }
 }
        private void insertButton_Click(object sender, EventArgs e)
        {
            if (courseNameTextBox.Text.Length != 0)
            {
                Course courseObj = new Course();
                courseObj.NAME = courseNameTextBox.Text;

                CourseData courseData = new CourseData();
                courseData.Insert(courseObj);

                populate();
            }
        }
        public void Insert(Course courseObj)
        {
            string insertQuery = "INSERT INTO Course (NAME) VALUES(@NAME)";

            SqlCommand insertCommand = new SqlCommand(insertQuery);

            SqlParameter nameParam = new SqlParameter("@NAME", SqlDbType.NVarChar, 50);
            nameParam.Value = courseObj.NAME;

            insertCommand.Parameters.Add(nameParam);

            dataAccess.Execute(insertCommand);
        }
        public void Update(Course courseObje)
        {
            string updateQuery = "UPDATE Course SET NAME = @NAME WHERE ID = @ID";

            SqlCommand updateCommand = new SqlCommand(updateQuery);

            SqlParameter idParam = new SqlParameter("@ID", SqlDbType.Int);
            idParam.Value = courseObje.ID;

            SqlParameter nameParam = new SqlParameter("@NAME", SqlDbType.NVarChar, 50);
            nameParam.Value = courseObje.NAME;

            updateCommand.Parameters.Add(idParam);
            updateCommand.Parameters.Add(nameParam);

            dataAccess.Execute(updateCommand);
        }
Exemple #7
0
 public override void AddCourse(Course course)
 {
     if (Courses.Count < MaxNumCourses)
     {
         if (TotalWeeklyHours() + course.WeeklyHours <= MaxWeeklyHours)
         {
             Courses.Add(course);
         }
         else
         {
             throw new Exception("Your selection exceeds the maximum weekly hours: " + MaxWeeklyHours);
         }
     }
     else
     {
         throw new Exception("Your selection exceeds the maximum number of courses: " + MaxNumCourses);
     }
 }
Exemple #8
0
        protected void gvCourse_RowEditing(object sender, GridViewEditEventArgs e)
        {
            unlockControls();
            Int32 code = Convert.ToInt32(gvCourse.Rows[e.NewEditIndex].Cells[0].Text);

            Entities.Course oSubject = CourseBLL.getInstance().getCourse(code);
            txtCode.Text = oSubject.id.ToString();
            txtName.Text = oSubject.description.ToString();
            try
            {
                cboState.SelectedValue = oSubject.state.ToString();
            }
            catch (Exception)
            {
                cboState.SelectedValue = "1";
            }
            ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "$('html, body').animate({ scrollTop: $('body').offset().top });", true);
        }
        public List<Course> getList()
        {
            SqlCommand command = new SqlCommand("SELECT * FROM Course");

            List<Course> courseList = new List<Course>();

            DataTable dt = dataAccess.Query(command);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                Course courseObj = new Course();
                courseObj.ID = (int)dt.Rows[i][0];
                courseObj.NAME = (string)dt.Rows[i][1];

                courseList.Add(courseObj);
            }

            return courseList;
        }
        protected void btnSave_Click(object sender, ImageClickEventArgs e)
        {
            Int32 records = 0;

            if (validateData())
            {
                Entities.Period    oPeriod    = new Entities.Period();
                Entities.Program   oProgram   = new Entities.Program();
                Entities.Course    oCourse    = new Entities.Course();
                Entities.ClassRoom oClassRoom = new Entities.ClassRoom();
                Entities.Schedule  oSchedule  = new Entities.Schedule();
                Entities.Teacher   oteacher   = new Entities.Teacher();
                Int32 code = Convert.ToInt32(txtCode.Text.ToString());
                oPeriod.code  = Convert.ToInt32(cboPeriod.SelectedValue.ToString());
                oProgram.code = Convert.ToInt32(cboProgram.SelectedValue.ToString());
                oCourse.id    = Convert.ToInt32(cboCourse.SelectedValue.ToString());
                Decimal price = Convert.ToDecimal(txtPrice.Text.ToString());
                oSchedule.code  = Convert.ToInt32(cboSchedule.SelectedValue.ToString());
                oClassRoom.code = Convert.ToInt32(cboRoom.SelectedValue.ToString());
                oteacher.code   = Convert.ToInt32(cboTeacher.SelectedValue.ToString());
                Int32 hour = Convert.ToInt32(cboHours.SelectedValue.ToString());
                Entities.AcademicOffer oAcademicOffer = new Entities.AcademicOffer(code, oPeriod, oProgram, oCourse, price, oClassRoom, oSchedule, oteacher, hour);
                if (BLL.AcademicOfferBLL.getInstance().exists(code))
                {
                    lblMessage.Text = "Esta solicitud no puede ser procesada";
                }
                else
                {
                    records = BLL.AcademicOfferBLL.getInstance().insert(oAcademicOffer);
                    insertClasroomSchedule(oAcademicOffer);
                    insertTeacherSchedule(oAcademicOffer);
                }

                blockControls();
                loadData();

                if (records > 0)
                {
                    lblMessage.Text = "Datos almacenados correactamente";
                }
            }
        }
 public StudentsInCourse(Course course, Student student)
 {
     Course  = course;
     Student = student;
 }
 public AssignmentsPerCourse(Course course, Assignment assignment)
 {
     Course = course;
     assignmentsInCourseList.Add(assignment);
 }
 public AssignmentsCourseStudent(Assignment assignment, Student student, Course course)
 {
     assignmentlist.Add(assignment);
     this.student = student;
     this.course  = course;
 }
    protected void submitCourse_OnClick(object sender, EventArgs e)
    {
        if (db.Courses.Any())
        {
            using (var context = new Lab7DbEntities1())
            {

                        Course course = new Course
                        {
                            CourseID = courseNumber.Text,
                            CourseTitle = courseName.Text,
                            HoursPerWeek = Int32.Parse(wklyHours.Text),
                            Description = txtbxDesc.Text
                        };

                        context.Courses.AddOrUpdate(course);

                context.SaveChanges();
            }

        }
        else
        {
            using (var context = new Lab7DbEntities1())
            {
                Course course = new Course
                {
                    CourseID = courseNumber.Text,
                    CourseTitle = courseName.Text,
                    HoursPerWeek = Int32.Parse(wklyHours.Text),
                    Description = txtbxDesc.Text

                };

                context.Courses.AddOrUpdate(course);
                context.SaveChanges();

            }
        }
    }
    protected void submitCourse_OnClick(object sender, EventArgs e)
    {
        if (db.Courses.Any())
        {
            using (var context = new Lab7DbEntities1())
            {
                  foreach (var c in db.Courses)
                  {
                    if (c.CourseID == courseNumber.Text)
                    {
                        Title = "Course already exists";
                    }
                    else
                    {
                        Course course = new Course
                        {
                            CourseID = courseNumber.Text,
                            CourseTitle = courseName.Text,
                            HoursPerWeek = Int32.Parse(wklyHours.Text)
                        };

                        context.Courses.Add(course);
                        context.SaveChanges();
                    }
                }
            }

        }
        else
        {
            using (var context = new Lab7DbEntities1())
            {
                Course course = new Course
                {
                    CourseID = courseNumber.Text,
                    CourseTitle = courseName.Text,
                    HoursPerWeek = Int32.Parse(wklyHours.Text)
                };

                context.Courses.Add(course);
                context.SaveChanges();
            }
        }
    }
Exemple #16
0
 public abstract void AddCourse(Course course);
        public void QueryByCourse(Course courseObj)
        {
            string courseQuery = "SELECT * FROM Course WHERE ID = @ID";
            string registraionQuery = "SELECT STUDENTID FROM Registraton WHERE COURSEID = @ID";

            SqlCommand courseCommand = new SqlCommand(courseQuery);
            SqlCommand registraionCommand = new SqlCommand(registraionQuery);

            SqlParameter courseIDParam = new SqlParameter("@ID", SqlDbType.Int);
            SqlParameter regCourseIDParam = new SqlParameter("@ID", SqlDbType.Int);

            courseIDParam.Value = courseObj.ID;
            regCourseIDParam.Value = courseObj.ID;

            courseCommand.Parameters.Add(courseIDParam);
            registraionCommand.Parameters.Add(regCourseIDParam);

            Console.WriteLine("Course Info: ");

            Console.WriteLine("Registration Info: ");

            ShowStudentName(dataAccess.Query(registraionCommand));
        }
 public TrainersInCourse(Course course, Trainer trainer)
 {
     Course = course;
     trainersInCourse.Add(trainer);
     //Trainer = trainer;
 }