예제 #1
0
 void ClientConnectionInfoClicked(object sender, RoutedEventArgs e)
 {
     if (Keyboard.IsKeyDown(Key.LeftCtrl))
     {
         if (!ACRoot.SRoot.Environment.User.IsSuperuser)
         {
             return;
         }
         WCFClientManager channelManager = ACRoot.SRoot.ACUrlCommand("?\\Communications\\WCFClientManager") as WCFClientManager;
         if (channelManager != null)
         {
             channelManager.BroadcastShutdownAllClients();
         }
     }
     else
     {
         if (DockingManager == null)
         {
             return;
         }
         ACComponent channelManager = (ACComponent)ACRoot.SRoot.ACUrlCommand("?\\Communications\\WCFClientManager");
         if (channelManager != null)
         {
             DockingManager.ShowDialog(channelManager, "ConnectionInfo", "", false);
         }
     }
 }
예제 #2
0
        public void StartExampleWorkflow()
        {
            if (!IsEnabledStartExampleWorkflow())
            {
                return;
            }
            ACComponent appRoot = ACUrlCommand("\\AppExample") as ACComponent;

            if (appRoot == null)
            {
                return;
            }
            if (appRoot.ConnectionState == ACObjectConnectionState.DisConnected)
            {
                return;
            }
            string methodName;
            // 1. Find Workflow-Method
            ACClassMethod acClassMethod = appRoot.GetACClassMethod("ExampleWorkflow", out methodName);

            if (acClassMethod == null)
            {
                return;
            }
            // 2. Create a new Instance of the virtual Method (ACMethod)
            ACMethod acMethod = appRoot.NewACMethod(methodName);

            if (acMethod == null)
            {
                return;
            }
            ACValue paramProgram = acMethod.ParameterValueList.GetACValue(ACProgram.ClassName);
            ACValue paramInOrder = acMethod.ParameterValueList.GetACValue(InOrder.ClassName);

            if (paramProgram == null || paramInOrder == null)
            {
                return;
            }

            using (Database iPlusDB = new Database())
            {
                // 3. Switch database context
                acClassMethod = acClassMethod.FromIPlusContext <ACClassMethod>(iPlusDB);
                // 4. Create a new ACProgram-Instance and set the ProgramACClassMethod and WorkflowTypeACClass-Properties.
                string    secondaryKey = Root.NoManager.GetNewNo(iPlusDB, typeof(ACProgram), ACProgram.NoColumnName, ACProgram.FormatNewNo, this);
                ACProgram program      = ACProgram.NewACObject(iPlusDB, null, secondaryKey);
                program.ProgramACClassMethod = acClassMethod;
                program.WorkflowTypeACClass  = acClassMethod.WorkflowTypeACClass;
                // 5. Save the ACProgram-Instance to the dabase first:
                iPlusDB.ACProgram.AddObject(program);
                if (iPlusDB.ACSaveChanges() == null)
                {
                    // 6. If ACProgram was sucessfully added to the database, start the workflow:
                    paramProgram.Value = program.ACProgramID;
                    paramInOrder.Value = CurrentInOrder.InOrderID;
                    appRoot.ExecuteMethod(acClassMethod.ACIdentifier, acMethod);
                }
            }
        }
        /// (D) If you use InOrderManager as a network service object
        public static ACRef <ACComponent> ACRefToServiceInstanceNet(ACComponent requester)
        {
            ACComponent serviceInstance = GetServiceInstanceNet(requester);

            if (serviceInstance != null)
            {
                return(new ACRef <ACComponent>(serviceInstance, requester));
            }
            return(null);
        }
        /// (B) If you use InOrderManager as a local service object
        public static ACRef <InOrderManager> ACRefToServiceInstance(ACComponent requester)
        {
            InOrderManager serviceInstance = GetServiceInstance(requester);

            if (serviceInstance != null)
            {
                return(new ACRef <InOrderManager>(serviceInstance, requester));
            }
            return(null);
        }
        public static MyCompanyDB GetAppContextForBSO(ACComponent bso)
        {
            if (bso.ParentACComponent != null && bso.ParentACComponent.Database != null && bso.ParentACComponent.Database is MyCompanyDB)
            {
                return(bso.ParentACComponent.Database as MyCompanyDB);
            }
            MyCompanyDB dbApp = ACObjectContextManager.GetContext("BSOMyCompContext") as MyCompanyDB;

            if (dbApp == null)
            {
                Database parentIPlusContext = new Database();
                dbApp = ACObjectContextManager.GetOrCreateContext <MyCompanyDB>("BSOMyCompContext", null, parentIPlusContext);
            }
            return(dbApp);
        }
예제 #6
0
 void ServerConnectionInfoClicked(object sender, RoutedEventArgs e)
 {
     if (Keyboard.IsKeyDown(Key.LeftCtrl))
     {
         WCFServiceManager serviceHost = ACRoot.SRoot.ACUrlCommand("?\\Communications\\WCFServiceManager") as WCFServiceManager;
         if (serviceHost != null)
         {
             serviceHost.ShutdownClients();
         }
     }
     else
     {
         if (DockingManager == null)
         {
             return;
         }
         ACComponent serviceHost = (ACComponent)ACRoot.SRoot.ACUrlCommand("?\\Communications\\WCFServiceManager");
         if (serviceHost != null)
         {
             DockingManager.ShowDialog(serviceHost, "ConnectionInfo", "", false);
         }
     }
 }
 /// (C) If you use InOrderManager as a network service object
 public static ACComponent GetServiceInstanceNet(ACComponent requester)
 {
     return(GetServiceInstance <ACComponent>(requester, C_DefaultServiceACIdentifier));
 }
 /// (A) If you use InOrderManager as a local service object
 public static InOrderManager GetServiceInstance(ACComponent requester)
 {
     return(GetServiceInstance <InOrderManager>(requester, C_DefaultServiceACIdentifier, CreationBehaviour.OnlyLocal | CreationBehaviour.FirstOrDefault));
 }