protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            m_DbContext = GetDatabaseContext();
            dsUsers.ContextTypeName = m_DbContext.ToString();
            grdUsers.DataBind();

            linkCreate.Text = GetLocalResourceObject("linkCreate").ToString();
            linkCreate.Click += linkCreate_Click;
            linkCreate.ID = "LinkCreate";
            linkCreate.CssClass = "LinkCreate";
            phList.Controls.Add(linkCreate);
        }
        private void FetchMenu()
        {
            m_DbContext = BasePage.GetDatabaseContext();
            dsMenuItems.ContextTypeName = m_DbContext.ToString();
            int lcid = Thread.CurrentThread.CurrentCulture.LCID;
            var result = from o in m_DbContext.fnGetMenuItems(m_User.User.UserID, lcid, 1033) orderby o.ParentMenuID, o.Sequence select o;

            List<MenuItem> itemList = new List<MenuItem>();
            foreach (var i in result)
            {
                if (i.ParentMenuID == null)
                    i.ParentMenuID = 0;
                MenuItem mItem = new MenuItem(i.MenuID, (int)i.ParentMenuID, (int)i.level, (int)i.Sequence, i.Description, i.URL);
                itemList.Add(mItem);
            }

            MenuList = itemList;
        }
 public DemoDataGenerator(UserManagementDataContext dc)
 {
     this.dc = dc;
 }
 public UserRole()
 {
     m_DbContext = GetDatabaseContext();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            DetailComponent dc = null;
            Control c = this;

            try
            {
                while (dc == null)
                {
                    c = c.Parent;
                    if (c is DetailComponent)
                    {
                        dc = (DetailComponent)c;
                    }
                }
            }
            catch (Exception)
            {
                //throw new Exception("None of the parent components are DetailComponent.");
            }

            if (FieldToClear != null)
            {
                mpeList.OnOkScript = "document.getElementById('" + IdField.ClientID + "').value = document.getElementById('" + txtID.ClientID + "').value; " +
                                     " document.getElementById('" + DescrField.ClientID + "_I').value = document.getElementById('" + txtName.ClientID + "').value; " +
                                     " document.getElementById('" + FieldToClear.ClientID + "').value = '-1';" +
                                     " document.getElementById('" + DescrToClear.ClientID + "_I').value = '';";
            }
            else
            {
                mpeList.OnOkScript = "document.getElementById('" + IdField.ClientID + "').value = document.getElementById('" + txtID.ClientID + "').value; " +
                                     " document.getElementById('" + DescrField.ClientID + "_I').value = document.getElementById('" + txtName.ClientID + "').value; ";
            }

            if (dc != null)
            {
                mpeList.OnOkScript = mpeList.OnOkScript +
                                     " document.getElementById('" + dc.linkSubmit.ClientID + "').className = 'btnSubmitChanged'; ";
            }

            if (DoPostback)
            {
                Control d = Parent;
                try
                {
                    while (!(d is UpdatePanel))
                    {
                        d = d.Parent;
                    }
                }
                catch (Exception)
                {
                    d = null;
                }

                if (d != null)
                {
                    mpeList.OnOkScript += "__doPostBack('" + d.ClientID + "','');";
                }
                else
                {
                    mpeList.OnOkScript += " document.aspnetForm.submit(); ";
                }
            }

            grdList.ClientSideEvents.FocusedRowChanged = " function (s,e) { var hasInnerText = (document.getElementsByTagName('body')[0].innerText != undefined) ? true : false; " +
                                                         "  var index = s.GetFocusedRowIndex(); " +
                                                         "   if (index >= 0) { " +
                                                         "     var row = s.GetRow(index); " +
                                                         "     if(!hasInnerText){ " +
                                                         "         document.getElementById('" + txtID.ClientID + "').value = row.cells[0].textContent;" +
                                                         "         document.getElementById('" + txtName.ClientID + "').value = row.cells[1].textContent;" +
                                                         "     } else{" +
                                                         "         document.getElementById('" + txtID.ClientID + "').value = row.cells[0].innerText;" +
                                                         "         document.getElementById('" + txtName.ClientID + "').value = row.cells[1].innerText;" +
                                                         "     } " +
                                                         "  }  } ";

            if (SelectionHandler != SelectionTypes.None)
            {
                EventInfo eventInfo = dsList.GetType().GetEvent("Selecting");
                Type evType = eventInfo.EventHandlerType;
                Delegate d = Delegate.CreateDelegate(evType, this, SelectionHandler.ToString());
                MethodInfo addMethod = eventInfo.GetAddMethod();
                Object[] addHandlerArgs = { d };
                addMethod.Invoke(dsList, addHandlerArgs);

                m_DbContext = GetDatabaseContext();
                dsList.ContextTypeName = m_DbContext.ToString();
                grdList.DataBind();
            }
            else
            {
                DescrField.Visible = false;
                Visible = false;
            }
        }
        public static UserManagementDataContext GetDatabaseContext()
        {
            UserManagementDataContext result = null;
            BasePage bp = new BasePage();
            XElement context = bp.UserContext;

            if (HttpContext.Current != null)
            {
                result = (UserManagementDataContext)HttpContext.Current.Items["UserManagementDataContext"];
            }

            if (result == null)
            {
                result = new UserManagementDataContext(context);

                if (HttpContext.Current != null)
                {
                    HttpContext.Current.Items["UserManagementDataContext"] = result;
                }
            }

            return result;
        }
 public void LinkData(Role role)
 {
     selectedList.Clear();
     m_RoleID = role.RoleID;
     m_DbContext = GetDatabaseContext();
     var res = from rp in m_DbContext.RolePermissions where rp.RoleID == m_RoleID select rp;
     foreach (RolePermission item in res)
     {
         SelectionPermission sp = new SelectionPermission(item.PermissionID, item.Permission.Name, item.Permission.Action);
         if (!selectedList.Contains(sp))
             selectedList.Add(sp);
     }
 }