public OrganizationReadCommand(
     IOrganizationRepository organizationRepository,
     IReadCommand <StateRegistrationResult> stateRegistrationReadCommand)
 {
     _organizationRepository       = organizationRepository;
     _stateRegistrationReadCommand = stateRegistrationReadCommand;
 }
Beispiel #2
0
        public EmployeeWriteCommand(
            IEmployeeRepository employeeRepository,
            IPassportRepository passportRepository,
            IContactRepository contactRepository,
            IOrganizationRepository organizationRepository,
            IStateRegistrationRepository stateRegistrationRepository,
            IReadCommand <PassportResult> passportReadCommand,
            IReadCommand <ContactResult> contactReadCommand,
            IEmployeeService employeeService,
            DomainContext domainContext)
        {
            Contract.Argument.IsNotNull(employeeRepository, nameof(employeeRepository));
            Contract.Argument.IsNotNull(passportRepository, nameof(passportRepository));
            Contract.Argument.IsNotNull(contactRepository, nameof(contactRepository));
            Contract.Argument.IsNotNull(organizationRepository, nameof(organizationRepository));
            Contract.Argument.IsNotNull(stateRegistrationRepository, nameof(stateRegistrationRepository));
            Contract.Argument.IsNotNull(passportReadCommand, nameof(passportReadCommand));
            Contract.Argument.IsNotNull(contactReadCommand, nameof(contactReadCommand));
            Contract.Argument.IsNotNull(employeeService, nameof(employeeService));
            Contract.Argument.IsNotNull(domainContext, nameof(domainContext));

            _employeeRepository          = employeeRepository;
            _passportRepository          = passportRepository;
            _contactRepository           = contactRepository;
            _organizationRepository      = organizationRepository;
            _stateRegistrationRepository = stateRegistrationRepository;
            _passportReadCommand         = passportReadCommand;
            _contactReadCommand          = contactReadCommand;
            _employeeService             = employeeService;
            _domainContext = domainContext;
        }
Beispiel #3
0
        /// <summary>
        /// Récupération d'une liste d'objets d'un certain type correspondant à un critère donnée.
        /// </summary>
        /// <param name="collection">Collection à charger.</param>
        /// <param name="commandName">Nom de la commande.</param>
        /// <param name="queryParameter">Paramètres de tri et de limite (vide par défaut).</param>
        /// <param name="criteria">Map de critères auquelle la recherche doit correpondre.</param>
        /// <returns>Collection.</returns>
        private ICollection <T> InternalLoadAll(ICollection <T> collection, string commandName, QueryParameter queryParameter, FilterCriteria criteria)
        {
            int maxRows = BrokerManager.NoLimit;

            if (queryParameter != null)
            {
                // Définition du tri à partir de la requete.
                queryParameter.RemapSortColumn(typeof(T));

                // Definition du maxRows
                maxRows = GetMaxRowCount(queryParameter.MaxRows);
            }

            IReadCommand    cmd  = this.GetCommand(commandName, _definition.ContractName, criteria, maxRows, queryParameter);
            ICollection <T> coll = CollectionBuilder <T> .ParseCommand(collection, cmd);

            long collCount = coll.Count;

            if (queryParameter != null && (queryParameter.Offset > 0 || queryParameter.Limit > 0))
            {
                collCount = QueryContext.InlineCount.Value;
            }

            if (maxRows > BrokerManager.NoLimit && collCount > maxRows)
            {
                throw new BrokerException("Store return too many rows.");
            }

            return(coll);
        }
Beispiel #4
0
        public InvitationController(
            IReadCommand <InvitationResult> invitationReadCommand)
        {
            Contract.Argument.IsNotNull(invitationReadCommand, nameof(invitationReadCommand));

            _invitationReadCommand = invitationReadCommand;
        }
 public InvitationController(
     IEmployeeRepository employeeRepository,
     InvitationWriteCommand invitationWriteCommand,
     IReadCommand <InvitationResult> invitationReadCommand)
 {
     _employeeRepository     = employeeRepository;
     _invitationReadCommand  = invitationReadCommand;
     _invitationWriteCommand = invitationWriteCommand;
 }
