Beispiel #1
0
        public ApplicationServer()
        {
            Check("IsCentralLibrary")
            .AsExpensive <bool>(Check_IsCentralLibrary);

            Check("UID_ParentApplicationServer")
            .AsExpensive <string>(Check_UidParentApplicationServer);

            CanEdit("UID_ParentApplicationServer", "UID_ApplicationServerRedirect")
            .From("IsCentralLibrary")
            .As((bool isCentralLibrary) => !isCentralLibrary)
            .ClearValueOnFalse();

            CanEdit("UseAlwaysLimit", "OnLineLimit")
            .From("UID_ApplicationServerRedirect")
            .As((string s) => string.IsNullOrEmpty(s))
            .ClearValueOnFalse();

            CanEdit("UseShadowFolder")
            .From("UID_ApplicationServerRedirect", "OnLineLimit")
            .As((string s, int limit) => string.IsNullOrEmpty(s) && limit == 0)
            .ClearValueOnFalse();

            PreventLoops("UID_ParentApplicationServer");

            Value("UseShadowFolder")
            .From("OnLineLimit")
            .As((int onLineLimit) => TryResult.FromResult(onLineLimit > 0, true));
        }
Beispiel #2
0
        private TryResult <string> _ValueSectionName(bool isApp, bool isLoaded, string appPrefix, string drvPrefix,
                                                     string identSectionName)
        {
            if (isLoaded)
            {
                return(TryResult <string> .Failed);
            }

            string prefix = isApp ? appPrefix : drvPrefix;

            if (!String.IsNullOrEmpty(prefix))
            {
                if (identSectionName.StartsWith(appPrefix))
                {
                    identSectionName = identSectionName.Substring(appPrefix.Length);
                }

                if (identSectionName.StartsWith(drvPrefix))
                {
                    identSectionName = identSectionName.Substring(drvPrefix.Length);
                }

                return(TryResult <string> .FromResult(prefix + identSectionName));
            }

            return(TryResult <string> .Failed);
        }
Beispiel #3
0
        public Hardware()
        {
            Check("UID_SDLDomainRD")
            .AsExpensive <string>(Check_SDLDomainRD);

            Check("UID_MachineType")
            .AsExpensive <string>(Check_MachineType);

            Value("UID_OS")
            .From(@"Config(Hardware\Workdesk\ParentOSInherite)", "IsPc", "IsPC[o]", "FK(UID_Workdesk).UID_OS")
            .As((string cp, bool isPC, bool isPCo, string uidOS)
                => TryResult.FromResult(
                    string.Equals(cp, "Workdesk", StringComparison.OrdinalIgnoreCase) && isPC && !isPCo &&
                    !String.IsNullOrEmpty(uidOS), uidOS));

            foreach (string[] trigger in updateCNameTrigger)
            {
                if (trigger[1] != null)
                {
                    // trigger with CP
                    Value("UpdateCName")
                    .From(trigger[0], trigger[0] + "[o]", "Config(+" + trigger[1] + ")")
                    .As((object oNew, object oOld, string cp) => TryResult.FromResult(oNew != oOld && cp == "1", true));
                }
                else
                {
                    // trigger withou CP
                    Value("UpdateCName")
                    .From(trigger[0], trigger[0] + "[o]")
                    .As((object oNew, object oOld) => TryResult.FromResult(oNew != oOld, true));
                }
            }

            foreach (string trigger in updateUDFTrigger)
            {
                Value("UpdateUDF")
                .From(trigger, trigger + "[o]")
                .As((object oNew, object oOld) => TryResult.FromResult(oNew != oOld, true));
            }

            foreach (string trigger in updateMac2NameTrigger)
            {
                Value("UpdateMac2Name")
                .From(trigger, trigger + "[o]")
                .As((object oNew, object oOld) => TryResult.FromResult(oNew != oOld, true));
            }
        }
