Example #1
0
        private ArrayList FindWorkItems(Guid processOid)
        {
            BPMProcessor processor = new BPMProcessor();
            ArrayList    list      = new ArrayList();
            ArrayList    list2     = new ArrayList();

            foreach (DEMarkup markup in this.MarkupList)
            {
                if ((processOid == markup.ProcessOid) && !list2.Contains(markup.WorkItemOid))
                {
                    DELWorkItem theWorkItem = new DELWorkItem();
                    try
                    {
                        processor.GetWorkItemByOid(markup.WorkItemOid, out theWorkItem);
                        list.Add(theWorkItem);
                        list2.Add(markup.WorkItemOid);
                    }
                    catch (Exception exception)
                    {
                        PrintException.Print(exception);
                    }
                }
            }
            return(list);
        }
Example #2
0
 private void FillProcess()
 {
     this.lvwProcess.Items.Clear();
     this.lvwWorkItem.Items.Clear();
     foreach (DEMarkup markup in this.MarkupList)
     {
         bool flag = false;
         DELProcessInsProperty theDELProcessInsProperty = null;
         foreach (DELProcessInsProperty property2 in this.ProcessList)
         {
             if (property2.ID == markup.ProcessOid)
             {
                 theDELProcessInsProperty = property2;
                 flag = true;
                 break;
             }
         }
         if (!flag)
         {
             BPMProcessor processor = new BPMProcessor();
             try
             {
                 processor.GetProcessInsProperty(ClientData.LogonUser.Oid, markup.ProcessOid, out theDELProcessInsProperty);
             }
             catch (Exception exception)
             {
                 PrintException.Print(exception);
                 continue;
             }
             if (theDELProcessInsProperty != null)
             {
                 this.ProcessList.Add(theDELProcessInsProperty);
             }
         }
         if (theDELProcessInsProperty != null)
         {
             this.AddProcessToList(theDELProcessInsProperty);
         }
     }
     if (this.lvwProcess.Items.Count > 0)
     {
         this.lvwProcess.Items[0].Selected = true;
     }
 }
Example #3
0
 public static DELProcessInsProperty GetProcessItem(Guid moid, int revNum)
 {
     ArrayList processInstanceListByObject = new BPMProcessor().GetProcessInstanceListByObject(moid, revNum);
     ArrayList list2 = new ArrayList();
     DateTime minValue = DateTime.MinValue;
     if ((processInstanceListByObject != null) && (processInstanceListByObject.Count > 0))
     {
         foreach (DELProcessInsProperty property in processInstanceListByObject)
         {
             if (((property.State != "Aborted") && (property.State != "Closed")) && (property.State != "Deleted"))
             {
                 if (property.CreationDate > minValue)
                 {
                     property.TerminationDate = property.CreationDate;
                     list2.Insert(0, property);
                 }
                 else
                 {
                     list2.Add(property);
                 }
             }
         }
     }
     if (list2.Count > 0)
     {
         return (DELProcessInsProperty) list2[0];
     }
     return null;
 }
Example #4
0
 internal static void CommitWorkItem(DEBusinessItem item)
 {
     BPMProcessor processor = new BPMProcessor();
     ArrayList processInstanceListByObject = processor.GetProcessInstanceListByObject(item.MasterOid, item.RevNum);
     if ((processInstanceListByObject != null) && (processInstanceListByObject.Count != 0))
     {
         ArrayList list2 = new ArrayList();
         DELProcessInsProperty property = null;
         foreach (DELProcessInsProperty property2 in processInstanceListByObject)
         {
             if (!(property2.State != "Running"))
             {
                 property = property2;
                 break;
             }
         }
         if (property != null)
         {
             DELBPMEntityList theActivityInstanceList = new DELBPMEntityList();
             BPMClient client = new BPMClient();
             processor.GetActivityInstancesList(item.Revision.Creator, property.ID, out theActivityInstanceList, false);
             foreach (DELActivityInstance instance in theActivityInstanceList)
             {
                 DELBPMEntityList theWorkItemList = new DELBPMEntityList();
                 processor.GetWorkItemList(item.Revision.Creator, instance.ID, out theWorkItemList, false);
                 if (instance.DState == "Activated")
                 {
                     foreach (DELWorkItem item2 in theWorkItemList)
                     {
                         if ((item2.State == "Running") || (item2.State == "Accepted"))
                         {
                             client.CompleteWorkItem(item2);
                         }
                         else if (item2.State == "Assigned")
                         {
                             client.CompleteWorkItem(item2);
                             break;
                         }
                     }
                 }
             }
         }
     }
 }
