Exemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="id"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 public WorkflowLineDetail(WorkflowLineHeader parent, Cell from, Cell to, WorkflowLineStatus status)
 {
     this.m_lineHeader = parent;
     FromCell          = from;
     ToCell            = to;
     m_status          = status;
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 public WorkflowLineConnector(WorkflowLineHeader parent, Cell cell, WorkflowConnectorType connectorType)
 {
     m_lineHeader    = parent;
     m_cell          = cell;
     m_connectorType = connectorType;
 }