Beispiel #1
0
 public void CoreOnPostBuild(ObjectOnPostBuild method)
 {
     if (!this.ExistName && this.ExistLanguage && this.ExistCountry)
     {
         this.Name = this.Language.IsoCode + "-" + this.Country.IsoCode;
     }
 }
Beispiel #2
0
 public static void BaseOnPostBuild(this Domain.Object @this, ObjectOnPostBuild method)
 {
     // TODO: Optimize
     foreach (var concreteRoleType in ((Class)@this.Strategy.Class).ConcreteRoleTypes)
     {
         if (concreteRoleType.IsRequired)
         {
             var roleType = concreteRoleType.RoleType;
             var unit = roleType.ObjectType as IUnit;
             if (unit != null && [email protected](roleType))
             {
                 switch (unit.UnitTag)
                 {
                     case UnitTags.AllorsBoolean:
                         @this.Strategy.SetUnitRole(roleType, false);
                         break;
                     case UnitTags.AllorsDecimal:
                         @this.Strategy.SetUnitRole(roleType, 0m);
                         break;
                     case UnitTags.AllorsFloat:
                         @this.Strategy.SetUnitRole(roleType, 0d);
                         break;
                     case UnitTags.AllorsInteger:
                         @this.Strategy.SetUnitRole(roleType, 0);
                         break;
                     case UnitTags.AllorsUnique:
                         @this.Strategy.SetUnitRole(roleType, Guid.NewGuid());
                         break;
                 }
             }
         }
     }
 }
Beispiel #3
0
 public void CustomOnPostBuild(ObjectOnPostBuild method)
 {
     if (!this.ExistFrom)
     {
         this.From = this.strategy.Session.Now();
     }
 }
Beispiel #4
0
        public static void CoreOnPostBuild(this User @this, ObjectOnPostBuild method)
        {
            if ([email protected])
            {
                @this.NotificationList = new NotificationListBuilder(@this.Strategy.Session).Build();
            }

            if ([email protected])
            {
                var ownerRole = new Roles(@this.Strategy.Session).Owner;
                @this.DerivedRoles.OwnerAccessControl = new AccessControlBuilder(@this.Strategy.Session)
                                                        .WithRole(ownerRole)
                                                        .WithSubject(@this)
                                                        .Build();
            }

            if ([email protected])
            {
                @this.DerivedRoles.OwnerSecurityToken = new SecurityTokenBuilder(@this.Strategy.Session)
                                                        .WithAccessControl(@this.OwnerAccessControl)
                                                        .Build();
            }

            if ([email protected])
            {
                @this.UserSecurityStamp = Guid.NewGuid().ToString();
            }
        }
Beispiel #5
0
 public void CustomOnPostBuild(ObjectOnPostBuild method)
 {
     if (!this.ExistString)
     {
         this.String = "Exist";
     }
 }
Beispiel #6
0
 public static void BaseOnPostBuild(this User @this, ObjectOnPostBuild method)
 {
     if ([email protected])
     {
         @this.NormalizedUserName = @this.UserName?.ToUpperInvariant();
     }
 }
        public void AppsOnPostBuild(ObjectOnPostBuild method)
        {
            if (!this.ExistFacility)
            {
                this.Facility = this.Part.DefaultFacility;
            }

            if (!this.ExistPart)
            {
                this.Part = this.SerialisedItem?.PartWhereSerialisedItem;
            }

            if (!this.ExistUnitOfMeasure)
            {
                this.UnitOfMeasure = this.Part?.UnitOfMeasure;
            }

            if (this.ExistPart && this.Part.InventoryItemKind.IsSerialized)
            {
                if (!this.ExistSerialisedInventoryItemState)
                {
                    this.SerialisedInventoryItemState = this.Reason.DefaultSerialisedInventoryItemState;
                }
            }
            else
            {
                if (!this.ExistNonSerialisedInventoryItemState)
                {
                    this.NonSerialisedInventoryItemState = this.Reason.DefaultNonSerialisedInventoryItemState;
                }
            }
        }
        public static void BaseOnPostBuild(this InternalOrganisation @this, ObjectOnPostBuild method)
        {
            var singleton = @this.Session().GetSingleton();

            if (@this.IsInternalOrganisation)
            {
                if ([email protected])
                {
                    @this.ProductQuoteTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.ProductQuoteModel.Model>("ProductQuote.odt",
                                                                                             singleton.GetResourceBytes("Templates.ProductQuote.odt"));
                }

                if ([email protected])
                {
                    @this.SalesOrderTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.SalesOrderModel.Model>("SalesOrder.odt",
                                                                                           singleton.GetResourceBytes("Templates.SalesOrder.odt"));
                }

                if ([email protected])
                {
                    @this.PurchaseOrderTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.PurchaseOrderModel.Model>("PurchaseOrder.odt",
                                                                                              singleton.GetResourceBytes("Templates.PurchaseOrder.odt"));
                }

                if ([email protected])
                {
                    @this.PurchaseInvoiceTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.PurchaseInvoiceModel.Model>("PurchaseInvoice.odt",
                                                                                                singleton.GetResourceBytes("Templates.PurchaseInvoice.odt"));
                }

                if ([email protected])
                {
                    @this.SalesInvoiceTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.SalesInvoiceModel.Model>("SalesInvoice.odt",
                                                                                             singleton.GetResourceBytes("Templates.SalesInvoice.odt"));
                }

                if ([email protected])
                {
                    @this.WorkTaskTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.WorkTaskModel.Model>("WorkTask.odt",
                                                                                         singleton.GetResourceBytes("Templates.WorkTask.odt"));
                }

                if ([email protected])
                {
                    @this.WorkTaskWorkerTemplate =
                        singleton.CreateOpenDocumentTemplate <Print.WorkTaskModel.Model>("WorkTaskWorker.odt",
                                                                                         singleton.GetResourceBytes("Templates.WorkTaskWorker.odt"));
                }
            }
        }
Beispiel #9
0
        public void BaseOnPostBuild(ObjectOnPostBuild method)
        {
            // TODO: Don't extent for InternalOrganisations
            var internalOrganisations = new Organisations(this.Strategy.Session).Extent().Where(v => Equals(v.IsInternalOrganisation, true)).ToArray();

            if (!this.ExistInternalOrganisation && internalOrganisations.Length == 1)
            {
                this.InternalOrganisation = internalOrganisations.First();
            }
        }