Example #5
0
        private void lvwNavigator_DragDrop(object sender, DragEventArgs e)
        {
            bool        flag       = false;
            bool        flag2      = false;
            IEnumerator enumerator = ((CLCopyData)e.Data.GetData(typeof(CLCopyData))).GetEnumerator();
            Point       p          = new Point(e.X, e.Y);

            p = base.PointToClient(p);
            ListViewItem itemAt = this.lvwNavigater.GetItemAt(p.X, p.Y);

            if (itemAt != null)
            {
                TreeNode tag = (TreeNode)itemAt.Tag;
                while (enumerator.MoveNext())
                {
                    TreeNode current = (TreeNode)enumerator.Current;
                    this.frmMain.setTheDragingNode(current);
                    if (this.frmMain.getTheDragingNode().Parent == tag)
                    {
                        break;
                    }
                    if (this.frmMain.getTheCuttingNode() == current)
                    {
                        flag2 = true;
                    }
                    BPMProcessor          processor2 = new BPMProcessor();
                    TreeNode              parent     = this.frmMain.getTheDragingNode().Parent;
                    DELProcessDefProperty proDef     = this.frmMain.getTheDragingNode().Tag as DELProcessDefProperty;
                    if (tag == TagForTiModeler.TreeNode_BPM)
                    {
                        DELProcessClass class5 = parent.Tag as DELProcessClass;
                        if (processor2.MoveProcessBetweenClass(proDef.ID, class5.ID, Guid.Empty))
                        {
                            class5.RemoveProcess(proDef.ID);
                            parent.Nodes.Remove(this.frmMain.getTheDragingNode());
                            int index = this.frmMain.FindPosition(TagForTiModeler.TreeNode_BPM, proDef);
                            TagForTiModeler.TreeNode_BPM.Nodes.Insert(index, this.frmMain.getTheDragingNode());
                            flag = true;
                        }
                    }
                    else
                    {
                        if ((tag.Parent == TagForTiModeler.TreeNode_BPM) && !(tag.Tag is DELProcessClass))
                        {
                            DELProcessClass class6 = parent.Tag as DELProcessClass;
                            if (processor2.MoveProcessBetweenClass(proDef.ID, class6.ID, Guid.Empty))
                            {
                                class6.RemoveProcess(proDef.ID);
                                parent.Nodes.Remove(this.frmMain.getTheDragingNode());
                                int num5 = this.frmMain.FindPosition(TagForTiModeler.TreeNode_BPM, proDef);
                                TagForTiModeler.TreeNode_BPM.Nodes.Insert(num5, this.frmMain.getTheDragingNode());
                                flag = true;
                            }
                            continue;
                        }
                        if (tag.Tag is DELProcessClass)
                        {
                            DELProcessClass class7 = tag.Tag as DELProcessClass;
                            if (parent == TagForTiModeler.TreeNode_BPM)
                            {
                                if (processor2.MoveProcessBetweenClass(proDef.ID, Guid.Empty, class7.ID))
                                {
                                    parent.Nodes.Remove(this.frmMain.getTheDragingNode());
                                    int num6 = this.frmMain.FindPosition(tag, proDef);
                                    tag.Nodes.Insert(num6, this.frmMain.getTheDragingNode());
                                    class7.AddProcess(proDef.ID);
                                    flag = true;
                                }
                            }
                            else
                            {
                                DELProcessClass class8 = parent.Tag as DELProcessClass;
                                if (processor2.MoveProcessBetweenClass(proDef.ID, class8.ID, class7.ID))
                                {
                                    parent.Nodes.Remove(this.frmMain.getTheDragingNode());
                                    class8.RemoveProcess(proDef.ID);
                                    int num7 = this.frmMain.FindPosition(tag, proDef);
                                    tag.Nodes.Insert(num7, this.frmMain.getTheDragingNode());
                                    class7.AddProcess(proDef.ID);
                                    flag = true;
                                }
                            }
                            continue;
                        }
                        if (tag.Parent.Tag is DELProcessClass)
                        {
                            DELProcessClass class9 = tag.Parent.Tag as DELProcessClass;
                            if (parent == TagForTiModeler.TreeNode_BPM)
                            {
                                if (processor2.MoveProcessBetweenClass(proDef.ID, Guid.Empty, class9.ID))
                                {
                                    parent.Nodes.Remove(this.frmMain.getTheDragingNode());
                                    int num8 = this.frmMain.FindPosition(tag.Parent, proDef);
                                    tag.Parent.Nodes.Insert(num8, this.frmMain.getTheDragingNode());
                                    class9.AddProcess(proDef.ID);
                                    flag = true;
                                }
                                continue;
                            }
                            DELProcessClass class10 = parent.Tag as DELProcessClass;
                            if (processor2.MoveProcessBetweenClass(proDef.ID, class10.ID, class9.ID))
                            {
                                parent.Nodes.Remove(this.frmMain.getTheDragingNode());
                                class10.RemoveProcess(proDef.ID);
                                int num9 = this.frmMain.FindPosition(tag.Parent, proDef);
                                tag.Parent.Nodes.Insert(num9, this.frmMain.getTheDragingNode());
                                class9.AddProcess(proDef.ID);
                                flag = true;
                            }
                        }
                    }
                }
            }
            else if ((this.frmMain.frmBPNavigator != null) && !this.frmMain.frmBPNavigator.IsDisposed)
            {
                while (enumerator.MoveNext())
                {
                    TreeNode aNode = (TreeNode)enumerator.Current;
                    this.frmMain.setTheDragingNode(aNode);
                    if (this.frmMain.getTheDragingNode().Parent == this.frmMain.getopenedDELProcessClass())
                    {
                        break;
                    }
                    if (this.frmMain.getTheCuttingNode() == aNode)
                    {
                        flag2 = true;
                    }
                    BPMProcessor          processor = new BPMProcessor();
                    TreeNode              node2     = this.frmMain.getTheDragingNode().Parent;
                    DELProcessDefProperty property  = this.frmMain.getTheDragingNode().Tag as DELProcessDefProperty;
                    if (this.frmMain.getopenedDELProcessClass() == TagForTiModeler.TreeNode_BPM)
                    {
                        DELProcessClass class2 = node2.Tag as DELProcessClass;
                        if (processor.MoveProcessBetweenClass(property.ID, class2.ID, Guid.Empty))
                        {
                            class2.RemoveProcess(property.ID);
                            node2.Nodes.Remove(this.frmMain.getTheDragingNode());
                            int num = this.frmMain.FindPosition(TagForTiModeler.TreeNode_BPM, property);
                            TagForTiModeler.TreeNode_BPM.Nodes.Insert(num, this.frmMain.getTheDragingNode());
                            flag = true;
                        }
                    }
                    else if (this.frmMain.getopenedDELProcessClass().Tag is DELProcessClass)
                    {
                        DELProcessClass class3 = this.frmMain.getopenedDELProcessClass().Tag as DELProcessClass;
                        if (node2 == TagForTiModeler.TreeNode_BPM)
                        {
                            if (processor.MoveProcessBetweenClass(property.ID, Guid.Empty, class3.ID))
                            {
                                node2.Nodes.Remove(this.frmMain.getTheDragingNode());
                                int num2 = this.frmMain.FindPosition(this.frmMain.getopenedDELProcessClass(), property);
                                this.frmMain.getopenedDELProcessClass().Nodes.Insert(num2, this.frmMain.getTheDragingNode());
                                class3.AddProcess(property.ID);
                                flag = true;
                            }
                            continue;
                        }
                        DELProcessClass class4 = node2.Tag as DELProcessClass;
                        if (processor.MoveProcessBetweenClass(property.ID, class4.ID, class3.ID))
                        {
                            node2.Nodes.Remove(this.frmMain.getTheDragingNode());
                            class4.RemoveProcess(property.ID);
                            int num3 = this.frmMain.FindPosition(this.frmMain.getopenedDELProcessClass(), property);
                            this.frmMain.getopenedDELProcessClass().Nodes.Insert(num3, this.frmMain.getTheDragingNode());
                            class3.AddProcess(property.ID);
                            flag = true;
                        }
                    }
                }
            }
            if (flag2)
            {
                this.frmMain.setTheCuttingNode(null);
            }
            this.frmMain.tvwNavigator.SelectedNode = this.frmMain.getTheDragingNode();
            if (flag)
            {
                this.frmMain.frmBPNavigator.UpdateListView(this.frmMain.getTheDragingNode().Parent);
            }
        }
