Beispiel #1
0
 private void treeBusiness_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     if (e.Node.Tag is SYS_BUSINESSROLE)
     {
         CurrRole = e.Node.Tag as SYS_BUSINESSROLE;
     }
     else if (e.Node.Tag is SYS_BUSINESSMATERIAL)
     {
         CurrMaterial = e.Node.Tag as SYS_BUSINESSMATERIAL;
     }
     else if (e.Node.Tag is SYS_BUSINESSFORM)
     {
         CurrForm = e.Node.Tag as SYS_BUSINESSFORM;
     }
     else if (e.Node.Tag is SYS_BUSINESSPROCESS)
     {
         CurrProcess = e.Node.Tag as SYS_BUSINESSPROCESS;
     }
     else if (e.Node.Tag is SYS_BUSINESS)
     {
         CurrBusiness = e.Node.Tag as SYS_BUSINESS;
     }
     else if (e.Node.Tag is SYS_BUSINESSGROUP)
     {
         CurrBusinessGroup = e.Node.Tag as SYS_BUSINESSGROUP;
     }
     else
     { // 角色,材料,表单,流程文件夹
         if (e.Node.Parent.Tag is SYS_BUSINESS)
         {
             CurrBusiness      = e.Node.Parent.Tag as SYS_BUSINESS;
             CurrBusinessGroup = e.Node.Parent.Parent.Tag as SYS_BUSINESSGROUP;
         }
     }
 }
        public DockBusinessForm(SYS_BUSINESSFORM CurrForm)
        {
            InitializeComponent();

            dc.TabText = "工具箱";
            dc.Show(this.dockPanel1, DockState.DockLeft);
            dc.CloseButton = false;
            this.dockPanel1.DockLeftPortion = 0.1;

            dcbd.TabText = "业务数据";
            // 业务数据
            dcbd.CurrBusinessData = BusinessServcie.BusinessData(BusinessServcie.Business(CurrForm.REF_BUSINESS_ID).REF_BUSINESSDATA_ID);
            dcbd.Show(this.dockPanel1, DockState.DockRight);
            this.dockPanel1.DockRightPortion = 0.15;

            dp.TabText = "控件属性";
            dp.Show(this.dockPanel1);
            dp.DockTo(this.dockPanel1, DockStyle.Right);

            dfd.CurrForm             = CurrForm;
            dfd.DockProperty         = dp;   ///////////////////初使化属性框
            dfd.DockCurrBusinessData = dcbd; ///////////////////初使化业务数据
            dfd.Show(this.dockPanel1);
            DockWindowFactory.Instance.DockWindowCollection.Add(dfd);
            DockWindowFactory.Instance.CurrDockWindow = dfd;
        }
 public SYS_BUSINESSFORM SaveBusinessForm(SYS_BUSINESSFORM form)
 {
     if (0 == form.ID)
     {
         form.ID = ValueOperator.CreatePk("SYS_BUSINESSFORM");
     }
     using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
     {
         orm.Save(form);
         return(form);
     }
 }
