Exemplo n.º 1
0
        public async Task <HttpResponseMessage> GetCourseListForAssessor(int AssessorID)
        {
            try
            {
                CourseDAL         dal  = new CourseDAL();
                List <CourseInfo> data = await dal.GetCourseListForAssessor(AssessorID);

                if (data != null)
                {
                    Logger log = new Logger();
                    log.ErrorLog(new DbEntityValidationException(), "Course", "GetCourse");
                    return(Request.CreateResponse <List <CourseInfo> >(HttpStatusCode.OK, data));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, Constants.ErrorNotFound));
                }
            }
            catch (DbEntityValidationException ex)
            {
                var    controllerName = ControllerContext.RouteData.Values["controller"].ToString();
                var    actionName     = ControllerContext.RouteData.Values["action"].ToString();
                Logger log            = new Logger();
                log.ErrorLog(ex, controllerName, actionName);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, Constants.ErrorSysError));
            }
        }
Exemplo n.º 2
0
        public DataTable ViewCoursesInGridviewBLL()
        {
            CourseDAL aCourseDAL = new CourseDAL();
            DataTable dt         = aCourseDAL.ViewCoursesInGridviewDAL();

            return(dt);
        }
Exemplo n.º 3
0
 public StudentController()
 {
     this.courseDAL  = new CourseDAL();
     this.gradesDAL  = new GradeItemDAL();
     this.rubricDAL  = new RubricDAL();
     this.studentDAL = new StudentDAL();
 }
        public bool CheckIfCanSignUpForCourseBasedOnTimes(int crn, string studentID, string semesterID)
        {
            //get all courses that a student is currently signed up for
            //check if those courses time's directly conflict with the new course's time
            bool          canSignUp      = true;
            CourseDAL     courseGetter   = new CourseDAL();
            List <Course> currentCourses = courseGetter.GetCoursesByStudentIDAndSemester(studentID, semesterID);
            CourseTimeDAL timeChecker    = new CourseTimeDAL();
            CourseTime    desiredTime    = timeChecker.GetCourseTimeByCRN(crn);

            foreach (var currentCourse in currentCourses)
            {
                CourseTime currentTime = timeChecker.GetCourseTimeByCRN(currentCourse.CRN);
                foreach (var currentDay in currentTime.CourseDays.ToCharArray())
                {
                    foreach (var desiredDays in desiredTime.CourseDays.ToCharArray())
                    {
                        if (desiredDays == currentDay)
                        {
                            if (desiredTime.CourseStart.TimeOfDay > currentTime.CourseStart.TimeOfDay &&
                                desiredTime.CourseStart.TimeOfDay < currentTime.CourseEnd.TimeOfDay)
                            {
                                canSignUp = false;
                                return(canSignUp);
                            }
                        }
                    }
                }
            }

            return(canSignUp);
        }
        //
        // GET: /Teacher/


        public ActionResult Index()
        {
            User          u    = (User)Session["user"];
            List <Course> list = CourseDAL.getAllTeacherCourses(u.UserId);

            return(View(list));
        }
Exemplo n.º 6
0
 internal static void UpdateConcludedCourseCanvasData(uniCanvasCurso courseToConclude)
 {
     if (courseToConclude != null)
     {
         CourseDAL.UpdateConcludedCourseCanvasData(courseToConclude);
     }
 }
Exemplo n.º 7
0
 public TeacherController()
 {
     this.courseDAL     = new CourseDAL();
     this.gradeItemDAL  = new GradeItemDAL();
     this.rubricDAL     = new RubricDAL();
     this.weightTypeDAL = new WeightTypeDAL();
     this.studentDAL    = new StudentDAL();
 }
Exemplo n.º 8
0
 public static int AddRequestBusiness(ApplicationFormEntity entity)
 {
     if (entity.APPTEACHERID != null && entity.APPCOURSEID != null)
     {
         return(CourseDAL.AddRequest(entity));
     }
     return(-1);
 }
 static BaseBLL()
 {
     admins      = DataFileAccess.GetAdmins();
     students    = DataFileAccess.GetStudents();
     teachers    = DataFileAccess.GetTeachers();
     courses     = DataFileAccess.GetCourses();
     termCourses = DataFileAccess.GetTermCourses();
     InitInitIDs();
 }
