Пример #1
0
        protected void btnSaveRight_Click(object sender, EventArgs e)
        {
            db.AdminUserRights.DeleteAllOnSubmit <AdminUserRight>(from s in db.AdminUserRights where s.UserId == UID select s);
            db.SubmitChanges();

            foreach (RadTreeNode rNode in rtvAdminMod.Nodes)
            {
                if (rNode.Nodes.Count > 0)
                {
                    foreach (RadTreeNode node in rNode.Nodes)
                    {
                        //not root node
                        if (node.Checked == true)
                        {
                            AdminUserRight sua = new AdminUserRight();
                            sua.UserId  = UID;
                            sua.ModKey  = node.Value;
                            sua.Allowed = true;
                            //sua.AssignedTime = DateTime.Now;

                            db.AdminUserRights.InsertOnSubmit(sua);
                        }
                    }
                }
            }
            db.SubmitChanges();
        }
Пример #2
0
 private bool IsValidUserRight(string action)
 {
     if (action.ToLower() == "changepass")
     {
         return(true);
     }
     else
     {
         AdminUserRight right = db.AdminUserRights.SingleOrDefault <AdminUserRight>(am => am.ModKey == action.ToLower() && am.UserId == UserId);
         return(right != null && right.Allowed.HasValue && (right.Allowed.Value == true));
     }
 }