示例#1
0
        private void ActivityResourceDelete()
        {
            var user = Page.User as CustomPrincipal;

            if (user != null)
            {
                if (user.IsInRole("manager") ||
                    user.IsInRole(DbHelper.StaticValues.Roles.CourseEditor) ||
                    user.IsInRole("teacher"))
                {
                    var courseId  = Request.QueryString["crsId"];
                    var sectionId = Request.QueryString["secId"];
                    var actResId  = Request.QueryString["actResId"];

                    if (courseId != null && sectionId != null && actResId != null)
                    {
                        var secId = Convert.ToInt32(sectionId);
                        var arId  = Convert.ToInt32(actResId);
                        using (var actResHelper = new DbHelper.ActAndRes())
                        {
                            var deleted = actResHelper.DeleteActivityResource(arId);
                            if (deleted)
                            {
                                Response.Redirect("~/Views/Course/Section/default.aspx?SubId=" + courseId
                                                  + "&edit=1", false);
                            }
                            else
                            {
                                lblError.Visible = true;
                            }
                        }
                    }
                }
                else
                {
                    Response.Redirect("~/Views/All_Resusable_Codes/Error/ErrorPage.aspx?error=" +
                                      DbHelper.StaticValues.GetEncodedError(1)
                                      );
                }
            }
        }