Click here to Skip to main content
15,887,311 members
Articles / Desktop Programming / Windows Forms

Visual Application Launcher

Rate me:
Please Sign up or sign in to vote.
4.91/5 (37 votes)
23 Jan 2012CPOL23 min read 107.2K   3.7K   116  
A WinForms UI using WCF services, Entity Framework, repository data access, repository caching, Unit of Work, Dependency Injection, and every other buzz work you can think of!
namespace VAL.Contracts
{
    using System;
    using System.ServiceModel;
    using VAL.Contracts.ServiceFaults;
    using VAL.Contracts.ServiceBehaviour;
    using VAL.Model;
    using VAL.Model.Entities;

    [ServiceContract(Namespace = ServiceConstants.NameSpace)]
    [CyclicReferencesAware(true)]
    public interface IAdministratorService
    {
        #region File Operations
        /// <summary>
        /// Gets a list of all <see cref="File"/>s that are defined in the database
        /// </summary>
        /// <returns>List of Files</returns>       
        [OperationContract()]
        File[] GetAllFiles();

        /// <summary>
        /// Gets a list of all active <see cref="File"/>s that are defined in the database
        /// </summary>
        /// <returns>List of Active Files</returns>
        [OperationContract()]
        File[] GetActiveFiles();

        /// <summary>
        /// Gets a list of all active <see cref="File"/>s that are defined within a particular <see cref="Group"/>
        /// </summary>
        /// <param name="groupId">The unique ID of the group</param>
        /// <returns>List of files defined for a group</returns>
        [OperationContract()]
        File[] GetGroupFiles(int groupId);

        /// <summary>
        /// Gets a <see cref="File"/> from the database
        /// </summary>
        /// <param name="fileId">The unique ID of the file</param>
        /// <returns>A <see cref="File"/> instance</returns>
        [OperationContract()]
        File GetFile(int fileId);

        /// <summary>
        /// Either inserts or updates a <see cref="File"/> instance
        /// </summary>
        /// <param name="file">The <see cref="File"/> to persist to the database</param>
        [OperationContract()]
        [FaultContract(typeof(BusinessRulesFault))]
        File SaveFile(File file);

        /// <summary>
        /// Deletes a file from the database that matches the specified ID
        /// </summary>
        /// <param name="fileId">The unique ID of the file</param>
        [OperationContract()]
        void DeleteFile(int fileId);

        /// <summary>
        /// Gets a list of all <see cref="FileType"/>s that are defined in the database
        /// </summary>
        /// <returns>List of file types</returns>
        [OperationContract()]
        FileType[] GetFileTypes();

        #endregion

        #region Group Operations

        /// <summary>
        /// Gets a list of all <see cref="Group"/>s that are defined in the database
        /// </summary>
        /// <returns>List of Groups</returns>
        [OperationContract()]
        Group[] GetGroups();

        /// <summary>
        /// Gets a list of all active <see cref="Group"/>s that are defined for a particular <see cref="USer"/>
        /// </summary>
        /// <param name="userId">The unique ID of the user</param>
        /// <returns>List of groups defined for a user</returns>
        [OperationContract()]
        Group[] GetUserGroups(int userId);

        /// <summary>
        ///  Gets a list of all active <see cref="Group"/>s that are defined for a particular <see cref="File"/>
        /// </summary>
        /// <param name="fileId">The unique ID of the file</param>
        /// <returns>List of groups defined for a file</returns>
        [OperationContract()]
        Group[] GetFileGroups(int fileId);

        /// <summary>
        /// Creates a new <see cref="Group"/> with default values and saves it to the database
        /// </summary>
        /// <returns>The newly created <see cref="Group"/> object</returns>
        [OperationContract()]
        Group CreateNewGroup();

        /// <summary>
        /// Either inserts or updates a <see cref="Group"/> instance
        /// </summary>
        /// <param name="file">The <see cref="Group"/> to persist to the database</param>
        [OperationContract()]
        [FaultContract(typeof(BusinessRulesFault))]
        Group SaveGroup(Group group);

