Beispiel #1
0
        /// <summary>
        /// Load document to display.
        /// </summary>
        /// <param name="document"></param>
        public void LoadDocument(WorkflowDocument document)
        {
            if (Object.ReferenceEquals(m_workflowDocument, document))
            {
                return;
            }

            m_workflowDocument = document;

            //== Clear all control on workflow.
            ClearAllControl();

            // Binding Button Event
            for (int i = 0; i < document.ButtonList.Count; i++)
            {
                document.ButtonList[i].Click += new EventHandler(buttonClick);
            }

            //###############
            //  Generate control
            //###############
            Engine.StartGenerateWorkflow(m_workflowDocument.ButtonList, m_workflowDocument.LineHeaderList);

            //###############
            // Update bound of control.
            //###############
            this.UpdateBounds();
        }
Beispiel #2
0
        /// <summary>
        /// Reset all variables and clear all data which showing on screen.
        /// </summary>
        private void ResetAndClearAll()
        {
            // Clear data.
            m_workflowDocument = null;


            // Clear TableLayout
            ClearAllControl();
        }
Beispiel #3
0
        /// <summary>
        /// Load workflow document.
        /// </summary>
        /// <param name="document"></param>
        public void LoadDocument(WorkflowDocument document)
        {
            if (document == null)
            {
                WorkFlow.CloseDocument();
                return;
            }

            // Formatting Workflow Document to View.
            WorkFlow.SuspendLayout();
            WorkFlow.LoadDocument(document);
            WorkFlow.ResumeLayout(true);

            //== Calculate position.
            Point location = CalculateWorkFlowPositionCenter();

            WorkFlow.Location = location;

            PanelContainer.ScrollControlIntoView(WorkFlow);
        }
Beispiel #4
0
        public static WorkflowDocument LoadDatabase(Database db, string workflowID, string USER_ACCOUNT)
        {
            WorkflowButtonList     buttonList     = new WorkflowButtonList();
            WorkflowLineHeaderList lineHeaderList = new WorkflowLineHeaderList();

            ButtonDAO     daoButton     = new ButtonDAO();
            LineHeaderDAO daoLineHeader = new LineHeaderDAO();
            LineDetailDAO daoLineDetail = new LineDetailDAO();
            ConnectorDAO  daoConnector  = new ConnectorDAO();

            #region "  Load Buttons  "

            //== Generate all Button (not binding event click)
            //  Event ButtonClick will bind when assign document to viewer.
            List <ButtonDTO> listButtons = daoButton.FindButton(db, workflowID, USER_ACCOUNT, SystemMaintenance.DataDefine.AUTO_ARRANGE_ICON, SystemMaintenance.DataDefine.ICON_PER_ROW);
            for (int i = 0; i < listButtons.Count; i++)
            {
                ButtonDTO      dto    = listButtons[i];
                WorkflowButton button = new WorkflowButton(dto);
                button.Dock   = DockStyle.Fill;
                button.Anchor = AnchorStyles.None;
                button.Name   = String.Format("{0}.{1}.{2}", dto.WF_ID, dto.ROW_INDEX, dto.COL_INDEX);
                //button.Click += new EventHandler(buttonClick);
                button.Location = new Point(0, 0);

                if (dto.FLG_VIEW == 1)
                {
                    button.Visible = true;
                }
                else
                {
                    button.Visible = false;
                }

                // add to collection
                buttonList.Add(button);
            }

            #endregion


            //ถ้าเปิดให้ auto arrange icon จะไม่มี work flow line
            if (SystemMaintenance.DataDefine.AUTO_ARRANGE_ICON != true)
            {
                #region "  Load Lines  "

                List <LineHeaderDTO> listLineHeader = daoLineHeader.GetLineHeaders(db, workflowID);
                for (int i = 0; i < listLineHeader.Count; i++)
                {
                    LineHeaderDTO        lineHeaderDTO  = listLineHeader[i];
                    List <LineDetailDTO> listLineDetail = daoLineDetail.GetLineDetails(db, workflowID, lineHeaderDTO.ID);
                    List <ConnectorDTO>  listConnector  = daoConnector.GetConnectors(db, workflowID, lineHeaderDTO.ID);

                    // Create Model Header
                    WorkflowLineHeader wf_header = new WorkflowLineHeader(null, lineHeaderDTO.ID, lineHeaderDTO.ZINDEX);

                    // Loop for Create inner Model LineDetail.
                    for (int iLine = 0; iLine < listLineDetail.Count; iLine++)
                    {
                        LineDetailDTO      lineDetailDTO = listLineDetail[iLine];
                        WorkflowLineDetail wf_detail     = new WorkflowLineDetail(wf_header
                                                                                  ,
                                                                                  new Cell(null, lineDetailDTO.FROM_ROW,
                                                                                           lineDetailDTO.FROM_COL)
                                                                                  ,
                                                                                  new Cell(null, lineDetailDTO.TO_ROW,
                                                                                           lineDetailDTO.TO_COL)
                                                                                  , (WorkflowLineStatus)lineDetailDTO.STATUS);

                        wf_header.Lines.Add(wf_detail);
                    }

                    // Loop for Create inner Model LineConnector.
                    for (int iConnector = 0; iConnector < listConnector.Count; iConnector++)
                    {
                        ConnectorDTO          connectorDTO = listConnector[iConnector];
                        WorkflowLineConnector wf_connector = new WorkflowLineConnector(wf_header
                                                                                       ,
                                                                                       new Cell(null, connectorDTO.ROW_INDEX,
                                                                                                connectorDTO.COL_INDEX)
                                                                                       ,
                                                                                       (WorkflowConnectorType)
                                                                                       connectorDTO.STATUS);

                        wf_header.Connectors.Add(wf_connector);
                    }
                    lineHeaderList.Add(wf_header);
                }

                #endregion
            }

            WorkflowDocument document = new WorkflowDocument(workflowID, buttonList, lineHeaderList);
            return(document);
        }