protected override Command CreateDeleteCommand(Customer entity, IAuthenticatedUser user, string selector)
 {
     return(Command
            .NonQuery()
            .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
            .StoredProcedure("[ExecutiveBoundedContext].[pCustomer_Delete]")
            .Parameters(
                p => p.Name("customerId").Value(entity.Id)
                ));
 }
        public override IEnumerable <Executive> GetAll()
        {
            var result = Query <Executive>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pExecutive_GetAll]")
                         .Execute();

            return(result.Records);
        }
예제 #3
0
        public async override Task <IEnumerable <Customer> > GetAllAsync()
        {
            var result = await Query <Customer>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pCustomer_GetAll]")
                         .ExecuteAsync();

            return(result.Records);
        }
예제 #4
0
        public async override Task <(int, IEnumerable <Customer>)> GetAsync(CollectionQueryParameters queryParameters)
        {
            var result = await Query <Customer>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pCustomer_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Count())
                         .ExecuteAsync();

            return(result.Count, result.Records);
        }
        public override (int, IEnumerable <Executive>) Get(CollectionQueryParameters queryParameters)
        {
            var result = Query <Executive>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pExecutive_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Count())
                         .Execute();

            return(result.Count, result.Records);
        }
예제 #6
0
        public async override Task <Customer> GetByIdAsync(int customerId)
        {
            var result = await Query <Customer>
                         .Single()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pCustomer_GetById]")
                         .Parameters(
                p => p.Name("customerId").Value(customerId)
                )
                         .ExecuteAsync();

            return(result.Record);
        }
예제 #7
0
 protected override Command CreateUpdateCommand(Employee entity, IAuthenticatedUser user, string selector)
 {
     return(Command
            .NonQuery()
            .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
            .StoredProcedure("[ExecutiveBoundedContext].[pEmployee_Update]")
            .Parameters(
                p => p.Name("employeeId").Value(entity.Id),
                p => p.Name("hireDate").Value(entity.HireDate),
                p => p.Name("name").Value(entity.Name),
                p => p.Name("updatedBy").Value(entity.UpdatedBy)
                ));
 }
        public override Executive GetById(int executiveId)
        {
            var result = Query <Executive>
                         .Single()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pExecutive_GetById]")
                         .Parameters(
                p => p.Name("executiveId").Value(executiveId)
                )
                         .Execute();

            return(result.Record);
        }
        public async override Task <IEnumerable <Employee> > GetAllAsync()
        {
            var result = await Query <Employee>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pEmployee_GetAll]")
                         .MapTypes(
                5,
                tm => tm.Type(typeof(Executive)).Index(1),
                tm => tm.Type(typeof(Employee)).Index(2)
                )
                         .ExecuteAsync();

            return(result.Records);
        }
        public async override Task <(int, IEnumerable <Employee>)> GetAsync(CollectionQueryParameters queryParameters)
        {
            var result = await Query <Employee>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pEmployee_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Count())
                         .MapTypes(
                5,
                tm => tm.Type(typeof(Executive)).Index(1),
                tm => tm.Type(typeof(Employee)).Index(2)
                )
                         .ExecuteAsync();

            return(result.Count, result.Records);
        }
