示例#1
0
        /// <summary>
        /// List employees
        /// </summary>
        /// <param name="clientID"></param>
        public static List <SecurityRoleScreen> List(string role)
        {
            List <SecurityRoleScreen> roleList = new List <SecurityRoleScreen>();

            using (var connection = new MySqlConnection(ConnString.ConnectionStringFramework))
            {
                var commandString = string.Format(
                    " SELECT " +
                    " FKRoleCode, " +
                    " FKScreenCode " +
                    "   FROM SecurityRoleScreen " +
                    "   WHERE  FKRoleCode = '{0}'",
                    role);

                using (var command = new MySqlCommand(
                           commandString, connection))
                {
                    connection.Open();
                    using (MySqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            SecurityRoleScreen rolescreen = new SecurityRoleScreen();
                            rolescreen.FKRoleCode   = reader["FKRoleCode"].ToString();
                            rolescreen.FKScreenCode = reader["FKScreenCode"].ToString();

                            roleList.Add(rolescreen);
                        }
                    }
                }
            }

            return(roleList);
        }
示例#2
0
        public static ResponseStatus ListByRole(string inRole)
        {
            ResponseStatus response = new ResponseStatus();
            var            list     = SecurityRoleScreen.List(inRole);

            response.Contents = list;

            return(response);
        }
示例#3
0
        /// <summary>
        /// Add new screen to role
        /// </summary>
        /// <param name="clientContract"></param>
        /// <returns></returns>
        public static ResponseStatus AddScreenToRole(SecurityRoleScreen inRole)
        {
            ResponseStatus response = new ResponseStatus();
            var            role     = new SecurityRoleScreen();

            role.FKRoleCode   = inRole.FKRoleCode;
            role.FKScreenCode = inRole.FKScreenCode;

            response = role.Add();

            response.Contents = role;
            return(response);
        }