Beispiel #1
0
        private void Revision_Load(object sender, EventArgs e)
        {
            var db = new BtomicDB();

            var revisions = (from p in db.Model_BTProcessRevision
                             join u in db.BTUser on p.UserId equals u.UserId
                             orderby p.ProcessRevisionId descending
                             where p.ProcessModelId == _processId
                             select new RevisionListItem
                             {
                                 ResvisionID = p.ProcessRevisionId,
                                 Revision = p.ProcessRevision,
                                 CreatorName = u.NFullname,
                                 Changed = p.Changed
                             });

            var selected = false;
            foreach (var revision in revisions)
            {
                lbRevisions.Items.Add(revision);
                if (selected) continue;
                selected = true;
                lbRevisions.SelectedItem = revision;

            }

        }
Beispiel #2
0
        public void StartReverseEngineerWizard()
        {
            var connectionDialog = new Connection();
            connectionDialog.ShowDialog();

            if (connectionDialog.DialogResult != DialogResult.OK) return;

            //Check the version of the database
            var db = new BtomicDB();
            try
            {
                //if this table exists, it must be version 2, otherwise it must be version 1
                db.Model_BTProcessModel.Any();

                connectionDialog.DBVersion = "2";

            }
            catch (Exception)
            {
                connectionDialog.DBVersion = "1";
            }

            var processDialog = new Processes(connectionDialog.DBVersion);
            processDialog.ShowDialog();

            if (processDialog.DialogResult != DialogResult.OK) return;


            int? revisionID = null;

            if (connectionDialog.DBVersion != "1")
            {
                var revisionDialog = new Revision(processDialog.ProcessId);
                revisionDialog.ShowDialog();
                revisionID = revisionDialog.RevisionID;

                if (revisionDialog.DialogResult != DialogResult.OK) return;
            }

            var selectedItem = _applicationObject.SelectedItems.Item(1);
            var project = selectedItem.Project;

            var projectItem = selectedItem.ProjectItem;

            var diagramGenerator = new Diagram.DiagramGenerator(processDialog.ProcessId, revisionID, _applicationObject);

            if (project != null)
            {
                CreateInProject(project, Extension, diagramGenerator);
            }
            else if (projectItem != null)
            {
                CreateInFolder(projectItem, Extension, diagramGenerator);
            }
        }
Beispiel #3
0
        public DiagramGenerator(int processID, int? revisionID, DTE2 applicationObject)
        {
            _processID = processID;
            _revisionID = revisionID;
            _applicationObject = applicationObject;
            _db = new BtomicDB();

            GetProcess();
            PopulateActivities();
            PopulateFlowMaps();
            CreateContent();
        }
Beispiel #4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            BtomicDB db = new BtomicDB();

            dslHelper.ActTypes.Clear();
            dslHelper.ActTypes.Add(new ActivityType { Id = 0, Type = "page" });
            dslHelper.ActTypes.Add(new ActivityType { Id = 1, Type = "unkown" });
            dslHelper.ActTypes.Add(new ActivityType { Id = 2, Type = "storedProcedure" });
            dslHelper.ActTypes.Add(new ActivityType { Id = 3, Type = "outPort" });
            dslHelper.ActTypes.Add(new ActivityType { Id = 4, Type = "inPort" });
            dslHelper.ActTypes.Add(new ActivityType { Id = 5, Type = "stop" });

            foreach (object item in checkProcesses.CheckedItems)
            {
                int processid = ((dynamic) item).ProcessID;

                Process process = (from p in db.BTProcess
                                   where p.ProcessID == processid
                                   select new Process
                                              {
                                                  ProcessID = p.ProcessID,
                                                  ProcessName = p.ProcessName,
                                                  ManagerID = p.ManagerID,
                                                  EntityID = p.EntityID,
                                                  LastUpdate = p.LastUpdate,
                                                  Outdated = p.Outdated,
                                                  Guid = db.NewGuid()
                                              }).SingleOrDefault();

                List<Task> allTask = (from t in db.BTTask
                                      where t.ProcessID == processid
                                      select new Task
                                                 {
                                                     DocWait = t.DocWait,
                                                     Guid = db.NewGuid(),
                                                     LastUpdate = t.LastUpdate,
                                                     Outdated = t.Outdated,
                                                     Priority = t.Priority,
                                                     ProcessID = t.ProcessID,
                                                     SystemModuleID = t.SystemModuleID,
                                                     TaskID = t.TaskID,
                                                     TaskName = t.TaskName
                                                 }).ToList();

                List<Activity> allActivity = (from a in db.BTActivity
                                              join t in db.BTTask
                                                  on a.TaskID equals t.TaskID
                                              where t.ProcessID == processid
                                              select new Activity
                                                         {
                                                             ActivityID = a.ActivityID,
                                                             ActivityInd = a.ActivityInd,
                                                             ActivityName = a.ActivityName,
                                                             ActivityType = a.ActivityType,
                                                             Guid = db.NewGuid(),
                                                             IsMenuItem = a.IsMenuItem,
                                                             LastUpdate = a.LastUpdate,
                                                             Outdated = a.Outdated,
                                                             Startable = a.Startable,
                                                             TaskID = a.TaskID
                                                         }).ToList();

                List<FlowMap> allFlow = (from f in db.BTFlowMap
                                         join a in db.BTActivity
                                             on f.FromActivity equals a.ActivityID
                                         join t in db.BTTask
                                             on a.TaskID equals t.TaskID
                                         where t.ProcessID == processid
                                         select new FlowMap
                                                    {
                                                        FlowID = f.FlowID,
                                                        FromActivity = f.FromActivity,
                                                        LastUpdate = f.LastUpdate,
                                                        OutcomeID = f.OutcomeID,
                                                        Outdated = f.Outdated,
                                                        Storyline = f.Storyline,
                                                        ToActivity = f.ToActivity,
                                                        FromTaskID = f.BTActivity.TaskID,
                                                        ToTaskID = f.ToActivityBTActivity.TaskID,
                                                        Outcome = f.BTOutcome.Outcome
                                                    }).ToList();

                dslHelper.AddPorts(ref process, ref allTask, ref allActivity, ref allFlow);
                string str = dslHelper.GenerateDiagram(ref process, ref allTask, ref allActivity, ref allFlow);

                dslHelper.BtomicDiagrams.Add(new BtomicDiagram() {name = process.ProcessName, content = str});
            }
            
            DialogResult = DialogResult.OK;
        }