Example #6
0
        private void lvwNavigater_AfterLabelEdit(object sender, LabelEditEventArgs e)
        {
            TreeNode tag = (TreeNode)this.lvwNavigater.Items[e.Item].Tag;
            string   str = tag.Text.Trim();

            if (e.Label != null)
            {
                str = e.Label.Trim();
            }
            if ((str.Length == 0) || (str.Length > 0x20))
            {
                MessageBox.Show("过程分类名称长度必须为1到32之间。", ConstCommon.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                e.CancelEdit = true;
            }
            foreach (TreeNode node2 in this.frmMain.TheProClsNodeList.Values)
            {
                DELProcessClass class2 = node2.Tag as DELProcessClass;
                if ((str.ToUpper() == class2.Name.ToUpper()) && (tag != node2))
                {
                    MessageBox.Show("已存在重名的过程分类。", ConstCommon.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    e.CancelEdit = true;
                }
            }
            if (!e.CancelEdit)
            {
                tag.Text = str;
            }
            else
            {
                this.lvwNavigater.LabelEdit = true;
                this.lvwNavigater.SelectedItems[0].BeginEdit();
                return;
            }
            DELProcessClass processClass = tag.Tag as DELProcessClass;

            processClass.Name = str;
            BPMProcessor processor = new BPMProcessor();

            try
            {
                if (!processor.ModifyOneProcessClass(processClass))
                {
                    MessageBox.Show("过程分类重命名失败!");
                    processClass.Name = tag.Text;
                    e.CancelEdit      = true;
                    return;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("过程分类重命名失败!");
                processClass.Name = tag.Text;
                e.CancelEdit      = true;
                return;
            }
            int index = this.frmMain.FindPosition(processClass);

            if (tag.Index != index)
            {
                TagForTiModeler.TreeNode_BPM.Nodes.Remove(tag);
                TagForTiModeler.TreeNode_BPM.Nodes.Insert(index, tag);
            }
            e.CancelEdit = true;
            this.lvwNavigater.LabelEdit = false;
            Cursor.Current = Cursors.Default;
            this.frmMain.ShowProcessPropertyList();
            if ((this.frmMain.frmBPNavigator != null) && !this.frmMain.frmBPNavigator.IsDisposed)
            {
                this.frmMain.frmBPNavigator.UpdateListView();
            }
        }
Example #7
0
        private void InitTreeView()
        {
            DELBPMEntityList list2;

            this.tvwProcess.Nodes.Clear();
            int      iconIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEFROOT");
            TreeNode node      = new TreeNode("流程模板", iconIndex, iconIndex)
            {
                Tag = "BusinessPro"
            };

            this.tvwProcess.Nodes.Add(node);
            node.Expand();
            DELBPMEntityList allProcessClasses = new BPMProcessor().GetAllProcessClasses();

            new BPMAdmin().GetProcessDefPropertyList(ClientData.LogonUser.Oid, out list2);
            Hashtable hashtable = new Hashtable();

            foreach (DELProcessDefProperty property in list2)
            {
                hashtable.Add(property.ID, property);
            }
            Hashtable hashtable2 = new Hashtable();

            foreach (DELProcessClass class2 in allProcessClasses)
            {
                TreeNode node2 = new TreeNode(class2.Name)
                {
                    ImageIndex         = ClientData.MyImageList.GetIconIndex("ICO_FDL_CLOSE"),
                    SelectedImageIndex = ClientData.MyImageList.GetIconIndex("ICO_FDL_CLOSE"),
                    Tag = class2
                };
                node.Nodes.Add(node2);
                foreach (Guid guid in class2.ProcessIDList)
                {
                    DELProcessDefProperty property2 = hashtable[guid] as DELProcessDefProperty;
                    if (property2 != null)
                    {
                        TreeNode node3 = new TreeNode(property2.Name)
                        {
                            ImageIndex         = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF"),
                            SelectedImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF"),
                            Tag = property2
                        };
                        hashtable2.Add(property2.ID, property2);
                        node2.Nodes.Add(node3);
                    }
                }
            }
            for (int i = 0; i < list2.Count; i++)
            {
                DELProcessDefProperty property3 = (DELProcessDefProperty)list2[i];
                if (((property3.Reserve2 != "FORPPM") && (property3.IsVisible == 1)) && (!property3.State.Equals("Deleted") && !hashtable2.ContainsKey(property3.ID)))
                {
                    TreeNode node4 = new TreeNode(property3.Name)
                    {
                        ImageIndex         = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF"),
                        SelectedImageIndex = ClientData.MyImageList.GetIconIndex("ICO_BPM_DEF"),
                        Tag = property3
                    };
                    hashtable2.Add(property3.ID, property3);
                    node.Nodes.Add(node4);
                }
            }
        }