Ejemplo n.º 1
0
        private void GenerateActivities(string connectionString)
        {
            var db = new Data1.CloudCoreDB(connectionString);

            var activities = from am in db.Cloudcoremodel_ActivityModel
                             join sub in db.Cloudcoremodel_SubProcess on am.SubProcessId  equals sub.SubProcessId
                             join pr in db.Cloudcoremodel_ProcessRevision on am.ProcessRevisionId equals pr.ProcessRevisionId
                             where pr.ProcessRevisionId == Id || pr.ProcessModelId == 0
                             select new
                             {
                                 Id = am.ActivityModelId,
                                 Title = am.ActivityName,
                                 SubProcessId = sub.SubProcessId,
                                 SubProcessName = sub.SubProcessName,
                                 Startable = am.Startable,
                                 ActivityTypeId = am.ActivityTypeId,
                                 Decision = (from f in db.Cloudcoremodel_FlowModel
                                             where f.FromActivityModelId == am.ActivityModelId
                                             select am.ActivityModelId).Count() > 1
                             };

            foreach (var activity in activities)
            {
                var subProcess = SubProcesses.Where(r => r.Id == activity.SubProcessId).SingleOrDefault();
                if (subProcess == null)
                {
                    subProcess = new SubProcess()
                    {
                        Id = activity.SubProcessId,
                        Parent = this,
                        Title = activity.SubProcessName

                    };
                    SubProcesses.Add(subProcess);
                }

                IActivity act;

                switch (activity.ActivityTypeId)
                {
                    case 0:
                        act = new CloudCore_User_Activity();
                        break;
                    case 1:
                        act = new Custom_User_Activity();
                        break;
                    case 2:
                        act = new Database_Custom_Activity();
                        break;
                    case 3:
                        act = new Database_Parked_Activity();
                        break;
                    case 4:
                        act = new Flow_Rule();
                        break;
                    case 5:
                        act = new Cloud_Custom_Activity();
                        break;
                    case 6:
                        act = new Database_Costing();
                        break;
                    case 7:
                        act = new Cloud_Costing();
                        break;
                    case 8:
                        act = new Database_Batch_Start();
                        break;
                    case 9:
                        act = new Cloud_Batch_Start();
                        break;
                    case 10:
                        act = new Cloud_Batch_Wait();
                        break;
                    case 11:
                        act = new Cloud_Parked_Activity();
                        break;
                    case 12:
                        act = new SMS_Activity();
                        break;
                    case 13:
                        act = new Email_Activity();
                        break;
                    case 14:
                        act = new Corticon_Business_Rule();
                        break;
                    case 99:
                        act = new StopActivity();
                        break;
                    default:
                        act = new CloudCore_User_Activity();
                        break;
                }

                act.Title = activity.Title;
                act.Id = activity.Id;
                act.Parent = subProcess;

                if (activity.Startable)
                    act.AddProperty(ActivityProperties.Startable);


                subProcess.Activities.Add(act);
            }
        }
Ejemplo n.º 2
0
        private static void DropTask(Visio.IVDocument stencil, Visio.InvisibleApp vapp, SubProcess task)
        {
            try
            {
                Visio.Selection selection = vapp.ActiveWindow.Selection;

                //vapp.ActivePage.PageSheet.CellsSRC[1, 10, 0].FormulaU = "11 in";
                //vapp.ActivePage.PageSheet.CellsSRC[1, 10, 1].FormulaU = "8.5 in";
                //vapp.ActivePage.PageSheet.CellsSRC[1, 25, 16].FormulaForceU = "2";
                
                var taskShape = vapp.ActivePage.Drop(stencil.Masters[task.TemplateShapeName], 0, 0);
                foreach (var activity in task.Activities)
                {
                    var actShape = vapp.ActivePage.Drop(stencil.Masters[activity.TemplateShapeName], 0, 0);
                    if (activity.TemplateShapeName != "Flow Rule")
                    {
                        actShape.Text = activity.Title;
                    }
                    taskShape.ContainerProperties.AddMember(actShape, Visio.VisMemberAddOptions.visMemberAddExpandContainer);

                    if (activity.HasProperty(ActivityProperties.Startable))
                    {
                        var startShape = vapp.ActivePage.Drop(stencil.Masters["Process Start"], 0, 0);
                        taskShape.ContainerProperties.AddMember(startShape, Visio.VisMemberAddOptions.visMemberAddExpandContainer);
                        var vCell1 = startShape.CellsSRC[7, 0, 0];
                        //var vCell2 = (activity.TemplateShapeName == "Flow Rule") ? actShape.CellsSRC[7, 1, 0]  : actShape.CellsSRC[7, 4, 0];
                        var vCell2 = actShape.CellsSRC[7, 4, 0];

                        try
                        {
                            vCell1.GlueTo(vCell2);
                        }
                        catch (Exception ex)
                        {
                            var vCell3 = actShape.CellsSRC[7, 1, 0];
                            vCell1.GlueTo(vCell3);
                        }
                    }

                    //if (activity.HasProperty(ActivityProperties.Batching))
                    //{
                    //    var batchingShape = vapp.ActivePage.Drop(stencil.Masters["Batching"], 0, 0);

                    //    var vCell1 = batchingShape.CellsSRC[7, 0, 0];
                    //    var vCell2 = actShape.CellsSRC[7, 3, 0];

                    //    vCell1.GlueTo(vCell2);
                    //}

                    //if (activity.HasProperty(ActivityProperties.Parked))
                    //{
                    //    var parkedShape = vapp.ActivePage.Drop(stencil.Masters["Parked"], 0, 0);

                    //    var vCell1 = parkedShape.CellsSRC[7, 0, 0];
                    //    var vCell2 = actShape.CellsSRC[7, 5, 0];

                    //    vCell1.GlueTo(vCell2);
                    //}

                    activity.Shape = actShape;
                }

                taskShape.Text = task.Title;
                task.Shape = taskShape;

            } catch (Exception ex)
            {
                throw new ArgumentException("Unable to draw Task: " + ex.Message);
            }

        }