        /// <summary>
        /// Deletes a group from the database that matches the specified ID. This method will also
        /// remove all files assigned to the group (permissions) and users (group users)
        /// </summary>
        /// <param name="groupId">The unique ID of the group</param>
        [OperationContract()]
        void DeleteGroup(int groupId);

        #endregion

        #region Group Type Operations

        /// <summary>
        /// Gets a list of all <see cref="GroupType"/>s that are defined in the database
        /// </summary>
        /// <returns>List of group types</returns>
        [OperationContract()]
        GroupType[] GetGroupTypes();

        /// <summary>
        /// Either inserts or updates a <see cref="GroupType"/> instance
        /// </summary>
        /// <param name="file">The <see cref="GroupType"/> to persist to the datastore</param>
        [OperationContract()]
        [FaultContract(typeof(BusinessRulesFault))]
        GroupType SaveGroupType(GroupType groupType);

        /// <summary>
        /// Deletes a group type from the database
        /// </summary>
        /// <param name="groupTypeId">The unique ID of the group type</param>
        [OperationContract()]
        [FaultContract(typeof(BusinessRulesFault))]
        void DeleteGroupType(int groupTypeId);

        #endregion

        #region Permissions Operations

        /// <summary>
        /// Adds a <see cref="User"/> into a <see cref="Group"/>
        /// </summary>
        /// <param name="groupId">The unqiue ID of the group to add the user to</param>
        /// <param name="userId">The unique ID of the user to add to the group</param>
        [OperationContract()]
        void AddUsersToGroup(int groupId, int[] userId);

        /// <summary>
        /// Adds a <see cref="File"/> into a <see cref="Group"/>
        /// </summary>
        /// <param name="groupId">The unqiue ID of the group to add the file to</param>
        /// <param name="fileId">The unique ID of the file to add to the group</param>
        [OperationContract()]
        void AddFilesToGroup(int groupId, int[] fileId);

        /// <summary>
        /// Removes a <see cref="User"/> from a <see cref="Group"/>
        /// </summary>
        /// <param name="groupId">the unique ID of the group</param>
        /// <param name="userId">The unique ID of the user</param>
        [OperationContract()]
        void RemoveUsersFromGroup(int groupId, int[] userId);

        /// <summary>
        /// Removes a <see cref="File"/> from a <see cref="Group"/>
        /// </summary>
        /// <param name="groupId">the unique ID of the group</param>
        /// <param name="fileId">the unique id of the file</param>
        [OperationContract()]
        void RemoveFilesFromGroup(int groupId, int[] fileId);

        /// <summary>
        /// Clones a set of permissions from one user to another
        /// </summary>
        /// <param name="groups">A user object that defines a new user to save to the database</param>
        /// <param name="targetUserId">An array of groups identifiers to apply to the user</param>
        [OperationContract()]
        void CloneUserPermissions(string domainName, string firstName, string surname, int targetUserId);

        #endregion

        #region User Operations

        /// <summary>
        /// Deletes a user from the database that matches the specified ID
        /// </summary>
        /// <param name="userId">The unique ID of the user</param>
        [OperationContract()]
        void DeleteUser(int userId);

        /// <summary>
        /// Either inserts or updates a <see cref="User"/> instance
        /// </summary>
        /// <param name="file">The <see cref="User"/> to persist to the database</param>
        [OperationContract()]
        [FaultContract(typeof(BusinessRulesFault))]
        [FaultContract(typeof(UserFault))]
        User SaveUser(User user);

        /// <summary>
        /// Gets a list of all active <see cref="User"/>s that are defined within a particular <see cref="Group"/>
        /// </summary>
        /// <param name="groupId">The unique ID of the group</param>
        /// <returns>List of users defined within a group</returns>
        [OperationContract()]
        User[] GetGroupUsers(int groupId);

        /// <summary>
        /// Gets a list of all <see cref="User"/>s that are defined in the database
        /// </summary>
        /// <returns>List of Users</returns>
        [OperationContract()]
        User[] GetUsers();

        /// <summary>
        /// Gets a list of all active <see cref="User"/>s that are defined in the database
        /// </summary>
        /// <returns>List of active Users</returns>
        [OperationContract()]
        User[] GetActiveUsers();
        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions