public AddressDto Delete(IObjectIdentifier <ulong> id)
        {
            var address = _repository.FindById(id);

            _repository.Delete(address.Id);
            return(AddressDto.FromDomain(address));
        }
Esempio n. 2
0
        public BillingInfoDto Delete(IObjectIdentifier <ulong> id)
        {
            var billingInfo = _repository.FindById(id);

            _repository.Delete(billingInfo.Id);
            return(BillingInfoDto.FromDomain(billingInfo));
        }
Esempio n. 3
0
        public InvoicePaymentDto Delete(IObjectIdentifier <ulong> id)
        {
            var payment = _repository.FindById(id);

            _repository.Delete(payment.Id);
            return(InvoicePaymentDto.FromDomain(payment));
        }
Esempio n. 4
0
        public static MvcHtmlString PropertyFor <TModel, TValue>(this HtmlHelper <TModel> html, Expression <Func <TModel, TValue> > expression)
        {
            if (ModeProvider == null)
            {
                ModeProvider = DependencyResolver.Current.GetService <IModeProvider>();
            }

            var result = html.DisplayFor(expression);

            if (ModeProvider.GetIsPageEditing(html.ViewContext.HttpContext) != true)
            {
                return(result);
            }

            if (ObjectIdentifier == null)
            {
                ObjectIdentifier = DependencyResolver.Current.GetService <IObjectIdentifier>();
            }

            if (PropertyExpressionMetaDataProvider == null)
            {
                PropertyExpressionMetaDataProvider = DependencyResolver.Current.GetService <IPropertyExpressionMetaDataProvider>();
            }

            var metaData = PropertyExpressionMetaDataProvider.GetFor(expression);

            return(MvcHtmlString.Create($"<span class=\"poetry-page-editing-property\" property-name=\"{metaData.PropertyName}\" object-id=\"{ObjectIdentifier.GetId(metaData.OwnerObject ?? html.ViewData.Model)}\">{result}</span>"));
        }
        public ContactInfoDto Delete(IObjectIdentifier <ulong> id)
        {
            var contactInfo = _repository.FindById(id);

            _repository.Delete(contactInfo.Id);
            return(ContactInfoDto.FromDomain(contactInfo));
        }
Esempio n. 6
0
        public SupplierDomain FindById(IObjectIdentifier <ulong> id)
        {
            var command = new SupplierFIndByIdCommand(_dataSource, id.Value);
            var entity  = command.Execute() ?? throw new ResourceNotFoundException(typeof(SupplierEntity), id);

            return(Aggreagate(entity));
        }
Esempio n. 7
0
        public InvoiceDomain FindById(IObjectIdentifier <ulong> id)
        {
            var command = new InvoiceFIndByIdCommand(_dataSource, id.Value);
            var entity  = command.Execute() ?? throw new ResourceNotFoundException(typeof(InvoiceEntity), id);

            return(PrepareAggregate(entity));
        }
Esempio n. 8
0
        public EntitySupplierDto Delete(IObjectIdentifier <ulong> id)
        {
            var supplier = _repository.FindById(id);

            _repository.Delete(supplier.Id);
            return(EntitySupplierDto.FromDomain(supplier));
        }
        public InvoicePayment FindById(IObjectIdentifier <ulong> id)
        {
            var command = new InvoicePaymentFindByIdCommand(_dataSource, id.Value);
            var entity  = command.Execute() ?? throw new ResourceNotFoundException(typeof(InvoicePaymentEntity), id);

            return(entity.ToDomain());
        }
Esempio n. 10
0
 public EntityReceiver(
     IObjectIdentifier <ulong> id,
     BillingInfoDomain billingInfo,
     ContactInfoDomain contactInfo
     ) : base(id, billingInfo, contactInfo)
 {
 }
            public ObjectData(IObjectIdentifier objectIdentifier)
            {
                ObjectIdentifier = objectIdentifier;
                ObjectLocator    = new ObjectLocator();

                ObjectIdentifier.RegisterComponents(ObjectLocator);
            }
        public InvoiceItemDto Delete(IObjectIdentifier <ulong> id)
        {
            var item = _repository.FindById(id);

            _repository.Delete(item.Id);
            return(InvoiceItemDto.FromDomain(item));
        }
