private void Assert(DomainObjectBase domainObject) { if (domainObject == null) { throw new ArgumentNullException(nameof(domainObject)); } }
internal void PerformValidation(DomainObjectBase domainObject) { if(domainObject == null) throw new ArgumentNullException("domainObject"); ((ErrorsContainer<string>)domainObject.Errors).Clear(); foreach(var property in domainObject.GetType(). GetProperties(BindingFlags.Public | BindingFlags.Instance)) { foreach(var attr in property.GetAttributes<ValidateAttributeBase>()) { var factory = this.factories[attr.GetType()]; var validator = factory(attr); if(validator == null) continue; string error; if(validator.Validate(domainObject, property, out error)) continue; ((ErrorsContainer<string>)domainObject.Errors).Add(property.Name, error); } } }
// TODO: These private methods have to be removed from the service, probably pull out a seperate type for these actions. private void ApplyPaymentToRefund(IOrderRepository orderRepository, DomainObjectBase creatorOrganizationRoleUser, DomainObjectBase order, PaymentInstrument paymentInstrument) { long paymentId = _paymentController.SavePayment(paymentInstrument, "Payment", creatorOrganizationRoleUser.Id); orderRepository.ApplyPaymentToOrder(order.Id, paymentId); }
public Order RefundOrder(IOrderable refundOrderItem, Order order, DomainObjectBase creatorOrganizationRoleUser, DomainObjectBase forOrganizationRoleUser) { IOrderController orderController = new OrderController(); orderController.AddItem(refundOrderItem, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, null, null, null, RefundItemStatus.Applied.OrderStatusState); order = orderController.RefundOrder(order); return(order); }
private void AddTransaction(DomainObjectBase domainObject, Action <DomainObjectBase> operation) { Assert(domainObject); var transaction = new Transaction { DomainObject = domainObject, Operation = operation }; _transactions.Add(transaction); }
private OrganizationRoleUser GetOrganizationRoleUsers(DomainObjectBase customer, long organizationRoleUserId, out OrganizationRoleUser forOrganizationRoleUser) { var organizationRoleUserRepository = new OrganizationRoleUserRepository(); var creatorOrganizationRoleUser = organizationRoleUserRepository.GetOrganizationRoleUser(organizationRoleUserId); forOrganizationRoleUser = null; var orgRoleUsers = organizationRoleUserRepository.GetOrganizationRoleUserCollectionforaUser(customer.Id); if (!orgRoleUsers.IsNullOrEmpty()) { forOrganizationRoleUser = orgRoleUsers.Where(org => org.RoleId == (long)Roles.Customer).FirstOrDefault(); } return(creatorOrganizationRoleUser); }
private Order PlaceOrder(DomainObjectBase forOrganizationRoleUser, DomainObjectBase creatorOrganizationRoleUser, IEnumerable <IOrderable> orderables, EventCustomer eventCustomer, SourceCode sourceCode, ShippingDetail shippingDetail) { bool indentedLineItemsAdded = false; foreach (var orderable in orderables) { if (!indentedLineItemsAdded && (orderable.OrderItemType == OrderItemType.EventPackageItem || orderable.OrderItemType == OrderItemType.EventTestItem)) { _orderController.AddItem(orderable, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, sourceCode, eventCustomer, shippingDetail, OrderStatusState.FinalSuccess); indentedLineItemsAdded = true; } else { _orderController.AddItem(orderable, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, OrderStatusState.FinalSuccess); } } return(_orderController.PlaceOrder(OrderType.Retail, creatorOrganizationRoleUser.Id)); }
public Order CancelRefundOrder(IEnumerable <IOrderable> refundOrderItem, Order order, DomainObjectBase creatorOrganizationRoleUser, DomainObjectBase forOrganizationRoleUser) { IOrderController orderController = new OrderController(); foreach (var orderable in refundOrderItem) { orderController.AddItem(orderable, 1, forOrganizationRoleUser.Id, creatorOrganizationRoleUser.Id, null, null, null, RefundItemStatus.NotApplied.OrderStatusState); } order = orderController.RefundOrder(order); return(order); }
private void Insert(DomainObjectBase domainObject) { domainObject.LastModified = GetLastModified(); Connection.Insert(domainObject); }
public void RegisterDelete(DomainObjectBase domainObject) { RegisterDelete(new[] { domainObject }); }
public void RegisterInsert(DomainObjectBase domainObject) { RegisterInsert(new[] { domainObject }); }
private void Delete(DomainObjectBase domainObject) { Connection.Delete(domainObject); }
private void Update(DomainObjectBase domainObject) { domainObject.LastModified = GetLastModified(); Connection.Update(domainObject); }