コード例 #1
0
ファイル: SessionDetail.aspx.cs プロジェクト: skrishnau/LMS
        private void LoadClasses(Academic.DbEntities.Session session)
        {
            //classes
            //var dict = helper.ListClassesForNextSession(user.SchoolId, sessionPosition);

            using (var usrHelper = new DbHelper.User())
            {
                var teacherRoleId = usrHelper.GetRole(Academic.DbHelper.DbHelper.StaticValues.Roles.Teacher)
                                    .Id;
                var noticeText =
                    "&nbsp;&nbsp;&nbsp;&nbsp;<img src = '/Content/Icons/Notice/Warning_Shield_16px.png'/> " +
                    "<span style='backgroundcolor=darkslategrey;'>Teacher not assigned yet.</span>";

                var rcs  = session.RunningClasses.Where(x => !(x.Void ?? false));
                var dict = rcs.GroupBy(x => x.ProgramBatch.Program);


                foreach (var program in dict)
                {
                    var uc = (ProgramClassesUc)
                             Page.LoadControl("~/Views/Academy/Session/ProgramClassesUc.ascx");
                    uc.LoadData(program, teacherRoleId, noticeText);
                    pnlListing.Controls.Add(uc);
                }
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CustomDialog.OkClick     += CustomDialog_OkClick;
            CustomDialog.CancelClick += CustomDialog_CancelClick;
            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                if (!IsPostBack)
                {
                    var isManager = user.IsInRole(DbHelper.StaticValues.Roles.Manager);
                    var isTeacher = user.IsInRole(DbHelper.StaticValues.Roles.Teacher);

                    if (!isTeacher && !isManager)
                    {
                        Response.Redirect("~/");
                        return;
                    }


                    SetMarkCompletionDialog();

                    var edit = (Session["editMode"] as string) == "1";


                    var classId = Request.QueryString["ccId"];
                    if (classId != null)
                    {
                        var clsId = Convert.ToInt32(classId);
                        SubjectClassId = clsId;

                        using (var helper = new DbHelper.Classes())
                            using (var usrHelper = new DbHelper.User())
                            {
                                var cls = helper.GetSubjectSession(clsId);
                                if (cls != null)
                                {
                                    var teacherRoleId = usrHelper.GetRole(Academic.DbHelper.DbHelper.StaticValues.Roles.Teacher)
                                                        .Id;
                                    lbldNotice.Visible = !cls.ClassUsers.Any(x => x.RoleId == teacherRoleId &&
                                                                             !(x.Void ?? false));


                                    //lblStartDate.Text =cls.StartDate==null?" - ": cls.StartDate.Value.ToString("D");
                                    //lblEndDate.Text = cls.EndDate==null?" - ":cls.EndDate.Value.ToString("D");
                                    var clsname        = cls.GetName;
                                    var coursefullname = cls.GetCourseFullName;
                                    lblTitle.Text = clsname;

                                    if (cls.SessionComplete ?? false)
                                    {
                                        imgIndicate.ToolTip = "Complete";
                                        imgIndicate.Visible = true;
                                    }
                                    else if (cls.StartDate <= DateTime.Now && cls.EndDate >= DateTime.Now)
                                    {
                                        imgIndicate.Visible  = true;
                                        imgIndicate.ToolTip  = "Active";
                                        imgIndicate.ImageUrl = "~/Content/Icons/Start/active_icon_10px.png";
                                    }
                                    else
                                    {
                                        imgIndicate.Visible  = true;
                                        imgIndicate.ToolTip  = "Due";
                                        imgIndicate.ImageUrl = "~/Content/Icons/Watch/alarm_clock_14px.png";
                                    }

                                    lblEnrollmentMethod.Text = cls.EnrollmentMethod == 0
                                    ? "Auto"
                                    : (cls.EnrollmentMethod == 1) ? "Manual" : "Self";

                                    var autoEnrollment = cls.EnrollmentMethod == 0;

                                    var curTeach = helper.IsTheUserCurrentlyTeacher(user.Id,
                                                                                    cls.IsRegular ? cls.SubjectStructure.SubjectId : cls.SubjectId ?? 0);


                                    if (edit && (isManager || curTeach) && !(cls.SessionComplete ?? false))
                                    {
                                        lnkMarkCompletion.Visible = true;
                                        lnkEnrollStudents.Visible = (!autoEnrollment || isManager);//&& (isTeacher || isManager);
                                        lnkEnrollTeachers.Visible = isManager;
                                    }



                                    hidOrderby.Value = autoEnrollment ? "crn" : "name";

                                    LoadSitemap(cls);
                                    var from = Request.QueryString["from"];
                                    lnkReport.NavigateUrl         = "~/Views/Report/?ccId=" + cls.Id + "&from=" + from;
                                    lnkEnrollStudents.NavigateUrl = "~/Views/Class/Enrollment/Enrollment.aspx?ccId=" +
                                                                    hidSubjectSessionId.Value + "&type=student";
                                    lnkEnrollTeachers.NavigateUrl = "~/Views/Class/Enrollment/Enrollment.aspx?ccId=" +
                                                                    hidSubjectSessionId.Value + "&type=teacher";


                                    lblClassName.Text  = clsname;        //cls.IsRegular ? cls.GetName : cls.Name;
                                    lblCourseName.Text = coursefullname; //cls.IsRegular
                                    //? cls.SubjectStructure.Subject.FullName
                                    //: cls.Subject.FullName;


                                    lblEndDate.Text   = cls.EndDate == null ? " - " : cls.EndDate.Value.ToString("D");
                                    lblStartDate.Text = cls.StartDate == null ? " - " : cls.StartDate.Value.ToString("D");



                                    //grouping
                                    //var grp = "No grouping";
                                    //if (cls.HasGrouping)
                                    //{
                                    //    grp = "";
                                    //    cls.SubjectClassGrouping.ToList().ForEach(c =>
                                    //    {
                                    //        grp += cls.Name + ", ";
                                    //    });
                                    //    grp = grp.TrimEnd(new char[] { ',' });
                                    //}
                                    //lblGrouping.Text = grp;



                                    //ListView1.DataSource = helper.ListSubjectSessionEnrolledUsers(clsId);
                                    //ListView1.DataSource = helper.ListEnrolledUsers(clsId);
                                    // ListView1.DataBind();
                                }
                            }
                    }
                }
            }
        }
