Exemple #1
0
        private void LoadCourseDetail()
        {
            using (var helper = new DbHelper.Subject())
            {
                var course = helper.Find(CourseId);
                //lblTitle.Text = course.Name;
                //lblSummary.Text = course.Summary;
                if (course != null)
                {
                    var sections = course.SubjectSections;
                    if (sections != null)
                    {
                        var unVoidedSections = sections.Where(x => !(x.Void ?? false));

                        foreach (var subjectSection in unVoidedSections)
                        {
                            SectionUc sectionuc = (SectionUc)Page.LoadControl("~/Views/Course/Section/SectionUc.ascx");
                            sectionuc.SummaryVisible = subjectSection.ShowSummary ?? false;
                            sectionuc.SubjectId      = subjectSection.SubjectId;
                            sectionuc.SectionId      = subjectSection.Id;
                            pnlSections.Controls.Add(sectionuc);
                        }
                    }
                }
            }
            //CreateSectionUc uc = (CreateSectionUc)Page.LoadControl("~/Views/Course/Section/CreateSectionUc.ascx");

            //uc.ID = "createSection";
            //uc.Visible = false;
            //uc.SubjectId = CourseId;
            //uc.OnSaveEvent += uc_OnSaveEvent;
            //pnlSections.Controls.Add(uc);
        }
Exemple #2
0
 private void LoadCourse(int courseId)
 {
     using (var helper = new DbHelper.Subject())
     {
         var sub = helper.Find(courseId);
         if (sub != null)
         {
             txtSubjectName.Text      = sub.FullName;
             CourseDetailUc1.CourseId = Id;
         }
         //CourseDetailUc1.
     }
 }
Exemple #3
0
        List <IdAndName> GetCourse()
        {
            var subId   = Request.QueryString["SubId"];
            var fromCls = Request.QueryString["from"];
            var yId     = Request.QueryString["yId"];
            var sId     = Request.QueryString["sId"];

            using (var helper = new DbHelper.Subject())
            {
                var list = new List <IdAndName>();
                var sub  = helper.Find(Convert.ToInt32(subId));

                // if (SiteMap.CurrentNode != null)
                // {
                list.Add(new IdAndName()
                {
                    Name  = "Home", //SiteMap.RootNode.Title,
                    Value = "~/",   //SiteMap.RootNode.Url,
                    Void  = true
                });
                if (sId != null && yId != null)
                {
                    //lnkEdit.NavigateUrl += "&yId=" + yId + "&sId=" + sId;
                    list.Add(new IdAndName()
                    {
                        Name  = "Manage Programs",
                        Value = "~/Views/Structure/",
                        Void  = true
                    });
                    using (var strHelper = new DbHelper.Structure())
                    {
                        list.Add(new IdAndName()
                        {
                            Name  = strHelper.GetSructureDirectory(Convert.ToInt32(yId), Convert.ToInt32(sId)),
                            Value = "~/Views/Structure/CourseListing.aspx?yId=" + yId + "&sId=" + sId,
                            Void  = true
                        });
                    }

                    list.Add(new IdAndName()
                    {
                        Name = sub.FullName
                    });
                }
                else if (fromCls != null)
                {
                    //lnkEdit.NavigateUrl += "&frmDetailView=" + fromCls;
                    list.Add(new IdAndName()
                    {
                        Name  = "Courses",                     //SiteMap.CurrentNode.ParentNode.Title,
                        Value = "~/Views/Course/Default.aspx", //SiteMap.CurrentNode.ParentNode.Url,
                        Void  = true
                    });
                    list.Add(new IdAndName()
                    {
                        Name  = sub.FullName,
                        Value = "~/Views/Course/CourseDetail.aspx?cId=" + sub.Id,
                        Void  = true
                    });
                    list.Add(new IdAndName()
                    {
                        Name = "View"
                    });
                }
                else
                {
                    list.Add(new IdAndName()
                    {
                        Name  = sub.FullName,
                        Value = "~/Views/Course/Section/?SubId=" + subId,
                        //"~/Views/Course/CourseDetail.aspx?cId=" + sub.Id
                        Void = true
                    });
                }


                //}
                return(list);
            }
        }
