Exemple #1
0
        public ActionResult Save()
        {
            List <Department> departments = departmentManager.GetAllDepartments();
            List <Semester>   semesters   = semesterManager.GetAllSemesters();

            ViewBag.departmentsList = departments;
            ViewBag.semestersList   = semesters;
            return(View());
        }
        public ActionResult InsertCourse()
        {
            var departments = _departmentManager.GetAllDepartments();

            ViewBag.Departments = new SelectList(departments, "DepartmentId", "DepartmentName");
            var semesters = _semesterManager.GetAllSemesters();

            ViewBag.Semesters = new SelectList(semesters, "SemesterId", "SemesterName");
            return(View(new Course()));
        }
Exemple #3
0
        public ActionResult Save()
        {
            if (Session["username"] == null)
            {
                return(RedirectToAction("Login", "Account"));
            }

            ViewBag.Departments = aDepartmentManager.GetAllDepartments();
            ViewBag.Semesters   = aSemesterManager.GetAllSemesters();
            return(View());
        }
Exemple #4
0
        // GET: /Course/Create
        public ActionResult Create()
        {
            IEnumerable <Department> departments = aDepartmentManager.GetAllDepartment();

            ViewBag.DeptList = new SelectList(departments, "Id", "Name");

            IEnumerable <Semester> semesters = aSemesterManager.GetAllSemesters();

            ViewBag.SemList = new SelectList(semesters, "Id", "Name");

            return(View());
        }
        public ActionResult SaveCourse()
        {
            List <Department> Departments = aDepartmentManager.GetAllDepartments();
            List <Semester>   semesters   = aSemesterManager.GetAllSemesters();

            ViewBag.Departments = Departments.Select(x => new SelectListItem()
            {
                Value = x.DepartmentId.ToString(), Text = x.Name
            });
            ViewBag.Semester = semesters.Select(x => new SelectListItem()
            {
                Value = x.SemesterId.ToString(), Text = x.Name
            });
            return(View());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            msgLabel.Text = "";
            try
            {
                List <Department> departments = new List <Department>();
                List <Semester>   semester    = new List <Semester>();
                departmentDropDownList.DataTextField  = "DepartmentCode";
                departmentDropDownList.DataValueField = "departmentId";
                semesterDropDownList.DataTextField    = "SemesterName";
                semesterDropDownList.DataValueField   = "SemesterId";
                aDepartmentManager = new DepartmentManager();
                departments        = aDepartmentManager.GetAllDepartments();
                SemesterManager aSemesterManager = new SemesterManager();
                semester = aSemesterManager.GetAllSemesters();

                if (!IsPostBack)
                {
                    departmentDropDownList.DataSource = departments;
                    departmentDropDownList.DataBind();
                    semesterDropDownList.DataSource = semester;
                    semesterDropDownList.DataBind();
                }
            }
            catch (Exception exception)
            {
                msgLabel.ForeColor = Color.Red;
                msgLabel.Text      = exception.Message;
            }
        }
        public List <SemesterModel> GetAllSemesters()
        {
            List <SemesterModel> semesters = new List <SemesterModel>();

            semesters = aSemesterManager.GetAllSemesters();
            return(semesters);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            msgLabel.Text = "";

            try
            {
                departmentDropDownList.DataTextField  = "DepartmentCode";
                departmentDropDownList.DataValueField = "departmentId";
                semesterDropDownList.DataTextField    = "SemesterName";
                semesterDropDownList.DataValueField   = "SemesterId";
                dayDropDownList.DataTextField         = "dayName";
                dayDropDownList.DataValueField        = "dayId";
                buildingDropDownList.DataTextField    = "buildingName";
                buildingDropDownList.DataValueField   = "buildingId";
                courseDropDownList.DataTextField      = "courseCode";
                courseDropDownList.DataValueField     = "courseId";
                roomDropDownList.DataTextField        = "roomName";
                roomDropDownList.DataValueField       = "roomId";

                if (!IsPostBack)
                {
                    List <Course>     courses     = new List <Course>();
                    List <Day>        days        = new List <Day>();
                    List <Department> departments = new List <Department>();
                    List <Semester>   semester    = new List <Semester>();
                    List <Building>   buildings   = new List <Building>();
                    aDepartmentManager = new DepartmentManager();
                    departments        = aDepartmentManager.GetAllDepartments();
                    SemesterManager aSemesterManager = new SemesterManager();
                    semester                   = aSemesterManager.GetAllSemesters();
                    aScheduleManager           = new ScheduleManager();
                    buildings                  = aScheduleManager.GetAllBuildings();
                    days                       = aScheduleManager.GetAllDays();
                    aCourseManager             = new CourseManager();
                    courses                    = aCourseManager.GetAllCourses();
                    dayDropDownList.DataSource = days;
                    dayDropDownList.DataBind();
                    departmentDropDownList.DataSource = departments;
                    departmentDropDownList.DataBind();
                    semesterDropDownList.DataSource = semester;
                    semesterDropDownList.DataBind();
                    buildingDropDownList.DataSource = buildings;
                    buildingDropDownList.DataBind();
                    courseDropDownList.DataSource = courses;
                    courseDropDownList.DataBind();
                }
            }
            catch (Exception exception)
            {
                msgLabel.ForeColor = Color.Red;
                msgLabel.Text      = exception.Message;
            }
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            msgLabel.Text = "";
            try
            {
                departmentDropDownList.DataTextField  = "DepartmentCode";
                departmentDropDownList.DataValueField = "departmentId";
                semesterDropDownList.DataTextField    = "SemesterName";
                semesterDropDownList.DataValueField   = "SemesterId";
                if (!IsPostBack)
                {
                    List <Department> departments = new List <Department>();
                    List <Semester>   semester    = new List <Semester>();
                    aDepartmentManager = new DepartmentManager();
                    departments        = aDepartmentManager.GetAllDepartments();
                    SemesterManager aSemesterManager = new SemesterManager();
                    semester = aSemesterManager.GetAllSemesters();
                    departmentDropDownList.DataSource = departments;
                    departmentDropDownList.DataBind();
                    semesterDropDownList.DataSource = semester;
                    semesterDropDownList.DataBind();
                    GetAllUnscheduleCourses();
                }
            }

            catch (SqlException sqlException)
            {
                msgLabel.ForeColor = Color.Red;
                msgLabel.Text      = "Database error.See details error: " + sqlException.Message;
            }
            catch (Exception exception)
            {
                msgLabel.ForeColor = Color.Red;
                string errorMessage = "Unknow error occured.";
                errorMessage += exception.Message;
                if (exception.InnerException != null)
                {
                    errorMessage += exception.InnerException.Message;
                }
                msgLabel.Text = errorMessage;
            }
        }
 public ActionResult Index()
 {
     ViewBag.Departments = _departmentManager.GetAllDepartment();
     ViewBag.Semesters   = _semesterManager.GetAllSemesters();
     return(View());
 }
 public ActionResult SaveCourse()
 {
     ViewBag.Departments = aDepartmentManager.GetAllDepartments();
     ViewBag.Semesters   = aSemesterManager.GetAllSemesters();
     return(View());
 }
Exemple #12
0
 // GET: Course
 public ActionResult Save()
 {
     ViewBag.Departments = courseManager.ShowAllDepartments();
     ViewBag.Semesters   = semesterManager.GetAllSemesters();
     return(View());
 }
Exemple #13
0
        private List <Semester> getAllSemesters()
        {
            var semesterlist = semesterManager.GetAllSemesters();

            return(semesterlist);
        }