コード例 #3
0
        private void LoadData()
        {
            var rc   = Request.QueryString["rcId"];
            var rcId = Convert.ToInt32(rc ?? "0");

            using (var usrHelper = new DbHelper.User())
                using (var helper = new DbHelper.Classes())
                {
                    var rcls = helper.GetRunningClass(rcId);
                    if (rcls != null)
                    {
                        LoadSitemap(rcls);

                        lblProgramBatchName.Text    = rcls.ProgramBatch.NameFromBatch;//+"  "+
                        lblAcademicSessionName.Text =
                            rcls.AcademicYear.Name + " - " + rcls.Session.Name;
                        lblYearSubYearName.Text = rcls.Year.Name + " - " +
                                                  rcls.SubYear.Name;

                        lblTitle.Text = rcls.ProgramBatch.NameFromBatch + " : " + lblYearSubYearName.Text;

                        var teacherRoleId = usrHelper.GetRole(Academic.DbHelper.DbHelper.StaticValues.Roles.Teacher)
                                            .Id;

                        foreach (var sub in rcls.SubjectClasses.Where(x => !(x.Void ?? false)))
                        {
                            var teacherPresent = sub.ClassUsers.Any(x => x.RoleId == teacherRoleId && !(x.Void ?? false));

                            var link = new HyperLink()
                            {
                                NavigateUrl = "~/Views/Class/CourseClassDetail.aspx?ccId=" + sub.Id,
                                CssClass    = "list-group-item"
                            };

                            var lbl = new Label()
                            {
                                Text = sub.GetCourseFullName + "<br />",
                                //CssClass = "link"
                            };
                            link.Controls.Add(lbl);


                            if (!teacherPresent)
                            {
                                var noticeText =
                                    "&nbsp;&nbsp;&nbsp;&nbsp;<img src = '/Content/Icons/Notice/Warning_Shield_16px.png'/> " +
                                    "Teacher is not assigned to this class yet. Please assign teacher(s).<br/>";
                                var literal = new Literal()
                                {
                                    Text = noticeText,
                                };
                                link.Controls.Add(literal);
                                //link.Text += noticeText;
                            }


                            //var notice = new Literal()
                            //{
                            //    Text = "&nbsp;&nbsp;&nbsp;&nbsp;<img src = '/Content/Icons/Notice/Warning_Shield_16px.png'/> " +
                            //                "Teacher is not assigned to this class yet. Please assign teacher(s).<br/>",
                            //};


                            //    <asp:Image ID="imgNotice" runat="server" ImageUrl="~/Content/Icons/Notice/Warning_Shield_16px.png" />

                            //Teacher is not assigned to this class yet. Please assign teacher(s).

                            pnlSubjects.Controls.Add(link);
                            //pnlSubjects.Controls.Add(notice);
                            //pnlSubjects.Controls.Add(new Literal()
                            //{
                            //    Text = "<br/>"
                            //});
                        }
                    }
                }
        }
