Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            int     role_id = Int32.Parse(Role_Id.Text);
            DataRow role_Dr = RoleSL.GetById(role_id);

            Entities.Role role = RoleSL.GetRole(role_Dr);
            Result.Text = string.Format("Role Id : {0} \nRole Name : {1}", role.Id, role.Role_Name);
        }
Example #2
0
        private bool CheckIfAdmin()
        {
            int userRoleId = Regestration.CurrentUser.Role_Id;
            int admin_role = (int)Role.Admin;

            Entities.Role AdminRole = RoleSL.GetRole(RoleSL.GetById(admin_role));
            Entities.Role UserRole  = RoleSL.GetRole(RoleSL.GetById(userRoleId));

            string AdminRole_name = Regestration.SplitSpaces(AdminRole.Role_Name);
            string userRole_name  = Regestration.SplitSpaces(UserRole.Role_Name);

            if (AdminRole_name == userRole_name)
            {
                return(true);
            }
            return(false);
        }