private DtoResponse DeleteAddressCommand(IRepositoryLocator locator, long customerId, long addressId)
        {
            var customer = locator.GetById <Customer>(customerId);

            customer.DeleteAddress(locator, addressId);
            return(new DtoResponse());
        }
        private static AddressDto UpdateAddressCommand(IRepositoryLocator locator, AddressDto dto)
        {
            var address = locator.GetById <Address>(dto.Id);

            address.Update(locator, dto);
            return(AddressToAddressDto(address));
        }
        private CustomerDto UpdateCustomerCommand(IRepositoryLocator locator, CustomerDto dto)
        {
            var instance = locator.GetById <Customer>(dto.Id);

            instance.Update(locator, dto);
            return(Customer_to_Dto(instance));
        }
        public Query AddQuery(IRepositoryLocator locator,Query newQuery,string userName)
        {
            //Resolve windows user name to qt user
            var chris = locator.GetById<User>(1);

            var parameters = ExtractParameters(newQuery);
            newQuery.AssociateParameters(parameters);

            return locator.Save(AddDefaultProperties(newQuery,chris));
        }
        private DtoResponse DeleteAddressCommand(IRepositoryLocator locator, long id)
        {
            var address = locator.GetById <Address>(id);

            BusinessNotifier.AddWarning(BusinessWarningEnum.Default,
                                        string.Format("Address with id:{0} was deleted",
                                                      address.Id));

            locator.Remove(address);
            return(new DtoResponse());
        }
Example #6
0
        private DtoResponse DeleteCommand(IRepositoryLocator locator, long id)
        {
            var TEntity = locator.GetById <TEntity>(id);

            //BusinessNotifier.AddWarning (BusinessWarningEnum.Default,
            //                            string.Format ("TEntity with id:{0} was deleted",
            //                            TEntity.Id));
            //string description = "Deleted " + typeof(TEntity).Name + " : " + GetEntityInstanceName(TEntity);
            //LoggActivity(description, loggedInUserDto);
            locator.Remove(TEntity);
            return(new DtoResponse());
        }
        private DtoResponse DeleteCustomerCommand(IRepositoryLocator locator, long id)
        {
            var customer = locator.GetById <Customer>(id);

            BusinessNotifier.AddWarning(BusinessWarningEnum.Default,
                                        string.Format("Customer {0} {1} [id:{2}] was deleted",
                                                      customer.FirstName,
                                                      customer.LastName,
                                                      customer.Id));

            locator.Remove(customer);
            return(new DtoResponse());
        }
Example #8
0
        public static Address Create(IRepositoryLocator locator, AddressDto operation)
        {
            var customer = locator.GetById <Customer>(operation.CustomerId);
            var instance = new Address
            {
                Customer = customer,
                Street   = operation.Street,
                City     = operation.City,
                PostCode = operation.PostCode,
                Country  = operation.Country
            };

            locator.Save(instance);
            return(instance);
        }
        public static DispatchNote Create(IRepositoryLocator locator, DispatchNoteModel model)
        {
            var haulier  = locator.GetById <Haulier>(model.HaulierId);
            var instance = new DispatchNote
            {
                CreationDate       = model.CreationDate,
                LastUpdate         = model.CreationDate,
                DispatchDate       = model.DispatchDate,
                DispatchNoteStatus = New,
                DispatchReference  = model.DispatchReference,
                Haulier            = haulier,
                TruckReg           = model.TruckReg,
                User = model.User
            };

            locator.Save(instance);
            model.Lines.ForEach(l => instance.AddLine(locator, l));
            return(instance);
        }
 public Query AddParameters(IRepositoryLocator locator, long id, List<QueryParameter> parameters )
 {
     var q = locator.GetById<Query>(id);
     q.AssociateParameters(parameters);
     return q;
 }
Example #11
0
        private DispatchNoteModel GetDispathNoteByIdImpl(IRepositoryLocator locator, long id)
        {
            var instance = locator.GetById <DispatchNote>(id);

            return(Mapper.Map <DispatchNote, DispatchNoteModel>(instance));
        }
 private DispatchNoteModel GetDispathNoteByIdImpl(IRepositoryLocator locator, long id)
 {
     var instance = locator.GetById<DispatchNote>(id);
       return Mapper.Map<DispatchNote, DispatchNoteModel>(instance);
 }
 public CustomerDto UpdateCustomerCommand(IRepositoryLocator locator, CustomerDto dto)
 {
     var instance = locator.GetById<Customer>(dto.CustomerId);
     instance.Update(locator, dto);
     return CustomerToDto(instance);
 }
 public CustomerDto GetByIdCommand(IRepositoryLocator locator, long id)
 {
     var customer = locator.GetById<Customer>(id);
     return CustomerToDto(customer);
 }
 public bool DeleteQuery(IRepositoryLocator locator,long id)
 {
     var q = locator.GetById<Query>(id);
     locator.Delete(q);
     return true;
 }
 public IEnumerable<Query> GetQueryListForGroup(IRepositoryLocator locator,int groupId)
 {
     var list = (IEnumerable<Query>)locator.GetById<QueryGroup>(groupId).Queries;
     return list.AsEnumerable();
 }
        private static AddressDto CreateNewAddressCommand(IRepositoryLocator locator, AddressDto dto)
        {
            var customer = locator.GetById <Customer>(dto.CustomerId);

            return(AddressToAddressDto(customer.AddAddress(locator, dto)));
        }