Exemplo n.º 10
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ManageGradeItemsController" /> class.
 /// </summary>
 /// <param name="assignmentPage">The assignment page.</param>
 public ManageGradeItemsController(ManageAssignmentPage assignmentPage)
 {
     this.assignmentPage = assignmentPage;
     this.semesterDal    = new SemesterDAL();
     this.courseDal      = new CourseDAL();
     this.rubricDal      = new CourseRubricDAL();
     this.gradeItemDal   = new GradeItemDAL();
     this.CRN            = assignmentPage.CRN;
 }
Exemplo n.º 11
0
        private void GuiCourseReport_Load(object sender, EventArgs e)
        {
            CoursesReport classesReport = new CoursesReport();
            DataTable     dataTable     = new DataTable();

            dataTable = CourseDAL.GetCoursesReport();
            classesReport.SetDataSource(dataTable);
            crystalReportViewer1.ReportSource = classesReport;
        }
Exemplo n.º 12
0
        public static void RenderComboBoxDataCourses(ComboBox cboCourse)
        {
            cboCourse.Items.Clear();
            List <Course> courses = CourseDAL.GetCourses();

            foreach (Course course in courses)
            {
                cboCourse.Items.Add(course);
            }
        }
Exemplo n.º 13
0
        public static void RenderListViewDataCourses(ListView lvwCourse)
        {
            lvwCourse.Items.Clear();
            List <Course> courses = CourseDAL.GetCourses();

            foreach (Course course in courses)
            {
                lvwCourse.Items.Add(CourseModelToListViewItem(course));
            }
        }
        // 修改验证是否存在
        public static bool IsTrue(string Name, int Id)
        {
            Course model = CourseDAL.GetIdByName(Name);

            if (model != null && model.CourseId != 0 && model.CourseId != Id)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 15
0
        protected void AddTManual_Click(object sender, EventArgs e)
        {
            Security objSecurity = new Security();
            string   strTPID     = string.Empty;

            try
            {
                //strTPID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                //if (GlobalMethods.ValueIsNull(strTPID).Length > 0)
                //{
                //    strTPID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
                //}

                #region "variables"
                string vTPId        = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropTPs.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vCName       = objSecurity.KillChars(txtCTitle.Text);
                string vCategory    = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(dropCourseCat.SelectedItem.Value), AppConstants.secretKey, AppConstants.initVec).ToString();
                string vCDesc       = objSecurity.KillChars(txtCDesc.Text);
                string vCLanguage   = dropLanguage.SelectedItem.Value;
                string vDuration    = dropDuration.SelectedItem.Value;
                string vAttendence  = dropAttendanceReq.SelectedItem.Value;
                string vPassPercent = dropPassPercent.SelectedItem.Value;
                string vInitRenew   = dropInitRenew.SelectedItem.Value;
                #endregion

                #region Object for Training Provider.
                clsCourse objCourse = new clsCourse();
                objCourse.TPId                  = Convert.ToInt32(vTPId);
                objCourse.CourseTitle           = vCName;
                objCourse.Notes                 = vCDesc;
                objCourse.ACRDCatID             = Convert.ToInt32(vCategory);
                objCourse.InstructionLanguage   = vCLanguage;
                objCourse.CourseDuration        = vDuration;
                objCourse.MeasurementUnit       = "percentage";
                objCourse.InitialOrRenewal      = vInitRenew;
                objCourse.AttendanceRequirement = vAttendence;
                objCourse.PassScore             = vPassPercent;
                objCourse.CreateDate            = DateTime.Now;
                objCourse.CreatedBy             = HttpContext.Current.Session["UserAuthId"].ToString();
                objCourse.UpdatedDate           = Convert.ToDateTime("1/1/1900");
                objCourse.UpdatedBy             = "";
                objCourse.IsActive              = 1;
                if (!CourseDAL.InsertCourse(objCourse))
                {
                }
                #endregion

                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "CallNotify('Your Course has been submitted successfully!', '', 'success', 'TP_AddCourses.aspx?desh=active&cgi=" + Request["cgi"] + "');", true);
            }
            catch (Exception)
            {
                ErrorHandler.ErrorPage();
            }
        }
 private void reFillCheckList()
 {
     courses = CourseDAL.SelectAll();
     for (int i = 0; i < courses.Count; i++)
     {
         ComboboxItem b = new ComboboxItem();
         b.Text  = courses[i].Name;
         b.Value = courses[i].Id;
         checkedListBox1.Items.Add(b.Text);
     }
 }