コード例 #4
0
ファイル: SelfEnrolment.aspx.cs プロジェクト: skrishnau/LMS
        protected void Page_Load(object sender, EventArgs e)
        {
            CustomDialog.OkClick     += CustomDialog_OkClick;
            CustomDialog.CancelClick += CustomDialog_CancelClick;
            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                if (!IsPostBack)
                {
                    var classId = Request.QueryString["ccId"];
                    if (classId != null)
                    {
                        var clsId = Convert.ToInt32(classId);
                        SubjectClassId = clsId;

                        using (var helper = new DbHelper.Classes())
                            using (var usrHelper = new DbHelper.User())
                            {
                                var cls = helper.GetSubjectSession(clsId);
                                if (cls != null)
                                {
                                    var subject = cls.IsRegular ? cls.SubjectStructure.Subject : cls.Subject;
                                    ListOfSectionsInCourseUC.UserId   = user.Id;
                                    ListOfSectionsInCourseUC.CourseId = subject.Id;

                                    var teacherRoleId = usrHelper.GetRole(Academic.DbHelper.DbHelper.StaticValues.Roles.Teacher)
                                                        .Id;
                                    lbldNotice.Visible = !cls.ClassUsers.Any(x => x.RoleId == teacherRoleId &&
                                                                             !(x.Void ?? false));
                                    var clsname = cls.GetName;
                                    lblTitle.Text      = clsname;
                                    lblClassName.Text  = clsname;          //cls.IsRegular ? cls.GetName : cls.Name;
                                    lblCourseName.Text = subject.FullName; //cls.IsRegular

                                    lblEndDate.Text   = cls.EndDate == null ? " - " : cls.EndDate.Value.ToString("D");
                                    lblStartDate.Text = cls.StartDate == null ? " - " : cls.StartDate.Value.ToString("D");


                                    if (!(user.IsInRole("manager") || user.IsInRole("teacher")))
                                    {
                                        var joinedClass = helper.HasTheUserAlreadyJoinedThisClass(user.Id, cls.Id);
                                        if (!(cls.SessionComplete ?? false) &&
                                            cls.EnrollmentMethod == 2)
                                        {
                                            if (joinedClass != null)
                                            {
                                                lblJoinLastDate.Text = joinedClass.StartDate.HasValue
                                                ? joinedClass.StartDate.Value.ToString("D")
                                                : "-";
                                                lblJoinLstDateTitle.Text = "Joined on";

                                                SetEnrollDialog(false);
                                                btnEnroll.Text    = "Remove enrolment";
                                                btnEnroll.Visible = true;
                                            }
                                            else if ((cls.JoinLastDate ?? DateTime.MaxValue.Date) >= DateTime.Now.Date)
                                            {
                                                lblJoinLastDate.Text = cls.JoinLastDate.HasValue
                                                ? cls.JoinLastDate.Value.ToString("D")
                                                : "-";

                                                SetEnrollDialog(true);
                                                btnEnroll.Visible = true;
                                            }
                                            //lnkEnrollNow.NavigateUrl = "";
                                        }
                                        //else if (joinedClass!=null && !(cls.SessionComplete ?? false))
                                        //{

                                        //}
                                    }
                                    else
                                    {
                                        lblJoinLastDate.Text = cls.JoinLastDate == null ? " - " : cls.JoinLastDate.Value.ToString("D");
                                    }

                                    lnkViewCourse.Visible     = true;
                                    lnkViewCourse.NavigateUrl = "~/Views/Course/Section/?SubId=" + subject.Id;
                                    hidOrderby.Value          = "name";
                                    LoadSitemap(cls);
                                }
                            }
                    }
                }
            }
        }