protected override void InitializeCollectionComplexProperties(PaymentConditionStandart model) { if (model.PaymentsConditions == null) throw new ArgumentException("PaymentsConditions cannot be null"); PaymentsConditions = new ValidatableChangeTrackingCollection<PaymentConditionWrapper>(model.PaymentsConditions.Select(e => GetWrapper<PaymentConditionWrapper, PaymentCondition>(e))); RegisterCollection(PaymentsConditions, model.PaymentsConditions); }
public void Load() { UnitOfWork = Container.Resolve <IUnitOfWork>(); var salesUnits = UnitOfWork.Repository <SalesUnit>() .Find(x => !x.IsRemoved && !x.IsLoosen && !x.Product.ProductBlock.IsService && x.OrderInTakeDate <= DateTime.Today) .OrderBy(salesUnit => salesUnit.EndProductionDateCalculated) .Select(salesUnit => new SalesUnitDates(salesUnit)) .ToList(); _salesUnits = new ValidatableChangeTrackingCollection <SalesUnitDates>(salesUnits); //подписываемся на изменение каждой сущности _salesUnits.PropertyChanged += SalesUnitsOnPropertyChanged; Groups.Clear(); var groups = _salesUnits .GroupBy(x => new { Cost = x.Model.Cost, Facility = x.Model.Facility.Id, Product = x.Model.Product.Id, Order = x.Model.Order?.Id, Project = x.Model.Project.Id, Specification = x.Model.Specification?.Id, x.PickingDate }) .Select(x => new SalesUnitDatesGroup(x)) .OrderBy(x => x.Units.First().Model.EndProductionDateCalculated); Groups.AddRange(groups); }
protected override void GetData() { _unitOfWork = Container.Resolve <IUnitOfWork>(); var salesUnits = ((ISalesUnitRepository)_unitOfWork.Repository <SalesUnit>()).GetForDatesView() .Where(salesUnit => salesUnit.Order != null || salesUnit.OrderInTakeDate <= DateTime.Today) .OrderBy(salesUnit => salesUnit.EndProductionDateCalculated) .Select(salesUnit => new SalesUnitDates(salesUnit)) .ToList(); _salesUnits = new ValidatableChangeTrackingCollection <SalesUnitDates>(salesUnits); //подписываемся на изменение каждой сущности _salesUnits.PropertyChanged += SalesUnitsOnPropertyChanged; _groups = _salesUnits .GroupBy(salesUnitDates => new { Cost = salesUnitDates.Model.Cost, Facility = salesUnitDates.Model.Facility.Id, Product = salesUnitDates.Model.Product.Id, Order = salesUnitDates.Model.Order?.Id, Project = salesUnitDates.Model.Project.Id, Specification = salesUnitDates.Model.Specification?.Id, salesUnitDates.DeliveryDate, salesUnitDates.EndProductionDate, salesUnitDates.PickingDate, salesUnitDates.RealizationDate, salesUnitDates.ShipmentDate }) .Select(x => new SalesUnitDatesGroup(x)) .OrderBy(x => x.Units.First().Model.OrderInTakeDate); }
protected override void GetData() { _unitOfWork = Container.Resolve <IUnitOfWork>(); var items = _unitOfWork.Repository <SalesUnit>().GetAll() .Where(salesUnit => !salesUnit.IsRemoved && !salesUnit.IsLoosen && salesUnit.Specification != null) .Where(salesUnit => salesUnit.Product.ProductBlock.IsService) .OrderBy(salesUnit => salesUnit.RealizationDateCalculated) .Select(salesUnit => new ServiceRealizationDatesItem(salesUnit)) .ToList(); _items = new ValidatableChangeTrackingCollection <ServiceRealizationDatesItem>(items); //подписываемся на изменение каждой сущности _items.PropertyChanged += ItemsOnPropertyChanged; _groups = _items .GroupBy(item => new { Cost = item.Model.Cost, Facility = item.Model.Facility.Id, Product = item.Model.Product.Id, Order = item.Model.Order?.Id, Project = item.Model.Project.Id, Specification = item.Model.Specification?.Id, item.RealizationDate }) .Select(x => new ServiceRealizationDatesGroup(x)) .OrderBy(x => x.Units.First().Model.OrderInTakeDate); }
protected override void InitializeCollectionComplexProperties(TestHusband model) { if (model.Children == null) { throw new ArgumentException("Children cannot be null"); } Children = new ValidatableChangeTrackingCollection <TestChildWrapper>(model.Children.Select(e => GetWrapper <TestChildWrapper, TestChild>(e))); RegisterCollection(Children, model.Children); }
protected override void InitializeCollectionProperties() { if (Model.PaymentsPlanned == null) { throw new ArgumentException($"{nameof(PaymentsPlanned)} can not be null"); } PaymentsPlanned = new ValidatableChangeTrackingCollection <PaymentPlannedWrapper>(Model.PaymentsPlanned.Select(e => new PaymentPlannedWrapper(e))); RegisterCollection(PaymentsPlanned, Model.PaymentsPlanned); }
protected override void InitializeCollectionComplexProperties(Parameter model) { if (model.RequiredParentParametersList == null) { throw new ArgumentException("RequiredParentParametersList cannot be null"); } RequiredParentParametersList = new ValidatableChangeTrackingCollection <RequiredParentParametersWrapper>(model.RequiredParentParametersList.Select(e => GetWrapper <RequiredParentParametersWrapper, RequiredParentParameters>(e))); RegisterCollection(RequiredParentParametersList, model.RequiredParentParametersList); }
protected override void InitializeCollectionComplexProperties(Country model) { if (model.Districts == null) { throw new ArgumentException("Districts cannot be null"); } Districts = new ValidatableChangeTrackingCollection <DistrictWrapper>(model.Districts.Select(e => GetWrapper <DistrictWrapper, District>(e))); RegisterCollection(Districts, model.Districts); }
protected override void InitializeCollectionComplexProperties(TestFriend model) { if (model.Emails == null) { throw new ArgumentException("Emails cannot be null"); } Emails = new ValidatableChangeTrackingCollection <TestFriendEmailWrapper>(model.Emails.Select(e => GetWrapper <TestFriendEmailWrapper, TestFriendEmail>(e))); RegisterCollection(Emails, model.Emails); }
protected override void InitializeCollectionComplexProperties(Person model) { if (model.Employees == null) { throw new ArgumentException("Employees cannot be null"); } Employees = new ValidatableChangeTrackingCollection <EmployeeWrapper>(model.Employees.Select(e => GetWrapper <EmployeeWrapper, Employee>(e))); RegisterCollection(Employees, model.Employees); }
protected override void InitializeCollectionComplexProperties(TestFriendGroup model) { if (model.FriendTests == null) { throw new ArgumentException("FriendTests cannot be null"); } FriendTests = new ValidatableChangeTrackingCollection <TestFriendWrapper>(model.FriendTests.Select(e => GetWrapper <TestFriendWrapper, TestFriend>(e))); RegisterCollection(FriendTests, model.FriendTests); }
protected override void InitializeCollectionComplexProperties(Offer model) { if (model.OfferUnits == null) { throw new ArgumentException("OfferUnits cannot be null"); } OfferUnits = new ValidatableChangeTrackingCollection <OfferUnitWrapper>(model.OfferUnits.Select(e => GetWrapper <OfferUnitWrapper, OfferUnit>(e))); RegisterCollection(OfferUnits, model.OfferUnits); }
protected override void InitializeCollectionComplexProperties(RequiredParentParameters model) { if (model.Parameters == null) { throw new ArgumentException("Parameters cannot be null"); } Parameters = new ValidatableChangeTrackingCollection <ParameterWrapper>(model.Parameters.Select(e => GetWrapper <ParameterWrapper, Parameter>(e))); RegisterCollection(Parameters, model.Parameters); }
protected override void InitializeCollectionProperties() { if (Model.Notes == null) { throw new ArgumentException("Notes cannot be null"); } Notes = new ValidatableChangeTrackingCollection <NoteWrapper>(Model.Notes.Select(e => new NoteWrapper(e))); RegisterCollection(Notes, Model.Notes); }
protected override void InitializeCollectionComplexProperties(User model) { if (model.Roles == null) { throw new ArgumentException("Roles cannot be null"); } Roles = new ValidatableChangeTrackingCollection <UserRoleWrapper>(model.Roles.Select(e => GetWrapper <UserRoleWrapper, UserRole>(e))); RegisterCollection(Roles, model.Roles); }
protected override void InitializeCollectionComplexProperties(Region model) { if (model.Localities == null) { throw new ArgumentException("Localities cannot be null"); } Localities = new ValidatableChangeTrackingCollection <LocalityWrapper>(model.Localities.Select(e => GetWrapper <LocalityWrapper, Locality>(e))); RegisterCollection(Localities, model.Localities); }
protected override void InitializeCollectionProperties() { if (Model.PaymentsActual == null) { throw new ArgumentException("PaymentsActual cannot be null"); } PaymentsActual = new ValidatableChangeTrackingCollection <PaymentActualWrapper1>(Model.PaymentsActual.Select(paymentActual => new PaymentActualWrapper1(paymentActual))); RegisterCollection(PaymentsActual, Model.PaymentsActual); }
protected override void InitializeCollectionProperties() { if (Model.Emails == null) { throw new ArgumentException("Emails cannot be null"); } Emails = new ValidatableChangeTrackingCollection <TestFriendEmailWrapper>(Model.Emails.Select(e => new TestFriendEmailWrapper(e))); RegisterCollection(Emails, Model.Emails); }
protected override void InitializeCollectionComplexProperties(Document model) { if (model.CopyToRecipients == null) { throw new ArgumentException("CopyToRecipients cannot be null"); } CopyToRecipients = new ValidatableChangeTrackingCollection <EmployeeWrapper>(model.CopyToRecipients.Select(e => GetWrapper <EmployeeWrapper, Employee>(e))); RegisterCollection(CopyToRecipients, model.CopyToRecipients); }
protected override void InitializeCollectionComplexProperties(Specification model) { if (model.SalesUnits == null) { throw new ArgumentException("SalesUnits cannot be null"); } SalesUnits = new ValidatableChangeTrackingCollection <SalesUnitWrapper>(model.SalesUnits.Select(e => GetWrapper <SalesUnitWrapper, SalesUnit>(e))); RegisterCollection(SalesUnits, model.SalesUnits); }
protected override void InitializeCollectionComplexProperties(PaymentDocument model) { if (model.Payments == null) { throw new ArgumentException("Payments cannot be null"); } Payments = new ValidatableChangeTrackingCollection <PaymentActualWrapper>(model.Payments.Select(e => GetWrapper <PaymentActualWrapper, PaymentActual>(e))); RegisterCollection(Payments, model.Payments); }
protected override void InitializeCollectionComplexProperties(District model) { if (model.Regions == null) { throw new ArgumentException("Regions cannot be null"); } Regions = new ValidatableChangeTrackingCollection <RegionWrapper>(model.Regions.Select(e => GetWrapper <RegionWrapper, Region>(e))); RegisterCollection(Regions, model.Regions); }
public void Load(IEnumerable <SalesUnit> units, SpecificationWrapper specificationWrapper, IUnitOfWork unitOfWork, bool isNew) { Load(units, unitOfWork, isNew); _specificationWrapper = specificationWrapper; //назначаем спецификацию всем юнитам var specificationSimpleWrapper = new SpecificationSimpleWrapper(_specificationWrapper.Model); Groups.ForEach(x => x.Specification = specificationSimpleWrapper); _groupsToReject = new ValidatableChangeTrackingCollection <ProjectUnitsGroup>(Groups); }
protected override void GetData() { _unitOfWork = Container.Resolve <IUnitOfWork>(); var specifications = _unitOfWork.Repository <Specification>().GetAll() .OrderByDescending(specification => specification.Date) .Select(specification => new SpecificationSignDatesWrapper(specification)) .ToList(); _specifications = new ValidatableChangeTrackingCollection <SpecificationSignDatesWrapper>(specifications); }
protected override void GetData() { UnitOfWork = Container.Resolve <IUnitOfWork>(); //загружаем все юниты и фиксируем их в коллекции для отслеживания изменений _salesUnitWrappers = new ValidatableChangeTrackingCollection <SalesUnitWrapper1>( UnitOfWork.Repository <SalesUnit>() .Find(x => !x.IsRemoved && !x.IsLoosen && !x.IsPaid && x.Project.ForReport && x.Project.Manager.IsAppCurrentUser()) .Select(x => new SalesUnitWrapper1(x, UnitOfWork))); //подписка на изменение _salesUnitWrappers.PropertyChanged += (sender, args) => SaveCommand.RaiseCanExecuteChanged(); _salesUnitWrappers.CollectionChanged += (sender, args) => SaveCommand.RaiseCanExecuteChanged(); }
protected override void InitializeCollectionComplexProperties(ParameterGroup model) { if (model.Parameters == null) { throw new ArgumentException("Parameters cannot be null"); } Parameters = new ValidatableChangeTrackingCollection <ParameterWrapper>(model.Parameters.Select(e => GetWrapper <ParameterWrapper, Parameter>(e))); RegisterCollection(Parameters, model.Parameters); if (model.Measures == null) { throw new ArgumentException("Measures cannot be null"); } Measures = new ValidatableChangeTrackingCollection <MeasureWrapper>(model.Measures.Select(e => GetWrapper <MeasureWrapper, Measure>(e))); RegisterCollection(Measures, model.Measures); }
protected override void InitializeCollectionComplexProperties(SalesUnit model) { if (model.ChildSalesUnits == null) { throw new ArgumentException("ChildSalesUnits cannot be null"); } ChildSalesUnits = new ValidatableChangeTrackingCollection <SalesUnitWrapper>(model.ChildSalesUnits.Select(e => GetWrapper <SalesUnitWrapper, SalesUnit>(e))); RegisterCollection(ChildSalesUnits, model.ChildSalesUnits); if (model.TenderUnits == null) { throw new ArgumentException("TenderUnits cannot be null"); } TenderUnits = new ValidatableChangeTrackingCollection <TenderUnitWrapper>(model.TenderUnits.Select(e => GetWrapper <TenderUnitWrapper, TenderUnit>(e))); RegisterCollection(TenderUnits, model.TenderUnits); if (model.OfferUnits == null) { throw new ArgumentException("OfferUnits cannot be null"); } OfferUnits = new ValidatableChangeTrackingCollection <OfferUnitWrapper>(model.OfferUnits.Select(e => GetWrapper <OfferUnitWrapper, OfferUnit>(e))); RegisterCollection(OfferUnits, model.OfferUnits); if (model.PaymentsConditions == null) { throw new ArgumentException("PaymentsConditions cannot be null"); } PaymentsConditions = new ValidatableChangeTrackingCollection <PaymentConditionWrapper>(model.PaymentsConditions.Select(e => GetWrapper <PaymentConditionWrapper, PaymentCondition>(e))); RegisterCollection(PaymentsConditions, model.PaymentsConditions); if (model.PaymentsPlanned == null) { throw new ArgumentException("PaymentsPlanned cannot be null"); } PaymentsPlanned = new ValidatableChangeTrackingCollection <PaymentPlanWrapper>(model.PaymentsPlanned.Select(e => GetWrapper <PaymentPlanWrapper, PaymentPlan>(e))); RegisterCollection(PaymentsPlanned, model.PaymentsPlanned); if (model.PaymentsActual == null) { throw new ArgumentException("PaymentsActual cannot be null"); } PaymentsActual = new ValidatableChangeTrackingCollection <PaymentActualWrapper>(model.PaymentsActual.Select(e => GetWrapper <PaymentActualWrapper, PaymentActual>(e))); RegisterCollection(PaymentsActual, model.PaymentsActual); }
/// <summary> /// Регистрация коллекции. /// </summary> /// <typeparam name="TWrapper"></typeparam> /// <typeparam name="TModel"></typeparam> /// <param name="wrapperCollection">коллекция обертки.</param> /// <param name="modelCollection">коллекция модели.</param> protected void RegisterCollection <TWrapper, TModel>( IValidatableChangeTrackingCollection <TWrapper> wrapperCollection, ICollection <TModel> modelCollection) where TWrapper : WrapperBase <TModel> where TModel : BaseEntity { //синхронизируем коллекцию модели с коллекцией обертки. wrapperCollection.CollectionChanged += (s, e) => { modelCollection.Clear(); foreach (TModel modelItem in wrapperCollection.Select(x => x.Model)) { modelCollection.Add(modelItem); } Validate(); }; RegisterTrackingObject(wrapperCollection); }
protected override void InitializeCollectionComplexProperties(Tender model) { if (model.Participants == null) { throw new ArgumentException("Participants cannot be null"); } Participants = new ValidatableChangeTrackingCollection <CompanyWrapper>(model.Participants.Select(e => GetWrapper <CompanyWrapper, Company>(e))); RegisterCollection(Participants, model.Participants); if (model.TenderUnits == null) { throw new ArgumentException("TenderUnits cannot be null"); } TenderUnits = new ValidatableChangeTrackingCollection <TenderUnitWrapper>(model.TenderUnits.Select(e => GetWrapper <TenderUnitWrapper, TenderUnit>(e))); RegisterCollection(TenderUnits, model.TenderUnits); if (model.Offers == null) { throw new ArgumentException("Offers cannot be null"); } Offers = new ValidatableChangeTrackingCollection <OfferWrapper>(model.Offers.Select(e => GetWrapper <OfferWrapper, Offer>(e))); RegisterCollection(Offers, model.Offers); }
protected override void InitializeCollectionComplexProperties(Product model) { if (model.ChildProducts == null) { throw new ArgumentException("ChildProducts cannot be null"); } ChildProducts = new ValidatableChangeTrackingCollection <ProductWrapper>(model.ChildProducts.Select(e => GetWrapper <ProductWrapper, Product>(e))); RegisterCollection(ChildProducts, model.ChildProducts); if (model.Parameters == null) { throw new ArgumentException("Parameters cannot be null"); } Parameters = new ValidatableChangeTrackingCollection <ParameterWrapper>(model.Parameters.Select(e => GetWrapper <ParameterWrapper, Parameter>(e))); RegisterCollection(Parameters, model.Parameters); if (model.Prices == null) { throw new ArgumentException("Prices cannot be null"); } Prices = new ValidatableChangeTrackingCollection <SumOnDateWrapper>(model.Prices.Select(e => GetWrapper <SumOnDateWrapper, SumOnDate>(e))); RegisterCollection(Prices, model.Prices); }