Esempio n. 13
0
 private EntitySupplierDto(
     IObjectIdentifier <ulong> id,
     BillingInfoDto billingInfo,
     ContactInfoDto contactInfo
     ) : base(id, billingInfo, contactInfo)
 {
 }
Esempio n. 14
0
        public ContactInfoDomain FindById(IObjectIdentifier <ulong> id)
        {
            var command = new ContactInfoFindByIdCommand(_dataSource, id.Value);
            var entity  = command.Execute() ?? throw new ResourceNotFoundException(typeof(ContactInfoEntity), id);

            return(entity.ToDomain());
        }
    /// <summary>
    /// 异步设置对象标识。
    /// </summary>
    /// <param name="identifier">给定的 <see cref="IObjectIdentifier"/>。</param>
    /// <param name="newIdFactory">给定的新对象标识工厂方法。</param>
    /// <param name="cancellationToken">给定的 <see cref="CancellationToken"/>(可选)。</param>
    /// <returns>返回一个包含标识(兼容各种引用与值类型标识)的异步操作。</returns>
    public static async ValueTask <object> SetObjectIdAsync(this IObjectIdentifier identifier,
                                                            Func <object, object> newIdFactory, CancellationToken cancellationToken = default)
    {
        var currentId = await identifier.GetObjectIdAsync(cancellationToken).DisableAwaitContext();

        return(await identifier.SetObjectIdAsync(newIdFactory(currentId), cancellationToken)
               .DisableAwaitContext());
    }
        public void Delete(IObjectIdentifier <ulong> id)
        {
            var command = new InvoiceItemDeleteCommand(_dataSource, id.Value);

            if (!command.Execute())
            {
                throw new ResourceNotFoundException(typeof(AddressEntity), id);
            }
        }
Esempio n. 17
0
        public void Delete(IObjectIdentifier <ulong> id)
        {
            var command = new ContactInfoDeleteCommand(_dataSource, id.Value);

            if (!command.Execute())
            {
                throw new ResourceNotFoundException(typeof(ContactInfoEntity), id);
            }
        }
Esempio n. 18
0
 protected Entity(
     IObjectIdentifier <ulong> id,
     BillingInfoDomain billingInfo,
     ContactInfoDomain contactInfo
     )
 {
     Id          = id;
     BillingInfo = billingInfo;
     ContactInfo = contactInfo;
 }
Esempio n. 19
0
 protected EntityDto(
     IObjectIdentifier <ulong> id,
     BillingInfoDto billingInfo,
     ContactInfoDto contactInfo
     )
 {
     _id          = id;
     _billingInfo = billingInfo;
     _contactInfo = contactInfo;
 }
Esempio n. 20
0
        public static async ValueTask <object> SetObjectIdAsync(this IObjectIdentifier identifier,
                                                                Func <object, object> newIdFactory, CancellationToken cancellationToken = default)
        {
            identifier.NotNull(nameof(identifier));
            newIdFactory.NotNull(nameof(newIdFactory));

            var newId = await identifier.GetObjectIdAsync(cancellationToken).ConfigureAwait();

            return(await identifier.SetObjectIdAsync(newIdFactory.Invoke(newId), cancellationToken)
                   .ConfigureAwait());
        }
Esempio n. 21
0
        public SeriesIdentifier(IObjectIdentifier owner, ObjectDescriptor type, IEnumerable <SeriesIdentifier> sources, IEnumerable <ObjectDescriptor> modifiers)
        {
            Owner     = owner;
            Type      = type;
            Sources   = sources.ToList();
            Modifiers = modifiers;

            ShortDesignator = Owner.ShortDesignator + "." + Type.Name;
            LongDesignator  = BuildLongDesignator();
            Guid            = LongDesignator.GetHashCode();
        }
