コード例 #1
0
        public async override Task OnSavedAsync(IEntity entity, LogicReadWriteParameters parameters, CancellationToken cancellationToken)
        {
            // update of path.vii required ???
            bool bUpdatePathVii = !entity.IsLoaded ||
                                  entity.IsDeleted() ||
                                  entity.Columns["UID_Profile"].IsChanged ||
                                  entity.Columns["Ident_InstTypeAlso"].IsChanged ||
                                  entity.Columns["Ident_OSAlso"].IsChanged;

            if (bUpdatePathVii)
            {
                IEntityForeignKey fkProfile = await entity.GetFkAsync(parameters.Session, "UID_Profile", cancellationToken : cancellationToken).ConfigureAwait(false);

                if (!fkProfile.IsEmpty())
                {
                    IEntity eProfile = await fkProfile.GetParentAsync(EntityLoadType.Default, cancellationToken).ConfigureAwait(false);

                    if (!eProfile.GetValue <bool>("UpdatePathVII"))
                    {
                        await eProfile.PutValueAsync("UpdatePathVII", true, cancellationToken).ConfigureAwait(false);

                        await parameters.UnitOfWork.PutAsync(eProfile, cancellationToken).ConfigureAwait(false);
                    }
                }
            }

            await base.OnSavedAsync(entity, parameters, cancellationToken).ConfigureAwait(false);
        }
コード例 #2
0
        private async Task <IEntity> _GetCLServer(ISession session, IEntity entity, bool doWithoutNotFoundError, CancellationToken ct)
        {
            Query qApplicationServer = Query.From("ApplicationServer")
                                       .Where(c => c.Column("IsCentralLibrary") == true)
                                       .SelectAll();

            var trCentralLibrary = await session.Source().TryGetAsync(qApplicationServer, ct).ConfigureAwait(false);

            if (!trCentralLibrary.Success)
            {
                if (!doWithoutNotFoundError)
                {
                    throw new ViException(2116145, ExceptionRelevance.EndUser, entity.GetValue <string>("Ident_Domain"));
                }

                return(null);
            }

            // get the ApplicationServer
            IEntity appServer = trCentralLibrary.Result;

            IEntityForeignKey fkServer = await appServer.GetFkAsync(session, "UID_Server", ct).ConfigureAwait(false);

            if (fkServer.IsEmpty())
            {
                if (!doWithoutNotFoundError)
                {
                    throw new ViException(2116146, ExceptionRelevance.EndUser, "ApplicationServer[\"UID_Server\"]");
                }

                return(null);
            }

            return(await fkServer.GetParentAsync(EntityLoadType.Default, ct).ConfigureAwait(false));
        }
コード例 #3
0
        private async Task <IEntity> _GetTAS(ISession session, IEntity entity, bool doWithoutTasNotFoundError, CancellationToken ct)
        {
            IEntityForeignKey fkServerTas = await entity.GetFkAsync(session, "UID_ServerTAS", ct).ConfigureAwait(false);

            if (fkServerTas.IsEmpty())
            {
                if (doWithoutTasNotFoundError)
                {
                    return(null);
                }

                throw new ViException(2116148, ExceptionRelevance.EndUser, "TAS", entity.GetValue <string>("Ident_Domain"));
            }

            return(await fkServerTas.GetParentAsync(EntityLoadType.Default, ct).ConfigureAwait(false));
        }
コード例 #4
0
        private static async Task <IEntity> _GetRootAppServer(ISession session, IEntity entity, bool doWithoutTasNotFoundError, CancellationToken ct)
        {
            string uidSdlDomain = entity.GetValue <string>("UID_SDLDomain");

            //wenn Domäne nicht belegt ==> 'rausgehen
            if (String.IsNullOrEmpty(uidSdlDomain))
            {
                return(null);
            }

            Query qApplicationServer = Query.From("ApplicationServer")
                                       .Where(c => c.Column("UID_SDLDomain") == uidSdlDomain &&
                                              c.Column("UID_ParentApplicationServer") == "")
                                       .SelectAll();

            var trApplicationServer = await session.Source().TryGetAsync(qApplicationServer, ct).ConfigureAwait(false);

            if (!trApplicationServer.Success)
            {
                if (!doWithoutTasNotFoundError)
                {
                    throw new ViException(2116145, ExceptionRelevance.EndUser, entity.GetValue("Ident_Domain"));
                }

                return(null);
            }

            // get the ApplicationServer
            IEntity appServer = trApplicationServer.Result;

            IEntityForeignKey fkServer = await appServer.GetFkAsync(session, "UID_Server", ct).ConfigureAwait(false);

            if (fkServer.IsEmpty())
            {
                if (!doWithoutTasNotFoundError)
                {
                    throw new ViException(2116146, ExceptionRelevance.EndUser, "ApplicationServer[\"UID_Server\"]");
                }

                return(null);
            }

            return(await fkServer.GetParentAsync(EntityLoadType.Default, ct).ConfigureAwait(false));
        }
コード例 #5
0
        private async Task <string> _GetProfilePathClient(ISession session, IEntity entity, bool forTas, CancellationToken ct)
        {
            string strProfPath = "";

            IEntityForeignKey fkDomainRd = await entity.GetFkAsync(session, "UID_SDLDomainRD", ct).ConfigureAwait(false);

            if (fkDomainRd.IsEmpty())
            {
                throw new ViException(881146, ExceptionRelevance.EndUser, "Ident_DomainRD");
            }

            IEntity eDomain = await fkDomainRd.GetParentAsync(cancellationToken : ct).ConfigureAwait(false);

            strProfPath = (string)await eDomain.CallFunctionAsync("GetNetPath", forTas, ct).ConfigureAwait(false);

            if (!String.IsNullOrEmpty(strProfPath))
            {
                strProfPath += String.Concat(@"\", eDomain.GetValue("ClientPartApps"), @"\", entity.GetValue("SubPath"));
            }

            return(strProfPath);
        }
コード例 #6
0
        private static async Task <bool> _RootAppsIsTAS(ISession session, IEntity entity, string uidServerTas, bool with2116144, CancellationToken ct)
        {
            IEntity dbTasServer;

            if (!String.IsNullOrEmpty(uidServerTas))
            {
                DbObjectKey dbokServerTas = DbObjectKey.GetObjectKey("QBMServer", uidServerTas);
                var         trServerTas   = await session.Source().TryGetAsync(dbokServerTas, ct).ConfigureAwait(false);

                if (!trServerTas.Success)
                {
                    throw new ViException(2116052, ExceptionRelevance.EndUser, uidServerTas);
                }

                dbTasServer = trServerTas.Result;
            }
            else
            {
                IEntityForeignKey fkServerTas = await entity.GetFkAsync(session, "UID_ServerTas", ct).ConfigureAwait(false);

                if (!fkServerTas.IsEmpty())
                {
                    dbTasServer = await fkServerTas.GetParentAsync(EntityLoadType.Default, ct).ConfigureAwait(false);
                }
                else
                {
                    if (with2116144)
                    {
                        throw new ViException(2116144, ExceptionRelevance.EndUser);
                    }

                    return(false);
                }
            }

            IEntity dbRootAppServer = await _GetRootAppServer(session, entity, false, ct).ConfigureAwait(false);

            return(String.Equals(dbRootAppServer.GetValue <string>("Ident_Server"), dbTasServer.GetValue <string>("Ident_Server")));
        }