Exemplo n.º 17
0
 internal static List <uniCanvasCurso> GetCourseToConcludeList(string termino)
 {
     try
     {
         return(CourseDAL.CoursesToConclude(termino));
     }
     catch (Exception e)
     {
         return(null);
     }
 }
Exemplo n.º 18
0
 public DataTable GetById(int id)
 {
     try
     {
         CourseDAL courseDAL = new CourseDAL();
         return(courseDAL.GetById(id));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 19
0
 public bool Delete(Courses course)
 {
     try
     {
         CourseDAL courseDAL = new CourseDAL();
         return(courseDAL.Delete(course));
     }
     catch (Exception)
     {
         throw;
     }
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="TeacherHomePageController" /> class.
 /// </summary>
 /// <param name="page">The page.</param>
 public TeacherHomePageController(TeacherHomePAge page)
 {
     if (page == null)
     {
         throw new ArgumentException("page cannot be null");
     }
     this.homePage             = page;
     this.courseDAL            = new CourseDAL();
     this.gradedItemDal        = new GradeItemDAL();
     this.desktopGradedItemDal = new DesktopGradedItemDAL();
     this.semesterDal          = new SemesterDAL();
 }
Exemplo n.º 21
0
 public DataTable GetAll()
 {
     try
     {
         CourseDAL courseDAL = new CourseDAL();
         return(courseDAL.GetAll());
     }
     catch (Exception)
     {
         throw;
     }
 }
 public Admin_deleteCourse()
 {
     InitializeComponent();
     courses = new CourseCollection();
     courses = CourseDAL.SelectAll();
     for (int i = 0; i < courses.Count; i++)
     {
         ComboboxItem b = new ComboboxItem();
         b.Text  = courses[i].Name;
         b.Value = courses[i].Id;
         checkedListBox1.Items.Add(b.Text);
     }
 }
Exemplo n.º 23
0
        public static List <Course> GetAll(int limit = -1)
        {
            List <CourseDTO> coursesDto = CourseDAL.GetAll(limit);

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

            foreach (CourseDTO course in coursesDto)
            {
                courses.Add(new Course(course));
            }

            return(courses);
        }
Exemplo n.º 24
0
 public bool DeleteBLL(int id)
 {
     if (id == 0 || id < 0)
     {
         return(false);
     }
     else
     {
         CourseDAL aCourseDAL = new CourseDAL();
         bool      res        = aCourseDAL.DeleteDAL(id);
         return(res);
     }
 }
Exemplo n.º 25
0
 public bool UpdateCourseBLL(Course aCourse, int id)
 {
     if (aCourse.CourseID == "" || aCourse.CourseTitles == "" || aCourse.Semister == "" || aCourse.Section == "")
     {
         return(false);
     }
     else
     {
         CourseDAL aCourseDAL = new CourseDAL();
         bool      res        = aCourseDAL.UpdateCourseDAL(aCourse, id);
         return(res);
     }
 }
        public string GetPreReqsAndFormatForDisplay(int crn)
        {
            CourseDAL preReqChecker = new CourseDAL();
            var       preReqs       = preReqChecker.GetPrerequisiteCoursesForGivenCRN(crn);
            string    output        = String.Empty;

            foreach (var currentPreReq in preReqs)
            {
                output += "This course requires completing the course: " + currentPreReq.Key +
                          " with a grade of at least: " + currentPreReq.Value + Environment.NewLine;
            }

            return(output);
        }
 private void Delete_Click(object sender, EventArgs e)
 {
     clChecked = new CourseCollection();
     for (int i = 0; i < checkedListBox1.Items.Count; i++)
     {
         if (checkedListBox1.GetItemChecked(i))
         {
             clChecked.Add(courses[i]);
             checkedListBox1.Items.RemoveAt(i);
         }
     }
     CourseDAL.DeleteSomeids(clChecked);
     UpdateCombobx();
 }
Exemplo n.º 28
0
        protected void gvwGrade_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
        {
            int index = e.NewSelectedIndex;
            List <GradeItem> items = (List <GradeItem>) this.odsStudents.Select();

            HttpContext.Current.Session["CurrentGradedItem"] = items[index];
            HttpContext.Current.Session["SelectedStudent"]   = items[index].Student;
            CourseDAL courseDal     = new CourseDAL();
            int       crn           = int.Parse(this.ddlCourses.SelectedValue);
            Course    currentCourse = courseDal.GetCourseByCRN(crn);

            HttpContext.Current.Session["CurrentCourse"] = currentCourse;
            HttpContext.Current.Response.Redirect("TeacherGradeGradeItemPage.aspx");
        }
Exemplo n.º 29
0
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            List <GradeItem> items   = (List <GradeItem>) this.odsStudents.Select();
            GradeItem        current = items[0];

            HttpContext.Current.Session["CurrentGradedItem"] = current;
            HttpContext.Current.Session["editing"]           = true;
            CourseDAL courseDal     = new CourseDAL();
            int       crn           = int.Parse(this.ddlCourses.SelectedValue);
            Course    currentCourse = courseDal.GetCourseByCRN(crn);

            HttpContext.Current.Session["CurrentCourse"] = currentCourse;
            HttpContext.Current.Response.Redirect("ManageCreateGradeItem.aspx");
        }
Exemplo n.º 30
0
        public static void HandleAddCourse(ListView lvwCourse, Course course)
        {
            bool courseResult = CourseDAL.CreateCourse(course);

            if (courseResult)
            {
                ListViewItem item = CourseModelToListViewItem(course);
                lvwCourse.Items.Insert(0, item.Clone() as ListViewItem);

                // Select New Item When Create
                lvwCourse.Items[0].Selected = true;
                lvwCourse.Select();
            }
        }
Exemplo n.º 31
0
        /// <summary>
        /// 根据课程ID获取章节列表
        /// </summary>
        /// <param name="courseid">课程ID</param>
        /// <returns></returns>
        public static List<Entity.LessonEntity> GetCourseLessons(string courseid)
        {
            DataTable dt = new CourseDAL().GetCourseLessons(courseid);

            List<Entity.LessonEntity> list = new List<Entity.LessonEntity>();
            foreach (DataRow dr in dt.Select("PID=''"))
            {
                LessonEntity model = new LessonEntity();
                model.FillData(dr);
                List<Entity.LessonEntity> clist = new List<Entity.LessonEntity>();
                foreach (DataRow cdr in dt.Select("PID='" + model.LessonID + "'"))
                {
                    LessonEntity cmodel = new LessonEntity();
                    cmodel.FillData(cdr);

                    clist.Add(cmodel);
                }
                model.ChildLessons = clist;
                list.Add(model);
            }

            return list;
        }
Exemplo n.º 32
0
        /// <summary>
        /// 根据课程ID获取章节列表
        /// </summary>
        /// <param name="courseid">课程ID</param>
        /// <param name="pid">上级章节ID</param>
        /// <returns></returns>
        public static List<Entity.LessonEntity> GetCourseLessons(string courseid, string pid)
        {
            DataTable dt = new CourseDAL().GetCourseLessons(courseid, pid);

            List<Entity.LessonEntity> list = new List<Entity.LessonEntity>();
            foreach (DataRow dr in dt.Rows)
            {
                LessonEntity model = new LessonEntity();
                model.FillData(dr);
                list.Add(model);
            }

            return list;
        }
Exemplo n.º 33
0
 /// <summary>
 /// 添加课程
 /// </summary>
 /// <param name="courseName">课程名</param>
 /// <param name="cid">分类ID</param>
 /// <param name="courseImg">图片</param>
 /// <param name="price">单价</param>
 /// <param name="teacherid">教师ID</param>
 /// <param name="keyWords">关键词</param>
 /// <param name="desc">描述</param>
 /// <param name="operateIP">操作IP</param>
 /// <param name="operateID">操作人</param>
 /// <returns></returns>
 public string AddCourse(string courseName, string cid, string imgURl, double price, string teacherid, int isHot ,int limitLevel,string keyWords, string desc, string operateIP, string operateID)
 {
     if (!string.IsNullOrEmpty(imgURl) && imgURl != "/modules/images/default.png")
     {
         if (imgURl.IndexOf("?") > 0)
         {
             imgURl = imgURl.Substring(0, imgURl.IndexOf("?"));
         }
         FileInfo file = new FileInfo(HttpContext.Current.Server.MapPath(imgURl));
         imgURl = "/Content/upload_images/" + file.Name;
         file.MoveTo(HttpContext.Current.Server.MapPath(imgURl));
     }
     object obj = new CourseDAL().AddCourse(courseName, cid, imgURl, price, teacherid, isHot,limitLevel, keyWords, desc, operateIP, operateID);
     if (obj != null && obj != DBNull.Value)
     {
         return obj.ToString();
     }
     return string.Empty;
 }
Exemplo n.º 34
0
 /// <summary>
 /// 添加课程章节
 /// </summary>
 /// <param name="lessonName">名称</param>
 /// <param name="courseID">课程</param>
 /// <param name="pid">上级ID</param>
 /// <param name="lessonImg">图片</param>
 /// <param name="keyWords">关键词</param>
 /// <param name="description">描述</param>
 /// <param name="radioURL">视频ID</param>
 /// <param name="radioSize">视频大小</param>
 /// <param name="sort">排序</param>
 /// <param name="operateIP">操作IP</param>
 /// <param name="operateID">操作人</param>
 /// <returns></returns>
 public string AddCourseLesson(string lessonName, string courseID, string pid, string keywords, string description, string radioURL, string radioSize, int sort, string operateIP, string operateID)
 {
     object obj = new CourseDAL().AddCourseLesson(lessonName, courseID, pid, keywords, description, radioURL.Trim(), radioSize, sort, operateIP, operateID);
     if (obj != null && obj != DBNull.Value)
     {
         return obj.ToString();
     }
     return string.Empty;
 }
Exemplo n.º 35
0
 /// <summary>
 /// 添加收藏、点赞、分享等
 /// </summary>
 /// <param name="userid">会员ID</param>
 /// <param name="courseid">课程ID</param>
 /// <param name="lessonid">章节ID</param>
 /// <param name="type">UserCourseType 类型</param>
 /// <param name="operateIP">操作IP</param>
 /// <param name="operateID">操作ID</param>
 /// <param name="result">返回状态 1成功 0不成功</param>
 /// <param name="resultdes">返回字符串</param>
 /// <returns></returns>
 public string AddUserCourse(string userid, string courseid, string lessonid, UserCourseType type, string operateIP, string operateID, out int result, out string resultdes)
 {
     object obj = new CourseDAL().AddUserCourse(userid, courseid, lessonid, (int)type, operateIP, operateID, out result, out resultdes);
     if (obj != null && obj != DBNull.Value)
     {
         return obj.ToString();
     }
     return string.Empty;
 }
Exemplo n.º 36
0
 /// <summary>
 /// 编辑课程章节
 /// </summary>
 /// <param name="lessonName">名称</param>
 /// <param name="courseID">课程</param>
 /// <param name="pid">上级ID</param>
 /// <param name="lessonImg">图片</param>
 /// <param name="keyWords">关键词</param>
 /// <param name="description">描述</param>
 /// <param name="videoURL">视频ID</param>
 /// <param name="videoSize">视频大小</param>
 /// <param name="operateIP">操作IP</param>
 /// <param name="operateID">操作人</param>
 /// <returns></returns>
 public bool EditCourseLesson(string lessonID, string lessonName, string courseID, string pid, string keyWords, string description, string videoURL, string videoSize, int sort, string operateIP, string operateID)
 {
     bool bl = new CourseDAL().EditCourseLesson(lessonID, lessonName, courseID, pid, keyWords, description, videoURL.Trim(), videoSize, sort, operateIP, operateID);
     return bl;
 }