Beispiel #4
0
        private void cmsiAddForm_Click(object sender, EventArgs e)
        {
            SYS_BUSINESSFORM newForm = new SYS_BUSINESSFORM();

            newForm.CREATETIME      = DateTime.Now;
            newForm.REF_BUSINESS_ID = CurrBusiness.ID;
            DlgEditBusinessForm dlg = new DlgEditBusinessForm();

            dlg.Form = newForm;
            if (DialogResult.OK == dlg.ShowDialog())
            {
                try
                {
                    BusinessServcie.SaveBusinessForm(dlg.Form);
                    RefreshBusinessTree();
                    MainForm.INFO("添加业务表单成功!");
                }
                catch (Exception ex)
                {
                    MainForm.ERROR("添加业务表单失败!" + ex.Message);
                }
            }
        }
        public void CreateProcess()
        {
            XmlNodeList         activityNodes = _layout.SelectNodes("process/activities/activity");
            List <BaseActivity> activities    = new List <BaseActivity>();

            foreach (XmlNode activityNode in activityNodes)
            {
                BaseActivity activity = null;
                string       type     = activityNode.Attributes["type"].Value;
                int          x        = Convert.ToInt32(activityNode.Attributes["x"].Value);
                int          y        = Convert.ToInt32(activityNode.Attributes["y"].Value);
                decimal      time     = 0;
                if (null != activityNode.Attributes["time"])
                {
                    time = Convert.ToDecimal(activityNode.Attributes["time"].Value);
                }
                switch (type)
                {
                case "0":
                    activity = new StartActivity(x, y);
                    break;

                case "1":
                    activity = new EndActivity(x, y);
                    break;

                case "2":
                    activity = new ManualActivity(x, y);
                    (activity as ManualActivity).Time = time;
                    //roles
                    XmlNodeList roleNodes = activityNode.SelectNodes("roles/role");
                    if (null != roleNodes && roleNodes.Count > 0)
                    {
                        List <SYS_BUSINESSROLE> roles = new List <SYS_BUSINESSROLE>();
                        foreach (XmlNode node in roleNodes)
                        {
                            SYS_BUSINESSROLE role = new SYS_BUSINESSROLE();
                            role.ID       = Convert.ToInt32(node.Attributes["id"].Value);
                            role.ROLENAME = node.Attributes["name"].Value;
                            role.Selected = Convert.ToInt32(node.Attributes["selected"].Value);
                            roles.Add(role);
                        }
                        (activity as ManualActivity).Roles = roles;
                    }
                    //forms
                    XmlNodeList formNodes = activityNode.SelectNodes("forms/form");
                    if (null != formNodes && formNodes.Count > 0)
                    {
                        List <SYS_BUSINESSFORM> forms = new List <SYS_BUSINESSFORM>();
                        foreach (XmlNode node in formNodes)
                        {
                            SYS_BUSINESSFORM form = new SYS_BUSINESSFORM();
                            form.ID       = Convert.ToInt32(node.Attributes["id"].Value);
                            form.FORMNAME = node.Attributes["name"].Value;
                            form.Checked  = Convert.ToInt32(node.Attributes["checked"].Value);
                            forms.Add(form);
                        }
                        (activity as ManualActivity).Forms = forms;
                    }
                    break;

                default:
                    break;
                }

                if (activity != null)
                {
                    activity.ID          = activityNode.Attributes["id"].Value;
                    activity.Description = activityNode.Attributes["description"].Value;
                    activity.X           = x;
                    activity.Y           = y;
                    document.ActivityList.Add(activity);
                    activities.Add(activity);
                }
            }
            XmlNodeList lineNodes = _layout.SelectNodes("process/lines/line");

            foreach (XmlNode lineNode in lineNodes)
            {
                int          x        = Convert.ToInt32(lineNode.Attributes["x"].Value);
                int          y        = Convert.ToInt32(lineNode.Attributes["y"].Value);
                string       sourceId = lineNode.Attributes["source"].Value;
                string       targetId = lineNode.Attributes["target"].Value;
                BaseActivity source   = null;
                BaseActivity target   = null;
                foreach (BaseActivity act in activities)
                {
                    if (act.ID == sourceId)
                    {
                        source = act;
                        continue;
                    }
                    if (act.ID == targetId)
                    {
                        target = act;
                        continue;
                    }
                }

                LineActivity activity = new LineActivity(source, target);
                if (activity != null)
                {
                    activity.ID          = lineNode.Attributes["id"].Value;
                    activity.Description = lineNode.Attributes["description"].Value;
                    activity.X           = x;
                    activity.Y           = y;
                    document.Lines.Add(activity);
                    document.ActivityList.Add(activity);
                }
            }
        }
        public ActionResult BuildForm(int ProjectFormId)
        {
            SYS_PROJECTFORM  prjForm      = null;
            SYS_BUSINESSFORM businessForm = null;

            using (ORMHandler orm = Zxl.Data.DatabaseManager.ORMHandler)
            {
                prjForm      = orm.Init <SYS_PROJECTFORM>("where ID=" + ProjectFormId);
                businessForm = orm.Init <SYS_BUSINESSFORM>("where ID=" + prjForm.REF_BUSINESSFORM_ID);
            }
            StringBuilder result  = new StringBuilder();
            string        content = System.Text.Encoding.Default.GetString(businessForm.CONTENT);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(content);
            XmlNode controlNode = doc.SelectNodes("Form/Control").Item(0);
            string  formWidth   = controlNode.Attributes["width"].Value;
            string  formHeight  = controlNode.Attributes["height"].Value;

            result.Append("<div id='form-" + ProjectFormId + "' style='position:relative; margin:0 auto;margin-top:20px;margin-bottom:20px; width:" + (Convert.ToInt32(formWidth) + 200) + "px; height:" + (Convert.ToInt32(formHeight) + 250) + "px;background:white;'>");

            #region Controls
            foreach (XmlNode node in controlNode.ChildNodes)
            {
                string NodeType  = node.Name;
                string id        = node.Attributes["id"].Value;
                string name      = node.Attributes["name"].Value;
                string x         = node.Attributes["x"].Value;
                string y         = node.Attributes["y"].Value;
                string width     = node.Attributes["width"].Value;
                string height    = node.Attributes["height"].Value;
                string readonlyT = node.Attributes["readonly"].Value;
                string isprint   = node.Attributes["isprint"].Value;
                string text      = null;
                if (null != node.Attributes["text"])
                {
                    text = node.Attributes["text"].Value;
                }

                string temp = "";
                switch (NodeType)
                {
                case "Label":
                    temp = "<span id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' >" + text + "</span>";
                    break;

                case "TextBox":
                    temp = "<input type='text' id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' />";
                    break;

                case "ComboBox":
                    temp = "<select id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' >" + "</select>";
                    break;

                case "RadioButtonList":
                    temp = "<input type='radio' id='" + id + "' style='position: absolute;left:" + x + "px;top:" + y + "px;width:" + width + "px;height:" + height + "px' />";
                    break;

                default:
                    break;
                }
                result.Append(temp);
            }
            #endregion Controls

            #region Sheet
            XmlNode     sheetReportNode = doc.SelectNodes("Form/SheetReport/Layout").Item(0);
            SheetReport sheetReport     = new SheetReport();
            sheetReport.Orientation              = sheetReportNode.Attributes["Orientation"].Value;
            sheetReport.PaperWidthWithTwipsUnit  = sheetReportNode.Attributes["PaperWidthWithTwipsUnit"].Value;
            sheetReport.PaperHeightWithTwipsUnit = sheetReportNode.Attributes["PaperHeightWithTwipsUnit"].Value;
            sheetReport.BottomMargin             = sheetReportNode.Attributes["BottomMargin"].Value;
            sheetReport.LeftMargin  = sheetReportNode.Attributes["LeftMargin"].Value;
            sheetReport.RightMargin = sheetReportNode.Attributes["RightMargin"].Value;
            sheetReport.TopMargin   = sheetReportNode.Attributes["TopMargin"].Value;

            XmlNodeList sheetPageNodes = sheetReportNode.SelectNodes("SheetPageNode/SheetPage");
            sheetReport.SheetPages = new List <SheetPage>();
            int sheetPageNodeIndex = 0;
            foreach (XmlNode pageNode in sheetPageNodes)
            {
                /*用来画表*/
                //SheetRectangle paperMarginWithTwipsUnit = this.GetPaperMarginWithTwipsUnit();

                int paperActualHeight = Convert.ToInt32(sheetReport.PaperHeightWithTwipsUnit) - 750 * 1440 / 1000 - 750 * 1440 / 1000; //TOP - BOTTOM
                int pointX            = 1000 * 1440 / 1000;                                                                            //Left
                int pointY            = 750 * 1440 / 1000 - sheetPageNodeIndex * paperActualHeight;                                    // TOP
                sheetPageNodeIndex++;
                /**/

                SheetPage sheetPage = new SheetPage();
                sheetReport.SheetPages.Add(sheetPage);

                XmlNode    tableNode  = pageNode.SelectSingleNode("SheetTable");
                SheetTable sheetTable = new SheetTable();
                sheetPage.SheetTable = sheetTable;

                sheetTable.RowPositionCollection = new List <RowPosition>();
                XmlNodeList rowPositionNodes = tableNode.SelectNodes("RowPositionCollection/RowPosition");
                foreach (XmlNode rowPositionNode in rowPositionNodes)
                {
                    RowPosition rowPosition = new RowPosition();
                    rowPosition.position = rowPositionNode.Attributes["position"].Value;
                    sheetTable.RowPositionCollection.Add(rowPosition);
                }

                sheetTable.ColumnPositionCollection = new List <ColumnPosition>();
                XmlNodeList columnPositionNodes = tableNode.SelectNodes("ColumnPositionCollection/ColumnPosition");
                foreach (XmlNode columnPositionNode in columnPositionNodes)
                {
                    ColumnPosition columnPosition = new ColumnPosition();
                    columnPosition.position = columnPositionNode.Attributes["position"].Value;
                    sheetTable.ColumnPositionCollection.Add(columnPosition);
                }

                sheetTable.SheetRows = new List <SheetRow>();
                XmlNodeList sheetRowNodes = tableNode.SelectNodes("SheetRow");
                //int rowIndex = 0; //用来画表


                int rowCount    = sheetTable.RowPositionCollection.Count - 1;
                int columnCount = sheetTable.ColumnPositionCollection.Count - 1;

                for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
                {
                    XmlNode  sheetRowNode = sheetRowNodes[rowIndex];
                    SheetRow sheetRow     = new SheetRow();
                    sheetTable.SheetRows.Add(sheetRow);

                    XmlNodeList sheetColumnNodes = sheetRowNode.SelectNodes("SheetColumn");
                    sheetRow.SheetColumns = new List <SheetColumn>();

                    //int columnIndex = 0; //用来画表
                    for (int columnIndex = 0; columnIndex < columnCount; columnIndex++)
                    {
                        XmlNode sheetColumnNode = sheetColumnNodes[columnIndex];

                        SheetColumn sheetColumn = new SheetColumn();
                        sheetRow.SheetColumns.Add(sheetColumn);

                        XmlNode       sheetItemNodeNode = sheetColumnNode.SelectSingleNode("SheetItemNode");
                        SheetItemNode sheetItemNode     = new SheetItemNode();
                        sheetItemNode.IsCellUnit  = sheetItemNodeNode.Attributes["IsCellUnit"].Value;
                        sheetItemNode.CellPx      = sheetItemNodeNode.Attributes["CellPx"].Value;
                        sheetItemNode.CellPy      = sheetItemNodeNode.Attributes["CellPy"].Value;
                        sheetColumn.SheetItemNode = sheetItemNode;

                        if ("0" == sheetItemNode.IsCellUnit)
                        {
                            continue;
                        }

                        /**/
                        for (int px = 0; px < Convert.ToInt32(sheetItemNode.CellPx); px++)
                        {
                            for (int py = 0; py < Convert.ToInt32(sheetItemNode.CellPy); py++)
                            {
                                if (px > 0 && px < Convert.ToInt32(sheetItemNode.CellPx) - 1 && py > 0 && py < Convert.ToInt32(sheetItemNode.CellPy) - 1)
                                {
                                    continue;
                                }

                                SheetRectangle nodeRectangle = new SheetRectangle();

                                nodeRectangle.Left   = Convert.ToInt32(sheetTable.ColumnPositionCollection[columnIndex + px].position);
                                nodeRectangle.Right  = Convert.ToInt32(sheetTable.ColumnPositionCollection[columnIndex + px + 1].position);
                                nodeRectangle.Top    = Convert.ToInt32(sheetTable.RowPositionCollection[rowIndex + py].position);
                                nodeRectangle.Bottom = Convert.ToInt32(sheetTable.RowPositionCollection[rowIndex + py + 1].position);

                                nodeRectangle.Left   += pointX;
                                nodeRectangle.Right  += pointX;
                                nodeRectangle.Top    += pointY;
                                nodeRectangle.Bottom += pointY;
                                //计算放大倍数,换算为Pixels为单位
                                nodeRectangle.Left   = nodeRectangle.Left * 2 / 30;
                                nodeRectangle.Right  = nodeRectangle.Right * 2 / 30;
                                nodeRectangle.Top    = nodeRectangle.Top * 2 / 30;
                                nodeRectangle.Bottom = nodeRectangle.Bottom * 2 / 30;

                                float width  = nodeRectangle.Right - nodeRectangle.Left;
                                float height = nodeRectangle.Bottom - nodeRectangle.Top;
                                //result.Append("<div style='position:absolute;border:solid 1px black; left:" + (nodeRectangle.Left + 50) + "px; top:" + nodeRectangle.Top + "px; width:" + width + "px; height:" + height + "px;'></div>");


                                float pageStartPointX = 21 + 20;
                                float pageStartPointY = 21 + 16;
                                // 合并单元格左边框
                                if (px == 0)
                                {
                                    float startPointX = nodeRectangle.Left + pageStartPointX;
                                    float startPointY = nodeRectangle.Top + pageStartPointY;
                                    float endPointX   = nodeRectangle.Left + pageStartPointX;
                                    float endPointY   = nodeRectangle.Bottom + pageStartPointY;
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-left:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                                // 合并单元格上边框
                                if (py == 0)
                                {
                                    float startPointX = nodeRectangle.Left + pageStartPointX;
                                    float startPointY = nodeRectangle.Top + pageStartPointY;
                                    float endPointX   = nodeRectangle.Right + pageStartPointX;
                                    float endPointY   = nodeRectangle.Top + pageStartPointY;
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-top:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                                // 合并单元格右边框
                                if (px == Convert.ToInt32(sheetItemNode.CellPx) - 1 //最后一条边
                                    //&& columnIndex + Convert.ToInt32(sheetItemNode.CellPx) == columnCount
                                    )
                                {
                                    float startPointX = nodeRectangle.Right + pageStartPointX;
                                    float startPointY = nodeRectangle.Top + pageStartPointY;
                                    float endPointX   = nodeRectangle.Right + pageStartPointX;
                                    float endPointY   = nodeRectangle.Bottom + pageStartPointY;
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-right:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                                // 合并单元格下边框
                                if (py == Convert.ToInt32(sheetItemNode.CellPy) - 1  //最后一条边
                                    //&& rowIndex + Convert.ToInt32(sheetItemNode.CellPy) == rowCount
                                    )
                                {
                                    float startPointX = nodeRectangle.Left + pageStartPointX;
                                    float startPointY = nodeRectangle.Bottom + pageStartPointY;
                                    float endPointX   = nodeRectangle.Right + pageStartPointX;
                                    float endPointY   = nodeRectangle.Bottom + pageStartPointY;
                                    if (columnIndex + Convert.ToInt32(sheetItemNode.CellPx) == columnCount)
                                    {
                                        // 画图时右下角缺一块???
                                        endPointX++;
                                    }
                                    width  = endPointX - startPointX;
                                    height = endPointY - startPointY;
                                    result.Append(" <div style='position:absolute;border-bottom:solid 1px black; left:" + startPointX + "px; top:" + startPointY + "px; width:" + width + "px; height:" + height + "px;'></div>\r\n");
                                }
                            }
                        }
                        /**/
                    }
                }