Beispiel #4
0
        private TryResult <bool> _ValueAppsNotDriver(string identSectionName, bool isLoaded, string appPrefix, string drvPrefix)
        {
            if (isLoaded)
            {
                return(TryResult <bool> .Failed);
            }

            if (identSectionName.StartsWith(appPrefix, StringComparison.OrdinalIgnoreCase))
            {
                return(TryResult <bool> .FromResult(true));
            }

            if (identSectionName.StartsWith(drvPrefix, StringComparison.OrdinalIgnoreCase))
            {
                return(TryResult <bool> .FromResult(false));
            }

            return(TryResult <bool> .Failed);
        }
Beispiel #5
0
        public Driver()
        {
            RegisterExpensive("_IsAdministrativeAccount")
            .As((session, ct) => Task.FromResult(session.User().IsAdministrativeAccount));

            RegisterExpensive("_Now")
            .As((session, ct) => Task.FromResult(QERHelper.GetServerTime(session, ct)));

            CanEdit("SortOrderForProfile")
            .From("_IsAdministrativeAccount")
            .As((bool b) => b);

            MinLen("UID_SectionName")
            .From("IsProfileApplication")
            .As <bool>(isProfileApplication => isProfileApplication ? 1 : 0);

            Value("DateStatusIndicatorChanged")
            .From("AppStatusIndicator", "AppStatusIndicator[o]", "_Now")
            .As((string n, string o, DateTime now) => TryResult.FromResult(!String.Equals(n, o), now));
        }
        public _ApplicationProfile()
        {
            string[] vUpdateProfile =
            {
                "ChgNumber", "ChgTest", "ClientStepCounter", "MemoryUsage", "OSMode", "ServerDrive",
                "UID_Application"
            };

            foreach (string strColumn in vUpdateProfile)
            {
                Value("UpdateProfileVII")
                .From(strColumn, strColumn + "[o]")
                .As((object iNew, object iOld) => TryResult.FromResult(iNew != iOld, true));
            }

            string[] vUpdatePath = { "Ident_InstType", "Ident_OS", "SubPath", "UID_Application" };

            foreach (string strColumn in vUpdatePath)
            {
                Value("UpdatePathVII")
                .From(strColumn, strColumn + "[o]")
                .As((object iNew, object iOld) => TryResult.FromResult(iNew != iOld, true));
            }

            Value("UID_SDLDomainRDOwner")
            .From("UID_SDLDomainRD", "UID_SDLDomainRDOwner")
            .As((string uidSDLDomainRD, string uidSDLDomainRDOwner) =>
                TryResult.FromResult <string>(!String.IsNullOrEmpty(uidSDLDomainRD) && String.IsNullOrEmpty(uidSDLDomainRDOwner),
                                              uidSDLDomainRD));

            Check("OrderNumber")
            .As((double dOrderNumer) =>
            {
                if (dOrderNumer < 10000)
                {
                    throw new ViException(2116134, ExceptionRelevance.EndUser);
                }
                if (dOrderNumer > 100000000)
                {
                    throw new ViException(2116126, ExceptionRelevance.EndUser, "OrderNumber", "100000000");
                }
                return(true);
            });


            Value("OSMode").Default("AUTO");
            Format("OSMode").As((string osMode) =>
            {
                osMode = osMode.Trim().ToUpperInvariant();

                if (string.IsNullOrEmpty(osMode))
                {
                    osMode = "AUTO";
                }

                return(osMode);
            });

            Format("SubPath").As <string, string>(subPath => subPath.TrimEnd('\\'));

            Check("UID_Application")
            .AsExpensive <string>(_Check_UID_Application);

            RegisterMethod("Assign")
            .As <IValueProvider>(AssignAsync);

            RegisterFunction("GetProfilePathClient")
            .As <bool, string>(_GetProfilePathClient)
            .Description("Method_ApplicationProfile_GetProfilePathClient");

            RegisterMethod("WriteVIIFiles")
            .As(WriteViiFilesAsync)
            .Description("Method_ApplicationProfile_WriteVIIFiles")
            .IsDisplayMethod("strMethodDisplay881003");
        }