Beispiel #6
0
 public ProfileController(
     IReadCommand <ProfileResult> profileReadCommand,
     EmployeeReadCommand employeeReadCommand,
     ProfileWriteCommand profileWriteCommand)
 {
     _profileReadCommand  = profileReadCommand;
     _employeeReadCommand = employeeReadCommand;
     _profileWriteCommand = profileWriteCommand;
 }
        public OrganizationReadCommand(
            IOrganizationRepository organizationRepository,
            IReadCommand <StateRegistrationResult> stateRegistrationReadCommand)
        {
            Contract.Argument.IsNotNull(organizationRepository, nameof(organizationRepository));
            Contract.Argument.IsNotNull(stateRegistrationReadCommand, nameof(stateRegistrationReadCommand));

            _organizationRepository       = organizationRepository;
            _stateRegistrationReadCommand = stateRegistrationReadCommand;
        }
        public ForeignParticipantReadCommand(
            IForeignParticipantRepository foreignParticipantRepository,
            IReadCommand <PassportResult> passportReadCommand)
        {
            Contract.Argument.IsNotNull(foreignParticipantRepository, nameof(foreignParticipantRepository));
            Contract.Argument.IsNotNull(passportReadCommand, nameof(passportReadCommand));

            _foreignParticipantRepository = foreignParticipantRepository;
            _passportReadCommand          = passportReadCommand;
        }
Beispiel #9
0
        /// <summary>
        /// Récupération d'un objet à partir de critère de recherche.
        /// </summary>
        /// <param name="destination">Bean à charger.</param>
        /// <param name="criteria">Le critère de recherche.</param>
        /// <param name="returnNullIfZeroRow">Retourne null si la recherche a retournée zero ligne.</param>
        /// <returns>Objet.</returns>
        public T LoadByCriteria(T destination, FilterCriteria criteria, bool returnNullIfZeroRow = false)
        {
            if (criteria == null)
            {
                throw new ArgumentNullException("criteria");
            }

            string       commandName = ServiceSelect + "_LIKE_" + _definition.ContractName;
            IReadCommand cmd         = this.GetCommand(commandName, _definition.ContractName, criteria, BrokerManager.NoLimit, null);

            return(CollectionBuilder <T> .ParseCommandForSingleObject(destination, cmd, returnNullIfZeroRow));
        }
 public AlienReadCommand(
     IAlienRepository alienRepository,
     IReadCommand <ContactResult> contactReadCommand,
     IReadCommand <PassportResult> passportReadCommand,
     IReadCommand <OrganizationResult> organizationReadCommand,
     IReadCommand <StateRegistrationResult> stateRegistrationReadCommand)
 {
     _alienRepository              = alienRepository;
     _contactReadCommand           = contactReadCommand;
     _passportReadCommand          = passportReadCommand;
     _organizationReadCommand      = organizationReadCommand;
     _stateRegistrationReadCommand = stateRegistrationReadCommand;
 }
Beispiel #11
0
 public EmployeeReadCommand(
     IEmployeeRepository employeeRepository,
     IReadCommand <ContactResult> contactReadCommand,
     IReadCommand <PassportResult> passportReadCommand,
     IReadCommand <OrganizationResult> organizationReadCommand,
     IReadCommand <StateRegistrationResult> stateRegistrationReadCommand)
 {
     _employeeRepository           = employeeRepository;
     _contactReadCommand           = contactReadCommand;
     _passportReadCommand          = passportReadCommand;
     _organizationReadCommand      = organizationReadCommand;
     _stateRegistrationReadCommand = stateRegistrationReadCommand;
 }
Beispiel #12
0
        public ContactController(
            IEmployeeRepository employeeRepository,
            EmployeeWriteCommand employeeWriteCommand,
            IReadCommand <EmployeeResult> employeeReadCommand)
        {
            Contract.Argument.IsNotNull(employeeRepository, nameof(employeeRepository));
            Contract.Argument.IsNotNull(employeeWriteCommand, nameof(employeeWriteCommand));
            Contract.Argument.IsNotNull(employeeReadCommand, nameof(employeeReadCommand));

            _employeeRepository   = employeeRepository;
            _employeeWriteCommand = employeeWriteCommand;
            _employeeReadCommand  = employeeReadCommand;
        }