Ejemplo n.º 3
0
        private static void DropTaskUnGrouped(Visio.IVDocument stencil, Visio.InvisibleApp vapp, SubProcess task)
        {
            try
            {
                Visio.Selection selection = vapp.ActiveWindow.Selection;


                //var taskShape = vapp.ActivePage.Drop(stencil.Masters[subProcess.TemplateShapeName], 0, 0);
                foreach (var activity in task.Activities)
                {
                    var actShape = vapp.ActivePage.Drop(stencil.Masters[activity.TemplateShapeName], 0, 0);
                    actShape.Text = activity.Title;
                    //taskShape.ContainerProperties.AddMember(actShape, Visio.VisMemberAddOptions.visMemberAddExpandContainer);

                    if (activity.HasProperty(ActivityProperties.Startable))
                    {
                        var startShape = vapp.ActivePage.Drop(stencil.Masters["Start"], 0, 0);

                        var vCell1 = startShape.CellsSRC[7, 0, 0];
                        var vCell2 = actShape.CellsSRC[7, 1, 0];

                        vCell1.GlueTo(vCell2);
                    }

                    if (activity.HasProperty(ActivityProperties.Batching))
                    {
                        var batchingShape = vapp.ActivePage.Drop(stencil.Masters["Batching"], 0, 0);

                        var vCell1 = batchingShape.CellsSRC[7, 0, 0];
                        var vCell2 = actShape.CellsSRC[7, 3, 0];

                        vCell1.GlueTo(vCell2);
                    }

                    if (activity.HasProperty(ActivityProperties.Parked))
                    {
                        var parkedShape = vapp.ActivePage.Drop(stencil.Masters["Parked"], 0, 0);

                        var vCell1 = parkedShape.CellsSRC[7, 0, 0];
                        var vCell2 = actShape.CellsSRC[7, 5, 0];

                        vCell1.GlueTo(vCell2);
                    }

                    activity.Shape = actShape;
                }

                //taskShape.Text = subProcess.Title;
                //subProcess.Shape = taskShape;

            }
            catch (Exception ex)
            {
                throw new ArgumentException("Unable to draw Task: " + ex.Message);
            }

        }
Ejemplo n.º 4
0
        private static void DropTaskLinked(Visio.IVDocument stencil, Visio.InvisibleApp vapp, SubProcess task)
        {
            try
            {
                Visio.Selection selection = vapp.ActiveWindow.Selection;


                var taskShape = vapp.ActivePage.Drop(stencil.Masters[task.TemplateShapeName], 0, 0);
                var taskPage = taskShape.CreateSubProcess();
                var taskShapeLink = taskPage.Drop(stencil.Masters[task.TemplateShapeName], 0, 0);
                
                taskPage.Name = task.Title;

                var link = taskShapeLink.Hyperlinks.Add();
                link.Name = "Process";
                link.SubAddress = "Overview Page";

                foreach (var activity in task.Activities)
                {
                    var actShape = taskPage.Drop(stencil.Masters[activity.TemplateShapeName], 0, 0);

                    selection.Select(actShape, (short)Visio.VisSelectionTypes.visSelTypeSingle);
                    actShape.Text = activity.Title;
                    
                    taskShapeLink.ContainerProperties.AddMember(actShape, Visio.VisMemberAddOptions.visMemberAddExpandContainer);

                    if (activity.HasProperty(ActivityProperties.Startable))
                    {
                        var startShape = taskPage.Drop(stencil.Masters["Start"], 0, 0);

                        var vCell1 = startShape.CellsSRC[7, 0, 0];
                        var vCell2 = actShape.CellsSRC[7, 1, 0];

                        vCell1.GlueTo(vCell2);
                    }

                    if (activity.HasProperty(ActivityProperties.Batching))
                    {
                        var batchingShape = taskPage.Drop(stencil.Masters["Batching"], 0, 0);

                        var vCell1 = batchingShape.CellsSRC[7, 0, 0];
                        var vCell2 = actShape.CellsSRC[7, 3, 0];

                        vCell1.GlueTo(vCell2);
                    }

                    if (activity.HasProperty(ActivityProperties.Parked))
                    {
                        var parkedShape = taskPage.Drop(stencil.Masters["Parked"], 0, 0);

                        var vCell1 = parkedShape.CellsSRC[7, 0, 0];
                        var vCell2 = actShape.CellsSRC[7, 5, 0];

                        vCell1.GlueTo(vCell2);
                    }

                    activity.Shape = actShape;
                }

                taskShape.Text = task.Title;
                task.Shape = taskShapeLink;
                SetPageLayoutAndRouting(taskPage);
            }
            catch (Exception ex)
            {
                throw new ArgumentException("Unable to draw Task: " + ex.Message);
            }
        }