示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Visible           = false;
            valiStartDate.ErrorMessage = "Required";
            valiEnd.ErrorMessage       = "Required";
            if (!IsPostBack)
            {
                using (var helper = new DbHelper.AcademicYear())
                {
                    var aca     = helper.GetAcademicYear(AcademicYearId);
                    var session = helper.GetSession(SessionId);

                    if (aca != null)
                    {
                        lblHeading.Text         = "New Session Create";
                        lblAcademicHeading.Text = @"Session create in Academic Year: """ + aca.Name + @"""";
                        lblAcademicStart.Text   = "Start Date: " + aca.StartDate.ToShortDateString();
                        lblAcademicEnd.Text     = "End Date:   " + aca.EndDate.ToShortDateString();

                        ViewState["AcademicYearStartDate"] = aca.StartDate.Date;
                        ViewState["AcademicYearEndDate"]   = aca.EndDate.Date;
                    }
                    if (session != null)
                    {
                        lblHeading.Text = @"Edit Session """ + session.Name + @"""";
                        LoadSessionData(session);
                    }
                    //LoadSessionParametersAndDate();
                }
            }
        }
示例#2
0
        private void LoadCustomText()
        {
            try
            {
                #region Activity Resource

                var actResId = Request.QueryString["actResId"];
                //var actOrRes = Request.QueryString["actOrRes"];
                //var actOrResId = Request.QueryString["actOrResId"];
                //var actResType = Request.QueryString["actResType"];
                if (actResId != null)//actOrRes != null && actOrResId != null && actResType != null)
                {
                    var displayType = "";
                    //var type = Convert.ToByte(actResType);
                    //var aOrRId = Convert.ToInt32(actOrResId);
                    using (var helper = new DbHelper.ActAndRes())
                    {
                        var actRes = helper.GetActivityResource(Convert.ToInt32(actResId));
                        if (actRes != null)
                        {
                            if (Convert.ToBoolean(actRes.ActivityOrResource)) //activity
                            {
                                switch (actRes.ActivityResourceType - 1)
                                {
                                case (int)Enums.Activities.Assignment:     //Assignment
                                    displayType = Enums.Activities.Assignment.ToString().ToLower();
                                    break;

                                case (int)Enums.Activities.Chat:     //chat
                                    displayType = Enums.Activities.Chat.ToString().ToLower();
                                    break;

                                case (int)Enums.Activities.Forum:     //forum
                                    displayType = Enums.Activities.Forum.ToString().ToLower();
                                    break;

                                case (int)Enums.Activities.Choice:
                                    displayType = Enums.Activities.Choice.ToString().ToLower();
                                    break;

                                case (int)Enums.Activities.Lession:     //lession
                                    displayType = Enums.Activities.Lession.ToString().ToLower();
                                    break;

                                case (int)Enums.Activities.Wiki:     //wiki
                                    displayType = Enums.Activities.Wiki.ToString().ToLower();
                                    break;

                                case (int)Enums.Activities.Workshop:     //Workshop
                                    displayType = Enums.Activities.Workshop.ToString().ToLower();
                                    break;
                                }
                            }
                            else //resource
                            {
                                switch (actRes.ActivityResourceType - 1)
                                {
                                case (int)Enums.Resources.Book:     //Book
                                    displayType = Enums.Resources.Book.ToString().ToLower();
                                    break;

                                case (int)Enums.Resources.File:     //file
                                    displayType = Enums.Resources.File.ToString().ToLower();
                                    break;

                                case (int)Enums.Resources.Folder:
                                    displayType = Enums.Resources.Folder.ToString().ToLower();
                                    break;

                                case (int)(Enums.Resources.Label):
                                    displayType = Enums.Resources.Label.ToString().ToLower();
                                    break;

                                case (int)(Enums.Resources.Page):
                                    displayType = Enums.Resources.Page.ToString().ToLower();
                                    break;

                                case (int)(Enums.Resources.Url):
                                    displayType = Enums.Resources.Url.ToString().ToLower();
                                    break;
                                }
                            }
                            lblInfoText.Text = ("Are you sure to delete the " + displayType
                                                + ", " + actRes.Name + "?");
                            //DbHelper.StaticValues.Decode
                        }
                    }
                    return;
                }


                #endregion

                #region Book chapter

                var chapterId = Request.QueryString["bcId"];
                if (chapterId != null)
                {
                    using (var helper = new DbHelper.ActAndRes())
                    {
                        var chapter = helper.GetChapter(Convert.ToInt32(chapterId));
                        if (chapter != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the chapter, " + chapter.Title + "?";
                        }
                        return;
                    }
                }

                #endregion


                #region Grade

                var gradeId = Request.QueryString["grdId"];
                if (gradeId != null)
                {
                    using (var helper = new DbHelper.Grade())
                    {
                        var grade = helper.GetGrade(Convert.ToInt32(gradeId));
                        if (grade != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the grade, " + grade.Name + "?";
                        }
                        return;
                    }
                }

                #endregion

                #region Notice

                var noticeId = Request.QueryString["nId"];
                if (noticeId != null)
                {
                    using (var helper = new DbHelper.Notice())
                    {
                        var notice = helper.GetNotice(Convert.ToInt32(noticeId));
                        if (notice != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the notice, " + notice.Title + "?";
                        }
                    }
                    return;
                }

                #endregion

                #region Academic year and SEssion

                var acaId = Request.QueryString["acaId"];
                if (acaId != null)
                {
                    using (var helper = new DbHelper.AcademicYear())
                    {
                        var academic = helper.GetAcademicYear(Convert.ToInt32(acaId));
                        if (academic != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the academic year, " + academic.Name + "?";
                        }
                        return;
                    }
                }
                var sessId = Request.QueryString["sessId"];
                if (sessId != null)
                {
                    using (var helper = new DbHelper.AcademicYear())
                    {
                        var session = helper.GetSession(Convert.ToInt32(sessId));
                        if (session != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the session, " + session.Name + "?";
                        }
                        return;
                    }
                }
                #endregion

                #region SubjectClass

                var subclsId = Request.QueryString["subclsId"];
                if (subclsId != null)
                {
                    using (var helper = new DbHelper.Classes())
                    {
                        var cls = helper.GetSubjectSession(Convert.ToInt32(subclsId));
                        if (cls != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the class, " + (cls.IsRegular ? cls.GetName : cls.Name) + "?";
                        }
                    }
                    return;
                }

                #endregion

                #region Course and Category

                var catId = Request.QueryString["catId"];
                var crsId = Request.QueryString["crsId"];
                //crsId should be null so it means that its category only
                if (catId != null && crsId == null)
                {
                    using (var helper = new DbHelper.Subject())
                    {
                        var category = helper.GetCategory(Convert.ToInt32(catId));
                        if (category != null)
                        {
                            lblInfoText.Text = "Are you sure to delete the category, " + category.Name + "?";
                        }
                    }
                    return;
                }

                #endregion
            }
            catch { }
        }
示例#3
0
        void LoadData()
        {
            lblError.Visible           = false;
            valiStartDate.ErrorMessage = "Required";
            valiEnd.ErrorMessage       = "Required";
            if (!IsPostBack)
            {
                using (var helper = new DbHelper.AcademicYear())
                {
                    var aca = helper.GetAcademicYear(AcademicYearId);


                    if (aca != null)
                    {
                        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.ParentNode.Title
                                    , Value = SiteMap.CurrentNode.ParentNode.ParentNode.Url + "?edit=1"
                                    , Void  = true
                                },
                                new IdAndName()
                                {
                                    Name    = aca.Name
                                    , Value = SiteMap.CurrentNode.ParentNode.Url + "?aId=1&edit=1"
                                    , Void  = true
                                },
                                new IdAndName()
                                {
                                    Name = "Session edit"
                                }
                            };
                            SiteMapUc.SetData(list);
                        }
                        //lblHeading.Text = "New Session Create";
                        lblAcademicHeading.Text = aca.Name;
                        lblAcademicStart.Text   = aca.StartDate.ToString("D");
                        lblAcademicEnd.Text     = aca.EndDate.ToString("D");

                        ViewState["AcademicYearStartDate"] = aca.StartDate.Date;
                        ViewState["AcademicYearEndDate"]   = aca.EndDate.Date;

                        var session = helper.GetSession(SessionId);
                        if (session != null)
                        {
                            //lblHeading.Text = @"Edit Session """ + session.Name + @"""";
                            LoadSessionData(session);
                        }
                    }

                    //LoadSessionParametersAndDate();
                }
            }
        }
示例#4
0
        public void LoadData()
        {
            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                //if (user.IsInRole("manager"))
                //{
                //    btnActivate.Visible = true;
                //}
                //else
                //{
                //    btnActivate.Visible = false;
                //}
                using (var helper = new DbHelper.AcademicYear())
                {
                    var sId      = SessionId;
                    var aId      = AcademicYearId;
                    var academic = helper.GetAcademicYear(aId);
                    if (academic != null)
                    {
                        var session   = academic.Sessions.FirstOrDefault(x => x.Id == sId);
                        var editQuery = Session["editMode"] as string;//Request.QueryString["edit"];
                        var edit      = (editQuery ?? "0");
                        if (session != null)
                        {
                            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.ParentNode.Title
                                        , Value = SiteMap.CurrentNode.ParentNode.ParentNode.Url + "?edit=" + (edit)
                                        , Void  = true
                                    },
                                    new IdAndName()
                                    {
                                        Name    = academic.Name
                                        , Value = SiteMap.CurrentNode.ParentNode.Url + "?aId=" + AcademicYearId + "&edit=" + edit
                                        , Void  = true
                                    },
                                    new IdAndName()
                                    {
                                        Name = session.Name
                                    }
                                };
                                SiteMapUc.SetData(list);
                            }

                            //start and end dates
                            lblStart.Text = session.StartDate.ToString("D");
                            lblEnd.Text   = session.EndDate.ToString("D");

                            //string name = "";
                            if (session.Completed ?? false)
                            {
                                imgActive.ImageUrl = "~/Content/Icons/Stop/Stop_10px.png";
                                imgActive.Visible  = true;

                                //btnActivate.Visible = false;
                                //name = " (Complete)";
                            }
                            else if (session.IsActive)
                            {
                                imgActive.ImageUrl = "~/Content/Icons/Start/active_icon_10px.png";
                                imgActive.Visible  = true;
                                //name = " (Active)";
                                //btnActivate.Text = "Mark this as 'Complete'";
                            }
                            //else
                            //{

                            //    btnActivate.Text = "Activate this session";
                            //    //btnMarkComplete.Visible = false;
                            //}

                            lblHeading.Text   = academic.Name + " - " + session.Name;// + name;
                            lblPageTitle.Text = lblHeading.Text;

                            //classes
                            LoadClasses(session);



                            //SessionsListingInAYDetailUC.LoadSessionData(academic.Id, session.Id, session.Name, session.StartDate
                            //    , session.EndDate, session.IsActive, session.Completed ?? false, edit == "1");
                        }
                    }
                }
            }

            //using (var helper = new DbHelper.AcademicPlacement())
            //{
            //    var classes = helper.ListRunningRunningClasses(AcademicYearId, 0);//.OrderBy(p=>p.ProgramBatch.Program.Name);

            //    if (classes.Any())
            //        pnlSessionPrograms.Visible = true;

            //    ListView1.DataSource = classes;
            //    ListView1.DataBind();
            //}
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Visible = false;
            if (!IsPostBack)
            {
                try
                {
                    var aId   = Request.QueryString["aId"];
                    var sId   = Request.QueryString["sId"];
                    var clsId = Request.QueryString["clsId"];
                    var task  = Request.QueryString["task"];
                    var user  = Page.User as CustomPrincipal;
                    if (user != null)
                    {
                        using (var clsHelper = new DbHelper.Classes())
                            using (var helper = new DbHelper.AcademicYear())
                            {
                                if (aId != null)
                                {
                                    #region Academic year

                                    var acaId = Convert.ToInt32(aId);
                                    AcademicYearId = acaId;
                                    var aca = helper.GetAcademicYear(acaId);

                                    if (task != null && aca != null)
                                    {
                                        #region SiteMap

                                        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.ParentNode.ParentNode.Title
                                                    , Value = SiteMap.CurrentNode.ParentNode.ParentNode.ParentNode.Url + "?edit=1"
                                                    , Void  = true
                                                },
                                                new IdAndName()
                                                {
                                                    Name    = aca.Name
                                                    , Value = SiteMap.CurrentNode.ParentNode.ParentNode.Url + "?aId=" + aId + "&edit=1"
                                                    , Void  = true
                                                },
                                                new IdAndName()
                                                {
                                                    Name = (task == "activate")?"Activate":"Mark Complete"
                                                }
                                            };
                                            SiteMapUc.SetData(list);
                                        }

                                        #endregion
                                        if (aca.SchoolId != user.SchoolId)
                                        {
                                            Response.Redirect("~/Views/Academy/List.aspx");
                                        }
                                        Task = task;
                                        if (task == "activate")
                                        {
                                            lblPageTitle.Text = "Activate";
                                            lblHeading.Text   = "Activate Academic year : " + aca.Name + ((aca.IsActive) ? " (Active)" : "");
                                            if (aca.IsActive)
                                            {
                                                btnOk.Enabled = false;
                                                btnOk.ToolTip = "Already Active.";
                                                lblQue.Text   = "Already Active.";
                                            }
                                            else
                                            {
                                                lblQue.Text =
                                                    //"Previous academic year will be marked as completed along with all the running " +
                                                    //"classes in that academic year. " +
                                                    "All the classes in this academic year will be active. " +
                                                    "Are you sure to 'activate' the academic year : " + aca.Name
                                                    + "?";
                                            }
                                        }
                                        else if (task == "completed")
                                        {
                                            lblQue.Text = "All the running classes in this academic year will be marked as completed. " +
                                                          "This can't be undone. " +
                                                          "Are you sure to mark this academic year : <strong>" + aca.Name + "</strong>" +
                                                          ", as 'completed'? ";
                                            lblPageTitle.Text = "Mark complete";
                                            lblHeading.Text   = "Mark Academic year : " + aca.Name + " as 'Complete'";
                                        }
                                        else
                                        {
                                            Response.Redirect("~/Views/Academy/List.aspx");
                                        }
                                    }
                                    else
                                    {
                                        Response.Redirect("~/Views/Academy/List.aspx");
                                    }


                                    #endregion
                                }
                                else if (sId != null)
                                {
                                    #region Session

                                    var sessId = Convert.ToInt32(sId);
                                    SessionId = sessId;
                                    var sess = helper.GetSession(sessId);
                                    if (task != null && sess != null)
                                    {
                                        #region SiteMap

                                        AcademicYearId = sess.AcademicYearId;

                                        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.ParentNode.ParentNode.Title
                                                    , Value = SiteMap.CurrentNode.ParentNode.ParentNode.ParentNode.Url + "?edit=1"
                                                    , Void  = true
                                                },
                                                new IdAndName()
                                                {
                                                    Name    = sess.AcademicYear.Name
                                                    , Value = SiteMap.CurrentNode.ParentNode.ParentNode.Url
                                                              + "?aId=" + sess.AcademicYearId + "&edit=1"
                                                    , Void = true
                                                },
                                                new IdAndName()
                                                {
                                                    Name    = sess.Name
                                                    , Value = SiteMap.CurrentNode.ParentNode.Url + "?aId=" + sess.AcademicYearId
                                                              + "&sId=" + sess.Id + "&edit=1"
                                                    , Void = true
                                                },
                                                new IdAndName()
                                                {
                                                    Name = (task == "activate")?"Activate":"Mark Complete"
                                                }
                                            };
                                            SiteMapUc.SetData(list);
                                        }

                                        #endregion
                                        if (sess.AcademicYear.SchoolId != user.SchoolId)
                                        {
                                            Response.Redirect("~/Views/Academy/List.aspx");
                                        }
                                        Task = task;
                                        if (task == "activate")
                                        {
                                            lblQue.Text =
                                                "Previous session will be marked as completed along with all the running" +
                                                " classes in that session. This task " +
                                                "can't be undone. " +
                                                "Are you sure to 'activate' the session : " + sess.Name
                                                + "?";
                                            lblPageTitle.Text = "Activate";
                                            lblHeading.Text   = "Activate Session : " + sess.Name;
                                        }
                                        else if (task == "completed")
                                        {
                                            lblQue.Text = "All the running classes in this session will be marked as completed. " +
                                                          "This can't be undone. " +
                                                          "Are you sure to mark this session '<strong>" + sess.Name +
                                                          "</strong>' as '<em>completed</em>'? ";
                                            lblPageTitle.Text = "Mark complete";
                                            lblHeading.Text   = "Mark Session :  <strong>'" + sess.Name + "'</strong> as '<em>Complete</em>'";
                                        }
                                        else
                                        {
                                            Response.Redirect("~/Views/Academy/List.aspx");
                                        }
                                    }
                                    else
                                    {
                                        Response.Redirect("~/Views/Academy/List.aspx");
                                    }


                                    #endregion
                                }
                                else if (clsId != null)
                                {
                                    var classId = Convert.ToInt32(clsId);
                                    var cls     = clsHelper.GetSubjectSession(classId);
                                    if (cls != null && task != null)
                                    {
                                    }
                                }

                                else
                                {
                                    Response.Redirect("~/Views/Academy/List.aspx");
                                }
                            }
                    }
                }
                catch
                {
                    Response.Redirect("~/Views/Academy/List.aspx");
                }
            }
        }
示例#6
0
        private void LoadAcademicInfo()
        {
            using (var helper = new DbHelper.AcademicYear())
            {
                var aca = helper.GetAcademicYear(AcademicYearId);
                if (aca != null)
                {
                    if (!(aca.Void ?? false))
                    {
                        lblAcademicInfo.Text = "Classes assign in 'Academic year' : <strong>" + aca.Name + "</strong>";
                        var ses = helper.GetSession(SessionId);
                        if (ses != null)
                        {
                            hidStartDate.Value = ses.StartDate.ToShortDateString();
                            hidEndDate.Value   = ses.EndDate.ToShortDateString();

                            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.ParentNode.Title
                                        ,
                                        Value = SiteMap.CurrentNode.ParentNode.ParentNode.Url + "?edit=1"
                                        ,
                                        Void = true
                                    }
                                    ,
                                    new IdAndName()
                                    {
                                        Name = aca.Name
                                        ,
                                        Value = SiteMap.CurrentNode.ParentNode.Url + "?aId=" + aca.Id + "&edit=1"
                                        ,
                                        Void = true
                                    }
                                    ,
                                    new IdAndName()
                                    {
                                        Name = "Classes"
                                    }
                                };
                                SiteMapUc.SetData(list);
                            }

                            if (aca.Sessions.Select(x => x.Id).Contains(ses.Id))
                            {
                                lblAcademicInfo.Text += " and 'Session' : " + ses.Name;
                            }
                            else
                            {
                                Response.Redirect("~/Views/Academy/AcademicYear/AcademicYearDetail.aspx?aId=" +
                                                  AcademicYearId);
                            }
                        }
                        else
                        {
                            //ses==null
                            hidStartDate.Value = aca.StartDate.ToShortDateString();
                            hidEndDate.Value   = aca.EndDate.ToShortDateString();
                        }
                    }
                    else
                    {
                        Response.Redirect("~/Views/Academy/List.aspx");
                    }
                }
                else
                {
                    Response.Redirect("~/Views/Academy/List.aspx");
                }
            }
        }