Пример #1
0
 protected void MakeSectionsSelected(int UserId)
 {
     dtPermissions = taPermissions.SelectPermissionsByUserId(UserId);
     for (int i = 0; i < dtPermissions.Rows.Count; i++)
     {
         for (int j = 0; j < chkSecurityPageSections.Items.Count; j++)
         {
             if (dtPermissions[i].SecurityPageSectionId.ToString() == chkSecurityPageSections.Items[j].Value)
             {
                 chkSecurityPageSections.Items[j].Selected = true;
             }
         }
     }
 }
Пример #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     HttpCookie cookie = Request.Cookies["DYL"];
     if (cookie == null)
     {
         string ReturnURL = Request.RawUrl.ToString();
         Response.Redirect("Login.aspx?msg=Your session has expired due to inactivity. Please login again.&ReturnURL=" + ReturnURL);
     }
     else
     {
         int AdminId = Convert.ToInt32(cookie["userid"]);
         dtAdmin = taAdmin.GetDataByAdminId(AdminId);
         string currentPageName = GetCurrentPageName();
         if (dtAdmin[0].Type.ToString() != "admin")
         {
             if (currentPageName != "home.aspx"
                 && currentPageName != "ChangePassword.aspx"
                 && currentPageName != "Logout.aspx"
                 && currentPageName != "PermissionDenied.aspx")
             {
                 dtSecurityPages = taSecurityPages.GetDataByPageName(currentPageName);
                 if (dtSecurityPages.Rows.Count > 0)
                 {
                     int SectionId = Convert.ToInt32(dtSecurityPages[0].SecurityPageSectionId);
                     dtPermissions = taPermissions.GetDataBySecurityPageSectionId(SectionId,AdminId);
                     if (dtPermissions.Rows.Count < 1)
                         Response.Redirect("PermissionDenied.aspx");
                     else
                         return;
                 }
                 else
                     Response.Redirect("PermissionDenied.aspx");
             }
             else
                 return;
         }
     }
 }