예제 #11
0
        protected override Command CreateUpdateCommand(Person entity, IAuthenticatedUser user, string selector)
        {
            if (user != null)
            {
                entity.UpdatedBy = (int)user.Id;
            }

            return(Command
                   .NonQuery()
                   .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                   .StoredProcedure("[ExecutiveBoundedContext].[pPerson_Update]")
                   .Parameters(
                       p => p.Name("personId").Value(entity.Id),
                       p => p.Name("name").Value(entity.Name),
                       p => p.Name("updatedBy").Value(entity.UpdatedBy)
                       ));
        }
        public override IEnumerable <Person> GetAll()
        {
            var result = Query <Person>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pPerson_GetAll]")
                         .MapTypes(
                6,
                tm => tm.Type(typeof(Employee)).Index(1),
                tm => tm.Type(typeof(Executive)).Index(2),
                tm => tm.Type(typeof(Customer)).Index(3),
                tm => tm.Type(typeof(Person)).Index(4)
                )
                         .Execute();

            return(result.Records);
        }
        public async override Task <Employee> GetByIdAsync(int employeeId)
        {
            var result = await Query <Employee>
                         .Single()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pEmployee_GetById]")
                         .Parameters(
                p => p.Name("employeeId").Value(employeeId)
                )
                         .MapTypes(
                5,
                tm => tm.Type(typeof(Executive)).Index(1),
                tm => tm.Type(typeof(Employee)).Index(2)
                )
                         .ExecuteAsync();

            return(result.Record);
        }
        protected override Command CreateInsertCommand(Customer entity, IAuthenticatedUser user, string selector)
        {
            var command = Query <Customer>
                          .Single()
                          .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                          .StoredProcedure("[ExecutiveBoundedContext].[pCustomer_Insert]")
                          .Parameters(
                p => p.Name("rating").Value(entity.Rating),
                p => p.Name("name").Value(entity.Name),
                p => p.Name("createdBy").Value(entity.CreatedBy)
                )
                          .RecordInstance(entity)
                          .MapProperties(
                p => p.Name("Id").Index(0)
                );

            return(command);
        }
        public override (int, IEnumerable <Person>) Get(CollectionQueryParameters queryParameters)
        {
            var result = Query <Person>
                         .Collection()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pPerson_Get]")
                         .QueryParameters(queryParameters)
                         .Parameters(p => p.Name("count").Count())
                         .MapTypes(
                6,
                tm => tm.Type(typeof(Employee)).Index(1),
                tm => tm.Type(typeof(Executive)).Index(2),
                tm => tm.Type(typeof(Customer)).Index(3),
                tm => tm.Type(typeof(Person)).Index(4)
                )
                         .Execute();

            return(result.Count, result.Records);
        }
        protected override Command CreateInsertCommand(Executive entity, IAuthenticatedUser user, string selector)
        {
            var command = Query <Executive>
                          .Single()
                          .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                          .StoredProcedure("[ExecutiveBoundedContext].[pExecutive_Insert]")
                          .Parameters(
                p => p.Name("bonus").Value(entity.Bonus),
                p => p.Name("asset_Number").Value(entity.Asset.Number),
                p => p.Name("hireDate").Value(entity.HireDate),
                p => p.Name("name").Value(entity.Name),
                p => p.Name("createdBy").Value(entity.CreatedBy)
                )
                          .RecordInstance(entity)
                          .MapProperties(
                p => p.Name("Id").Index(0)
                );

            return(command);
        }
        public override Person GetById(int personId)
        {
            var result = Query <Person>
                         .Single()
                         .Connection(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName())
                         .StoredProcedure("[ExecutiveBoundedContext].[pPerson_GetById]")
                         .Parameters(
                p => p.Name("personId").Value(personId)
                )
                         .MapTypes(
                6,
                tm => tm.Type(typeof(Employee)).Index(1),
                tm => tm.Type(typeof(Executive)).Index(2),
                tm => tm.Type(typeof(Customer)).Index(3),
                tm => tm.Type(typeof(Person)).Index(4)
                )
                         .Execute();

            return(result.Record);
        }
예제 #18
0
 public SaveExecutiveCommandAggregate(SaveExecutiveInputDto executive, EntityDependency[] dependencies = null) : base(new DomainFramework.DataAccess.RepositoryContext(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName()))
 {
     Initialize(executive, dependencies);
 }
예제 #19
0
 public SaveExecutiveCommandAggregate() : base(new DomainFramework.DataAccess.RepositoryContext(ExecutiveEmployeePersonCustomerConnectionClass.GetConnectionName()))
 {
 }