Esempio n. 22
0
        public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, IEnumerable<SeriesIdentifier> sources, IEnumerable<ObjectDescriptor> modifiers )
        {
            Owner = owner;
            Type = type;
            Sources = sources.ToList();
            Modifiers = modifiers;

            ShortDesignator = Owner.ShortDesignator + "." + Type.Name;
            LongDesignator = BuildLongDesignator();
            Guid = LongDesignator.GetHashCode();
        }
        private BillingInfoDto(
            IObjectIdentifier<ulong> id,
            string companyName,
            string zipCode,
            AddressDto billingAddress
        )
        {
            _id = id;
            _companyName = companyName;
            _zipCode = zipCode;
            _billingAddress = billingAddress;

        }
        public void Register(IObjectIdentifier objectIdentifier)
        {
            if (objectIdentifier == null)
            {
                throw new NullReferenceException($"Parameter {nameof(objectIdentifier)} cannot be null.");
            }

            if (_objectsMap.ContainsKey(objectIdentifier.ObjectId))
            {
                throw new Exception("Object already registered.");
            }

            _objectsMap.Add(objectIdentifier.ObjectId, new ObjectData(objectIdentifier));
        }
        public void Remove(IObjectIdentifier objectIdentifier)
        {
            if (objectIdentifier == null)
            {
                throw new NullReferenceException($"Parameter {nameof(objectIdentifier)} cannot be null.");
            }

            if (!_objectsMap.ContainsKey(objectIdentifier.ObjectId))
            {
                throw new Exception("Object was not being registered.");
            }

            _objectsMap.Remove(objectIdentifier.ObjectId);
        }
Esempio n. 26
0
 public InvoicePayment(
     IObjectIdentifier <ulong> id,
     EPaymentType paymentPaymentType,
     DateTime date,
     TimeZoneInfo timezone,
     decimal amount
     )
 {
     Id       = id;
     Type     = paymentPaymentType;
     Date     = date;
     TimeZone = timezone;
     Amount   = amount;
 }
 private InvoicePaymentDto(
     IObjectIdentifier <ulong> id,
     EPaymentType type,
     DateTime date,
     TimeZoneInfo timeZone,
     decimal amount
     )
 {
     _id       = id;
     _type     = type;
     _date     = date;
     _timeZone = timeZone;
     _amount   = amount;
 }
Esempio n. 28
0
 public InvoiceItem(
     IObjectIdentifier <ulong> id,
     string name,
     decimal unitPrice,
     EUnitType unitType,
     decimal discount,
     double quantity
     )
 {
     Id        = id;
     Name      = name;
     UnitPrice = unitPrice;
     UnitType  = unitType;
     Discount  = discount;
     Quantity  = quantity;
 }
Esempio n. 29
0
 private InvoiceItemDto(
     IObjectIdentifier <ulong> id,
     string name,
     decimal unitPrice,
     EUnitType unitType,
     decimal discount,
     double quantity
     )
 {
     _id        = id;
     _name      = name;
     _unitPrice = unitPrice;
     _unitType  = unitType;
     _discount  = discount;
     _quantity  = quantity;
 }
Esempio n. 30
0
 private AddressDto(
     IObjectIdentifier <ulong> id,
     string country,
     string city,
     string street,
     string state,
     string buildingNumber,
     string flatNumber
     )
 {
     _id             = id;
     _country        = country;
     _city           = city;
     _street         = street;
     _state          = state;
     _buildingNumber = buildingNumber;
     _flatNumber     = flatNumber;
 }
Esempio n. 31
0
 public Address(
     IObjectIdentifier <ulong> id,
     string country,
     string city,
     string street,
     string state,
     string buildingNumber,
     string flatNumber
     )
 {
     Id             = id;
     Country        = country;
     City           = city;
     Street         = street;
     State          = state;
     BuildingNumber = buildingNumber;
     FlatNumber     = flatNumber;
 }
Esempio n. 32
0
 public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, params SeriesIdentifier[] sources )
     : this(owner, type, sources, new List<ObjectDescriptor>())
 {
 }
Esempio n. 33
0
 public SeriesIdentifier( IObjectIdentifier owner, ObjectDescriptor type, IEnumerable<SeriesIdentifier> sources )
     : this(owner, type, sources, new List<ObjectDescriptor>())
 {
 }