示例#1
0
        public void MoveWorkItem(WorkGroup fromWorkGroup, WorkGroup toWorkGroup, Organization oe)
        {
            Util.WriteMethodInfoToConsole();
            ProcessInstance PI = null;

            List <AccessRule> Rules   = new List <AccessRule>();
            AccessRule        arRead  = new AccessRule(session, CCD.Domea.Fw.Base.AccessType.Read, RuleType.SpecificOrganization, oe);
            AccessRule        arWrite = new AccessRule(session, CCD.Domea.Fw.Base.AccessType.Write, RuleType.SpecificOrganization, oe);

            //Rules.Add(new AccessRule(session, CCD.Domea.Fw.Base.AccessType.Read, RuleType.SpecificOrganization, oe));
            //Rules.Add(new AccessRule(session, CCD.Domea.Fw.Base.AccessType.Write, RuleType.SpecificOrganization, oe));
            counter      = 0;
            sWatchMovePI = new Stopwatch();
            foreach (WorkItem wi in fromWorkGroup.GetWorkItems())
            {
                try
                {
                    sWatchMovePI.Reset();
                    sWatchMovePI.Start();
                    counter = counter + 1;
                    PI      = wi.GetProcessInstance();
                    HConsole.WriteLine(">> Verschieben des Aktes " + PI.Name + " beginnt...");

                    Rules.Clear();
                    Rules.AddRange(PI.GetAccessRules(CCD.Domea.Fw.Base.AccessType.Read));
                    Rules.Add(arRead);
                    Rules.AddRange(PI.GetAccessRules(CCD.Domea.Fw.Base.AccessType.Write));
                    Rules.Add(arWrite);

                    PI.SetActiveWorkItem(wi);
                    PI.SetLock(ProcessInstanceLockLevel.Whole);
                    wi.WriteHistoryLogEvent(30, "Start BIG Changes 2.0", new HistoryLogEventType(session, 99));
                    PI.SetCustomAttribute("CSVERANTWOE", oe.Id.ToString());
                    PI.AssignAccessRules(Rules.ToArray(), true);
                    PI.Update();

                    wi.SetLock(WorkItemLockLevel.WorkItem);
                    wi.DelegateTo(toWorkGroup);
                    wi.ReleaseLock(WorkItemLockLevel.WorkItem);

                    wi.WriteHistoryLogEvent(30, "BIG Changes 2.0 erfolgreich durchgeführt", new HistoryLogEventType(session, 99));
                    PI.ReleaseLock(ProcessInstanceLockLevel.Whole);
                    sWatchMovePI.Stop();
                    HConsole.WriteLine(">> Verschieben des Aktes " + PI.Name + " abgeschlossen... (Zähler: " + counter + " / Stopwatch: " + sWatchMovePI.Elapsed.ToString("ss\\.ff") + ")");
                }
                catch (Exception ex)
                {
                    HConsole.WriteError(ex);
                }
            }
        }
示例#2
0
        private int getProfileID(string subString)
        {
            int retValue = -1;

            try
            {
                string         stmt        = "select profile_id from PROFILE_REP where upper(PROFILE_NAME) like '%" + subString.ToUpper() + "'";
                SQLTransaction transaction = new SQLTransaction(this.session, APP_CODE, stmt);
                foreach (SQLRow row in transaction.GetResultRows())
                {
                    retValue = Convert.ToInt32(row.GetColumn(0));
                    break;
                }
                return(retValue);
            }
            catch (Exception ex)
            {
                HConsole.WriteError(ex);
                return(retValue);
            }
        }
示例#3
0
 public void assignUserFromOeToOe(Organization fromOE, Organization toOE)
 {
     try
     {
         foreach (User user in fromOE.GetUsers())
         {
             try
             {
                 User u = toOE.GetUsers().First(f => f.Id == user.Id);
                 HConsole.WriteLine(u.Name + " already assigned to Organisation " + toOE.Name);
             }
             catch
             {
                 user.SetOrganization(toOE);
                 user.Update();
             }
         }
     }
     catch (Exception ex)
     {
         HConsole.WriteError(ex);
     }
 }