Beispiel #13
0
 public AccountController(ILogger <AccountController> logger, IUserService userService, IJwtAuthService jwtAuthManager, INewsRepository newsRepository, IEmployeeRepository employeeRepository, IVoteListRepository voteListRepository, DomainContext context, SystemContext systemContext, IReadCommand <ProfileResult> profileReadCommand, IVoteRepository voteRepository)
 {
     _logger             = logger;
     _userService        = userService;
     _jwtAuthManager     = jwtAuthManager;
     _employeeRepository = employeeRepository;
     _voteListRepository = voteListRepository;
     _newsRepository     = newsRepository;
     _context            = context;
     _systemContext      = systemContext;
     _voteListRepository = voteListRepository;
     _profileReadCommand = profileReadCommand;
     _voteRepository     = voteRepository;
 }
Beispiel #14
0
 public ProfileController(
     IReadCommand <ProfileResult> profileReadCommand,
     EmployeeReadCommand employeeReadCommand,
     ProfileWriteCommand profileWriteCommand,
     IInvitationRepository invitationRepositore,
     IMembershipRepository membershipRepository,
     IPublicationRepository publicationRepository,
     IDepartureRepository departureRepository)
 {
     _profileReadCommand    = profileReadCommand;
     _employeeReadCommand   = employeeReadCommand;
     _profileWriteCommand   = profileWriteCommand;
     _invitationRepositore  = invitationRepositore;
     _membershipRepository  = membershipRepository;
     _publicationRepository = publicationRepository;
     _departureRepository   = departureRepository;
 }
Beispiel #15
0
        public ProfileController(
            IEmployeeRepository employeeRepository,
            IReadCommand <ProfileResult> profileReadCommand,
            IReadCommand <EmployeeResult> employeeReadCommand,
            UserReadCommand userReadCommand,
            ProfileWriteCommand profileWriteCommand)
        {
            Contract.Argument.IsNotNull(employeeRepository, nameof(employeeRepository));
            Contract.Argument.IsNotNull(profileReadCommand, nameof(profileReadCommand));
            Contract.Argument.IsNotNull(employeeReadCommand, nameof(employeeReadCommand));
            Contract.Argument.IsNotNull(userReadCommand, nameof(userReadCommand));
            Contract.Argument.IsNotNull(profileWriteCommand, nameof(profileWriteCommand));

            _employeeRepository  = employeeRepository;
            _profileReadCommand  = profileReadCommand;
            _employeeReadCommand = employeeReadCommand;
            _userReadCommand     = userReadCommand;
            _profileWriteCommand = profileWriteCommand;
        }
Beispiel #16
0
        /// <summary>
        /// Charge un bean à partir de sa clef primaire.
        /// </summary>
        /// <param name="destination">Le bean à charger.</param>
        /// <param name="primaryKey">Valeur de la clef primaire.</param>
        /// <returns>Bean.</returns>
        public T Load(T destination, object primaryKey)
        {
            if (primaryKey == null)
            {
                throw new ArgumentNullException("primaryKey");
            }

            _definition.PrimaryKey.CheckValueType(primaryKey);

            string commandName = ServiceSelect + "_" + _definition.ContractName;

            // On charge l'objet à partir d'un seul critère
            // correspondant à sa clé primaire
            FilterCriteria criteria = new FilterCriteria(_definition.PrimaryKey.MemberName, Expression.Equals, primaryKey);

            IReadCommand cmd = this.GetCommand(commandName, _definition.ContractName, criteria, BrokerManager.NoLimit, null);

            return(CollectionBuilder <T> .ParseCommandForSingleObject(destination, cmd));
        }
