Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                cProject = projectContext.GetById(int.Parse(Request.Params.Get("project")));

                Page.Title           = "Project: " + cProject.Name;
                LB_Owner.Text        = userContext.GetUsername(cProject.OwnerId);
                LB_Desc.Text         = cProject.Description;
                Uploadfile1.id       = cProject.IdProject;
                Uploadfile1.fileType = FileType.Project;
            }
            catch (Exception)
            {
                Response.Redirect("/Errors/403.aspx");
            }

            //Uploadfile1.Visible = Context.User.IsInRole(UserType.Teacher.ToString());

            var context = new IdentityDb();

            //Uploadfile1.Visible = context.GetUserRole(Context.User.Identity.GetUserId()) == CustomRoles.roles.Prof.ToString();

            if (cProject == null)
            {
                Response.Redirect("/Errors/403.aspx");
            }
            // else

            showFileList();

            // check if owner for edit button
            Button_Update.Visible = Context.User.Identity.GetUserId() == cProject.OwnerId;
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cUV = uvContext.GetByDenomination(Request.Params.Get("uv"));

            var context = new IdentityDb();

            Uploadfile1.Visible = context.GetUserRole(Context.User.Identity.GetUserId()) == CustomRoles.roles.Prof.ToString();

            if (cUV == null)
            {
                Response.Redirect("/Errors/403.aspx");
            }
            // else

            Page.Title           = cUV.Denomination + ": " + cUV.Name;
            LB_Owner.Text        = userContext.GetUsername(cUV.Owner);
            LB_Desc.Text         = cUV.Description;
            Uploadfile1.id       = cUV.IdUv;
            Uploadfile1.fileType = FileType.UV;

            showFileList();
            ShowQuizzesList();
            ShowProjectList();

            // check if owner for edit button
            bool isOwner = Context.User.Identity.GetUserId() == cUV.Owner;

            Button_Update_UV.Visible   = isOwner;
            Button_AddQuizz.Visible    = isOwner;
            Button_Add_Project.Visible = isOwner;
            Button_Add_Teacher.Visible = isOwner;
        }