Exemplo n.º 1
0
 private void ApplyFilterAndLoadData(string courseCompletionType)
 {
     using (var helper = new DbHelper.Classes())
     {
         var sessions = helper.ListClassesOfSubject(CourseId, courseCompletionType);
         dlistClasses.DataSource = sessions;
         dlistClasses.DataBind();
     }
 }
Exemplo n.º 2
0
        private void LoadInitialData(int courseId)
        {
            try
            {
                {
                    var cId = Convert.ToInt32(courseId);
                    using (var cHelper = new DbHelper.Classes())
                        using (var helper = new DbHelper.Subject())
                        {
                            var sub = helper.GetCourse(cId);
                            if (sub == null)
                            {
                                Response.Redirect("~/Views/All_Resusable_Codes/Error/ErrorPage.aspx");
                                return;
                            }

                            if ((sub.Void ?? false))
                            {
                                Response.Redirect("~/Views/All_Resusable_Codes/Error/ErrorPage.aspx");
                                return;
                            }
                            if (SiteMap.CurrentNode != null)
                            {
                                var list = new List <IdAndName>()
                                {
                                    new IdAndName()
                                    {
                                        Name    = SiteMap.RootNode.Title
                                        , Value = SiteMap.RootNode.Url
                                        , Void  = true
                                    },
                                    new IdAndName()
                                    {
                                        Name    = SiteMap.CurrentNode.ParentNode.Title
                                        , Value = SiteMap.CurrentNode.ParentNode.Url
                                        , Void  = true
                                    }
                                    , new IdAndName()
                                    {
                                        Name = sub.FullName
                                    }
                                };
                                SiteMapUc.SetData(list);
                            }
                            //if (sub != null)
                            {
                                //if (SiteMap.CurrentNode != null)
                                //{
                                //    SiteMap.CurrentNode.ReadOnly = false;
                                //    SiteMap.CurrentNode.Title = sub.FullName;
                                //    SiteMap.CurrentNode.Url = Request.Url.PathAndQuery;
                                //}



                                lblFullName.Text  = sub.FullName;
                                lblCategory.Text  = sub.SubjectCategory.Name;
                                lblShortName.Text = sub.ShortName;
                                lblHeading.Text   = sub.FullName;

                                //other componenets
                                lnkNewClass.NavigateUrl = "~/Views/Class/CourseSessionCreate.aspx?cId=" + courseId;

                                //lnkView.NavigateUrl = "~/Views/Course/Section/Master/CourseSectionListing.aspx?SubId=" + courseId
                                lnkView.NavigateUrl = "~/Views/Course/Section/?SubId=" + courseId
                                                      + "&from=detail";
                                lnkEdit.NavigateUrl   = "~/Views/Course/CourseCreate.aspx?crsId=" + courseId;
                                lnkDelete.NavigateUrl = "~/Views/All_Resusable_Codes/Delete/DeleteForm.aspx?task=" +
                                                        DbHelper.StaticValues.Encode("course") +
                                                        "&crsId=" + courseId +
                                                        "&catId=" + sub.SubjectCategoryId
                                                        + "&showText="
                                                        + DbHelper.StaticValues.Encode("Are you sure to delete the course " + sub.FullName + "?")
                                ;

                                hidCourseId.Value = courseId.ToString();

                                var sessions = cHelper.ListClassesOfSubject(cId, "All");
                                dlistClasses.DataSource = sessions;
                                dlistClasses.DataBind();
                            }
                        }
                }
            }
            catch { Response.Redirect("~/Views/Course/"); }
            //load course detail
        }