Exemple #4
0
        private void LoadCourseDetail()
        {
            var courseId = CourseId;

            using (var helper = new DbHelper.Subject())
            {
                lnkAddSection1.NavigateUrl = "~/Views/Course/Section/CreateSection.aspx?SubId=" + courseId;
                var course = helper.Find(courseId);
                //lblTitle.Text = course.Name;
                //lblSummary.Text = course.Summary;
                if (course != null)
                {
                    var sections = course.SubjectSections;
                    if (sections != null)
                    {
                        var user      = Page.User as CustomPrincipal;
                        var elligible = false;
                        if (user != null)
                        {
                            using (var chelper = new DbHelper.Classes())
                            {
                                var roles = user.GetRoles();
                                //Context.UserClass.Any(x=>x.subje)
                                // var roles = user.GetRoles().Select(x => x.Role.RoleName).ToList();
                                if (roles.Contains(DbHelper.StaticValues.Roles.CourseEditor.ToString()) ||
                                    roles.Contains(DbHelper.StaticValues.Roles.Manager.ToString()) ||
                                    roles.Contains(DbHelper.StaticValues.Roles.Admin) ||
                                    roles.Contains("teacher"))
                                {
                                    elligible = true;
                                }
                                //else
                                //{
                                //    //teacher
                                //    elligible = (chelper.IsUserElligibleToViewSubjectSection(SubjectId, UserId));
                                //}

                                var unVoidedSections = sections.Where(x => !(x.Void ?? false)).OrderBy(x => x.Position);

                                using (var ahelper = new DbHelper.ActAndRes())
                                    foreach (var subjectSection in unVoidedSections)
                                    {
                                        var canView = elligible;
                                        if (!canView)
                                        {
                                            canView = ahelper.EvaluateRestriction(null, subjectSection.Restriction, user.Id);
                                        }
                                        if (canView) //
                                        {
                                            SectionUc sectionuc =
                                                (SectionUc)Page.LoadControl("~/Views/Course/Section/SectionUc.ascx");
                                            sectionuc.AddActResClicked += sectionuc_AddActResClicked;

                                            //sectionuc.EditEnabled = EditEnabled;
                                            //sectionuc.SummaryVisible = subjectSection.ShowSummary ?? false;
                                            //sectionuc.SubjectId = subjectSection.SubjectId;
                                            //sectionuc.SectionId = subjectSection.Id;
                                            //sectionuc.SectionName = subjectSection.Name;

                                            sectionuc.SetData(EditEnabled, subjectSection.ShowSummary ?? false
                                                              , subjectSection.SubjectId, subjectSection.Id
                                                              , subjectSection.Name, UserId, elligible);

                                            var sectionlbl = new Literal()
                                            {
                                                Text = "<a  name='section_" + subjectSection.Id + "'></a>"
                                            };
                                            pnlSections.Controls.Add(sectionlbl);
                                            pnlSections.Controls.Add(sectionuc);
                                        }
                                    }
                            }
                        }
                    }
                }
            }
            //CreateSectionUc uc = (CreateSectionUc)Page.LoadControl("~/Views/Course/Section/CreateSectionUc.ascx");

            //uc.ID = "createSection";
            //uc.Visible = false;
            //uc.SubjectId = CourseId;
            //uc.OnSaveEvent += uc_OnSaveEvent;
            //pnlSections.Controls.Add(uc);
        }
Exemple #5
0
        private void LoadCourse(int courseId)
        {
            var user = Page.User as CustomPrincipal;

            var edit = hidEdit.Value;

            if (user != null)
            {
                using (var cHelper = new DbHelper.Classes())
                    using (var strHelper = new DbHelper.Structure())
                        using (var helper = new DbHelper.Subject())
                        {
                            var sub = helper.Find(courseId);
                            if (sub != null)
                            {
                                LoadSitemap(strHelper, sub);


                                txtSubjectName.Text = sub.FullName;
                                //uncomment
                                ListOfSectionsInCourseUC1.CourseId = Id;
                                lblPageTitle.Text = sub.FullName;

                                var courseStatus = cHelper.GetCourseClassesAvailabilityForUser(user.Id, sub.Id);

                                var stat = courseStatus.Split(new[] { ',' });

                                if (stat.Length >= 2)
                                {
                                    var fromCls = Request.QueryString["from"];
                                    var from    = "";
                                    if (fromCls == "detail")
                                    {
                                        from = "&from=detail";
                                    }
                                    else
                                    {
                                        from = "&from=view";
                                    }

                                    lnkMyClasses.Visible     = stat[1].Equals(DbHelper.StaticValues.Roles.Teacher);
                                    lnkMyClasses.NavigateUrl = "~/Views/Class/MyClasses.aspx?subId=" + courseId + from;
                                }

                                switch (stat[0])
                                {
                                case "current":
                                    if (stat.Length >= 3)
                                    {
                                        if (!(user.IsInRole("teacher") || user.IsInRole("manager")))
                                        {
                                            lnkEnroll.Visible     = stat[2] != "0";
                                            lnkEnroll.NavigateUrl = "~/Views/Class/SelfEnrolment.aspx?ccId=" + stat[2];
                                            lnkEnroll.Text        = "Remove Enrollment";
                                        }
                                        else
                                        {
                                            lnkEnroll.Visible = false;
                                        }

                                        //btnEnroll.Visible = stat[2] != "0";
                                        //btnEnroll.
                                    }
                                    imgJoinInfo.Visible  = true;
                                    imgJoinInfo.ImageUrl = "~/Content/Icons/Start/active_icon_10px.png";
                                    break;

                                case "complete":
                                    imgJoinInfo.Visible = true;
                                    if (!(user.IsInRole("teacher") || user.IsInRole("manager")))
                                    {
                                        imgJoinInfo.ImageUrl = "~/Content/Icons/Diploma/diploma_16px.png";
                                    }
                                    else
                                    {
                                        imgJoinInfo.ImageUrl = "~/Content/Icons/Stop/Stop_10px.png";
                                    }
                                    break;

                                case "open":
                                    //if (!(user.IsInRole("teacher") || user.IsInRole("manager")))
                                    //{

                                    //    btnEnroll.Visible = true;
                                    //    SetEnrollDialog();
                                    //}
                                    break;

                                case "close":

                                    break;

                                default:
                                    break;
                                }
                                //lblClassInformation.Text = cHelper.GetCourseClassesAvailabilityForUser(user.Id, sub.Id);
                            }
                            //CourseDetailUc1.
                        }
            }
        }