Beispiel #17
0
 public InvitationController(
     ILogger <InvitationController> logger,
     IEmployeeRepository employeeRepository,
     InvitationWriteCommand invitationWriteCommand,
     IReadCommand <InvitationResult> invitationReadCommand,
     IInvitationRepository invitationRepository,
     IInternationalAgreementRepository iInternationalAgreementRepository,
     IConsularOfficeRepository consularOfficeRepository,
     IWebHostEnvironment environment)
 {
     Logger = logger;
     _employeeRepository                = employeeRepository;
     _invitationReadCommand             = invitationReadCommand;
     _invitationWriteCommand            = invitationWriteCommand;
     _invitationRepository              = invitationRepository;
     _environment                       = environment;
     _iInternationalAgreementRepository = iInternationalAgreementRepository;
     _consularOfficeRepository          = consularOfficeRepository;
 }
        public InvitationReadCommand(
            IInvitationRepository invitationRepository,
            IReadCommand <AlienResult> alienReadCommand,
            IReadCommand <EmployeeResult> employeeReadCommand,
            IReadCommand <VisitDetailResult> visitDetailReadCommand,
            ForeignParticipantReadCommand foreignParticipantReadCommand)
        {
            Contract.Argument.IsNotNull(invitationRepository, nameof(invitationRepository));
            Contract.Argument.IsNotNull(alienReadCommand, nameof(alienReadCommand));
            Contract.Argument.IsNotNull(employeeReadCommand, nameof(employeeReadCommand));
            Contract.Argument.IsNotNull(visitDetailReadCommand, nameof(visitDetailReadCommand));
            Contract.Argument.IsNotNull(foreignParticipantReadCommand, nameof(foreignParticipantReadCommand));

            _invitationRepository          = invitationRepository;
            _alienReadCommand              = alienReadCommand;
            _employeeReadCommand           = employeeReadCommand;
            _visitDetailReadCommand        = visitDetailReadCommand;
            _foreignParticipantReadCommand = foreignParticipantReadCommand;
        }
Beispiel #19
0
        public EmployeeReadCommand(
            IEmployeeRepository employeeRepository,
            IReadCommand <ContactResult> contactReadCommand,
            IReadCommand <PassportResult> passportReadCommand,
            IReadCommand <OrganizationResult> organizationReadCommand,
            IReadCommand <StateRegistrationResult> stateRegistrationReadCommand)
        {
            Contract.Argument.IsNotNull(employeeRepository, nameof(employeeRepository));
            Contract.Argument.IsNotNull(contactReadCommand, nameof(contactReadCommand));
            Contract.Argument.IsNotNull(passportReadCommand, nameof(passportReadCommand));
            Contract.Argument.IsNotNull(organizationReadCommand, nameof(organizationReadCommand));
            Contract.Argument.IsNotNull(stateRegistrationReadCommand, nameof(stateRegistrationReadCommand));

            _employeeRepository           = employeeRepository;
            _contactReadCommand           = contactReadCommand;
            _passportReadCommand          = passportReadCommand;
            _organizationReadCommand      = organizationReadCommand;
            _stateRegistrationReadCommand = stateRegistrationReadCommand;
        }
Beispiel #20
0
 /// <summary>
 /// Exécute une commande et lit un élement.
 /// </summary>
 /// <typeparam name="T">Type de l'élement.</typeparam>
 /// <param name="cmd">Commande à exécuter.</param>
 /// <returns>Objet.</returns>
 public static T ReadItem <T>(this IReadCommand cmd)
     where T : class, new()
 {
     return(CollectionBuilder <T> .ParseCommandForSingleObject(cmd));
 }
Beispiel #21
0
        public static ICollection <TCollection> ParseCommand(ICollection <TCollection> collection, IReadCommand cmd)
        {
            if (cmd == null)
            {
                throw new ArgumentNullException("cmd");
            }

            using (IDataReader reader = cmd.ExecuteReader()) {
                return(ParseReader(collection, reader));
            }
        }
Beispiel #22
0
 public TValue Invoke <TValue>(IReadCommand <TValue> command)
 {
     command.Execute();
     return(command.Value);
 }
Beispiel #23
0
 /// <summary>
 /// Exécute la commande et liste une liste d'éléments.
 /// </summary>
 /// <typeparam name="T">Type de l'élément.</typeparam>
 /// <param name="cmd">Commande à exécuter.</param>
 /// <returns>Liste d'éléments.</returns>
 public static ICollection <T> ReadList <T>(this IReadCommand cmd)
     where T : class, new()
 {
     return(CollectionBuilder <T> .ParseCommand(cmd));
 }