Ejemplo n.º 1
0
        public override void InvokeHandler(CommandSetState state)
        {
            CleanLists();

            ConnectionStringBuilderPopup form = new ConnectionStringBuilderPopup();
            form.MyConnectionString = "Data Source=localhost; Integrated Security=True; Initial Catalog=CloudCoreDB;";
            form.ShowDialog();

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                CloudCoreDB db = new CloudCoreDB(form.MyConnectionString);
                var store = state.CurrentDocView.CurrentDiagram.Store;
                var showscript = true;

                Architect.CustomCode.Helpers.ArchitectDte.Instance.Store = store;
                var dte = Architect.CustomCode.Helpers.ArchitectDte.Dte;
                var project = dte.ActiveWindow.Project;

                string AssemblyName = project.Properties.Item("AssemblyName").Value.ToString();
                string SystemModuleGuid = project.Properties.Item("AssemblyGuid").Value.ToString();

                Architect.ProcessOverview.Process process = store.ElementDirectory.AllElements.OfType<Architect.ProcessOverview.Process>().First();

                getDiagramSubProcess(store, process, project);
                getDatabaseSubProcesses(db, new Guid(process.VisioId));

                // Do List Comparison
                myActivities.FindAll(a => !(a.activity is FromProcessConnector) && !(a.activity is ToProcessConnector)).ForEach(act => act.DoCreate = !dbActivities.Any(a => a.activity.ActivityGuid == new Guid(act.activity.VisioId)));
                dbActivities.ForEach(act => act.DoDelete = !myActivities.FindAll(a => !(a.activity is FromProcessConnector) && !(a.activity is ToProcessConnector)).Any(a => new Guid(a.activity.VisioId) == act.activity.ActivityGuid));

                if (dbActivities.Any(a => a.DoDelete))
                {
                    showscript = getReplacementIds();
                }

                string script = GenerateScript(AssemblyName, SystemModuleGuid, new Guid(process.VisioId), process.ProcessName, db, migrateItemList, mySubProcesses, myActivities, myFlows);

                CleanLists();

                if (showscript)
                {
                    ViewScriptForm scriptform = new ViewScriptForm(script);
                    scriptform.ShowDialog();
                }
            }
        }
Ejemplo n.º 2
0
        public override void InvokeHandler(CommandSetState state)
        {
            CleanLists();
            var store = state.CurrentDocView.CurrentDiagram.Store;
            var showscript = true;

            ConnectionStringBuilderPopup form = new ConnectionStringBuilderPopup();
            form.MyConnectionString = "Data Source=localhost; Integrated Security=True; Initial Catalog=CloudCoreDB;";
            form.ShowDialog();

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                CloudCoreDB db = new CloudCoreDB(form.MyConnectionString);
                EnvDTE._DTE dte = new ScheduledTasks.VsEnvironment.ScheduledTaskDte(store).Dte;
                var project = dte.ActiveWindow.Project;

                Group group = getDiagramTasks(store, project);
                getDatabaseTasks(db, group.Id);

                string AssemblyName = project.Properties.Item("AssemblyName").Value.ToString();
                string AssemblyGuid = project.Properties.Item("AssemblyGuid").Value.ToString();

                // Do List Comparison
                scheduledtasks.ForEach(task => task.DoCreate = !dbscheduledtasks.Any(a => a.ScheduledTask.ScheduledTaskGuid == task.ScheduledTask.Id));
                dbscheduledtasks.ForEach(task => task.DoDelete = !scheduledtasks.Any(a => a.ScheduledTask.Id == task.ScheduledTask.ScheduledTaskGuid));

                string script = GenerateScript(AssemblyName, AssemblyGuid, group.Id, group.GroupName, scheduledtasks, dbscheduledtasks);

                CleanLists();

                if (showscript)
                {
                    ViewScriptForm scriptform = new ViewScriptForm(script);
                    scriptform.ShowDialog();
                }
            }
        }