public string DoRenameField(string newField)
        {
            string sql = "";

            if (this.FK_MapData.IndexOf("ND") == 0)
            {
                string strs = this.FK_MapData.Replace("ND", "");
                strs = strs.Substring(0, strs.Length - 2);

                string   rptTable = "ND" + strs + "Rpt";
                MapDatas mds      = new MapDatas();
                mds.Retrieve(MapDataAttr.PTable, rptTable);

                foreach (MapData item in mds)
                {
                    sql = "UPDATE Sys_MapAttr SET KeyOfEn='" + newField + "',  MyPK='" + newField + "_" + item.No + " WHERE KeyOfEn='" + this.KeyOfEn + "' AND FK_MapData='" + item.No + "'";
                    DBAccess.RunSQL(sql);
                }
            }
            else
            {
                sql = "UPDATE Sys_MapAttr SET KeyOfEn='" + newField + "', MyPK='" + newField + "_" + this.FK_MapData + "  WHERE KeyOfEn='" + this.KeyOfEn + "' AND FK_MapData='" + this.FK_MapData + "'";
                DBAccess.RunSQL(sql);
            }

            return("重名称成功,如果是自由表单,请关闭表单设计器重新打开.");
        }
Exemple #2
0
        public void BindFrmLib()
        {
            this.Pub1.AddH2("表单库");

            this.Pub1.AddTable("width=100% align=left");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("Idx");
            this.Pub1.AddTDTitle("表单编号");
            this.Pub1.AddTDTitle("名称");
            this.Pub1.AddTDTitle("物理表");

            //this.Pub1.AddTDTitle("设计者");
            //this.Pub1.AddTDTitle("设计单位");
            //this.Pub1.AddTDTitle("联系方式");
            this.Pub1.AddTREnd();

            MapDatas mds = new MapDatas();

            mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application);

            SysFormTrees fss = new SysFormTrees();

            fss.RetrieveAll();
            int idx = 0;

            foreach (SysFormTree fs in fss)
            {
                idx++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx);
                this.Pub1.AddTD("colspan=6", "<b>" + fs.Name + "</b>");
                this.Pub1.AddTREnd();
                foreach (MapData md in mds)
                {
                    if (md.FK_FrmSort != fs.No)
                    {
                        continue;
                    }
                    idx++;
                    this.Pub1.AddTR();
                    this.Pub1.AddTDIdx(idx);
                    this.Pub1.AddTD(md.No);
                    this.Pub1.AddTDA("FlowFrms.aspx?ShowType=Frm&FK_MapData=" + md.No + "&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow, md.Name);
                    this.Pub1.AddTD(md.PTable);
                    //this.Pub1.AddTD(md.Designer);
                    //this.Pub1.AddTD(md.DesignerUnit);
                    //this.Pub1.AddTD(md.DesignerContact);
                    this.Pub1.AddTREnd();

                    //this.Pub1.AddTR();
                    //this.Pub1.AddTD();
                    //this.Pub1.AddTD();
                    //this.Pub1.AddTDBegin("colspan=5");
                    //this.Pub1.AddTDEnd();
                    //this.Pub1.AddTREnd();
                }
            }
            this.Pub1.AddTableEnd();
        }
Exemple #3
0
        void btn_SaveFlowFrms_Click(object sender, EventArgs e)
        {
            FrmNodes fns = new FrmNodes(this.FK_Flow, this.FK_Node);
            MapDatas mds = new MapDatas();

            mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application);

            //BP.WF.Node nd = new BP.WF.Node(this.FK_Node);

            string ids = ",";

            foreach (MapData md in mds)
            {
                CheckBox cb = this.Pub1.GetCBByID("CB_" + md.No);
                if (cb == null || cb.Checked == false)
                {
                    continue;
                }
                ids += md.No + ",";
            }

            //删除已经删除的。
            foreach (FrmNode fn in fns)
            {
                if (ids.Contains("," + fn.FK_Frm + ",") == false)
                {
                    fn.Delete();
                    continue;
                }
            }

            // 增加集合中没有的。
            string[] strs = ids.Split(',');
            foreach (string s in strs)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                if (fns.Contains(FrmNodeAttr.FK_Frm, s))
                {
                    continue;
                }

                FrmNode fn = new FrmNode();
                fn.FK_Frm  = s;
                fn.FK_Flow = this.FK_Flow;
                fn.FK_Node = this.FK_Node;
                fn.Save();
            }
            this.Response.Redirect("FlowFrms.aspx?ShowType=EditPowerOrder&FK_Node=" + this.FK_Node + "&FK_Flow=" + this.FK_Flow, true);
        }
Exemple #4
0
        private string GetFlowFormTree()
        {
            string flowId = getUTF8ToString("flowId");
            string nodeId = getUTF8ToString("nodeId");

            //add root
            BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree();
            root.No       = "01";
            root.ParentNo = "0";
            root.Name     = "目录";
            root.NodeType = "root";
            appFlowFormTree.Clear();
            appFlowFormTree.AddEntity(root);

            #region 添加表单及文件夹

            //节点表单
            FrmNodes    frmNodes = new FrmNodes();
            QueryObject qo       = new QueryObject(frmNodes);
            qo.AddWhere(FrmNodeAttr.FK_Node, nodeId);
            qo.addAnd();
            qo.AddWhere(FrmNodeAttr.FK_Flow, flowId);
            qo.addOrderBy(FrmNodeAttr.Idx);
            qo.DoQuery();
            //文件夹
            SysFormTrees formTrees = new SysFormTrees();
            formTrees.RetrieveAll(SysFormTreeAttr.Name);
            //所有表单集合
            MapDatas mds = new MapDatas();
            mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application);
            foreach (FrmNode frmNode in frmNodes)
            {
                foreach (MapData md in mds)
                {
                    if (frmNode.FK_Frm != md.No)
                    {
                        continue;
                    }

                    foreach (SysFormTree formTree in formTrees)
                    {
                        if (md.FK_FormTree != formTree.No)
                        {
                            continue;
                        }

                        if (!appFlowFormTree.Contains("No", formTree.No))
                        {
                            BP.WF.Template.FlowFormTree nodeFolder = new BP.WF.Template.FlowFormTree();
                            nodeFolder.No       = formTree.No;
                            nodeFolder.ParentNo = root.No;
                            nodeFolder.Name     = formTree.Name;
                            nodeFolder.NodeType = "folder";
                            appFlowFormTree.AddEntity(nodeFolder);
                        }
                    }
                    //检查必填项
                    bool        IsNotNull  = false;
                    FrmFields   formFields = new FrmFields();
                    QueryObject obj        = new QueryObject(formFields);
                    obj.AddWhere(FrmFieldAttr.FK_Node, nodeId);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.FK_MapData, md.No);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.IsNotNull, "1");
                    obj.DoQuery();
                    if (formFields != null && formFields.Count > 0)
                    {
                        IsNotNull = true;
                    }

                    BP.WF.Template.FlowFormTree nodeForm = new BP.WF.Template.FlowFormTree();
                    nodeForm.No       = md.No;
                    nodeForm.ParentNo = md.FK_FormTree;
                    nodeForm.Name     = md.Name;
                    nodeForm.NodeType = IsNotNull ? "form|1" : "form|0";
                    appFlowFormTree.AddEntity(nodeForm);
                }
            }
            #endregion
            //扩展工具,显示位置为表单树类型
            NodeToolbars extToolBars = new NodeToolbars();
            QueryObject  info        = new QueryObject(extToolBars);
            info.AddWhere(NodeToolbarAttr.FK_Node, nodeId);
            info.addAnd();
            info.AddWhere(NodeToolbarAttr.ShowWhere, (int)ShowWhere.Tree);
            info.DoQuery();

            foreach (NodeToolbar item in extToolBars)
            {
                string url = "";
                if (string.IsNullOrEmpty(item.Url))
                {
                    continue;
                }

                url = item.Url;

                BP.WF.Template.FlowFormTree formTree = new BP.WF.Template.FlowFormTree();
                formTree.No       = item.OID.ToString();
                formTree.ParentNo = "01";
                formTree.Name     = item.Title;
                formTree.NodeType = "tools|0";
                if (!string.IsNullOrEmpty(item.Target) && item.Target.ToUpper() == "_BLANK")
                {
                    formTree.NodeType = "tools|1";
                }

                formTree.Url = url;
                appFlowFormTree.AddEntity(formTree);
            }
            TansEntitiesToGenerTree(appFlowFormTree, root.No, "");
            return(appendMenus.ToString());
        }
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns>返回执行结果</returns>
        public override object Do()
        {
            string path = this.GetValStrByKey("Path") + "_" + DateTime.Now.ToString("yy年MM月dd日HH时mm分");

            if (System.IO.Directory.Exists(path))
            {
                return("系统正在执行中,请稍后。");
            }

            System.IO.Directory.CreateDirectory(path);
            System.IO.Directory.CreateDirectory(path + "\\Flow.流程模板");
            System.IO.Directory.CreateDirectory(path + "\\Frm.表单模板");

            Flows fls = new Flows();

            fls.RetrieveAll();
            FlowSorts sorts = new FlowSorts();

            sorts.RetrieveAll();

            // 生成流程模板。
            foreach (FlowSort sort in sorts)
            {
                string pathDir = path + "\\Flow.流程模板\\" + sort.No + "." + sort.Name;
                System.IO.Directory.CreateDirectory(pathDir);
                foreach (Flow fl in fls)
                {
                    fl.DoExpFlowXmlTemplete(pathDir);
                }
            }

            // 生成表单模板。
            foreach (FlowSort sort in sorts)
            {
                string pathDir = path + "\\Frm.表单模板\\" + sort.No + "." + sort.Name;
                System.IO.Directory.CreateDirectory(pathDir);
                foreach (Flow fl in fls)
                {
                    string pathFlowDir = pathDir + "\\" + fl.No + "." + fl.Name;
                    System.IO.Directory.CreateDirectory(pathFlowDir);
                    Nodes nds = new Nodes(fl.No);
                    foreach (Node nd in nds)
                    {
                        MapData             md = new MapData("ND" + nd.NodeID);
                        System.Data.DataSet ds = md.GenerHisDataSet();
                        ds.WriteXml(pathFlowDir + "\\" + nd.NodeID + "." + nd.Name + ".Frm.xml");
                    }
                }
            }

            // 流程表单模板.
            SysFormTrees frmSorts = new SysFormTrees();

            frmSorts.RetrieveAll();
            foreach (SysFormTree sort in frmSorts)
            {
                string pathDir = path + "\\Frm.表单模板\\" + sort.No + "." + sort.Name;
                System.IO.Directory.CreateDirectory(pathDir);

                MapDatas mds = new MapDatas();
                mds.Retrieve(MapDataAttr.FK_FrmSort, sort.No);
                foreach (MapData md in mds)
                {
                    System.Data.DataSet ds = md.GenerHisDataSet();
                    ds.WriteXml(pathDir + "\\" + md.No + "." + md.Name + ".Frm.xml");
                }
            }
            return("生成成功,请打开" + path + "。<br>如果您想共享出来请压缩后发送到template@ccflow.org");
        }
Exemple #6
0
        private string GetFlowFormTree()
        {
            //add root
            BP.WF.Template.FlowFormTree root = new BP.WF.Template.FlowFormTree();
            root.No       = "00";
            root.ParentNo = "0";
            root.Name     = "目录";
            root.NodeType = "root";
            appFlowFormTree.Clear();
            appFlowFormTree.AddEntity(root);

            #region 添加表单及文件夹

            //节点表单
            string     tfModel = SystemConfig.AppSettings["TreeFrmModel"];
            BP.WF.Node nd      = new BP.WF.Node(this.FK_Node);

            FrmNodes    frmNodes = new FrmNodes();
            QueryObject qo       = new QueryObject(frmNodes);
            qo.AddWhere(FrmNodeAttr.FK_Node, this.FK_Node);
            qo.addAnd();
            qo.AddWhere(FrmNodeAttr.FK_Flow, this.FK_Flow);
            //如果配置了启用关键字段,一下会判断绑定的独立表单中的关键字段是否有数据,没有就不会被显示
            // add  by  海南  zqp
            if (tfModel == "1")
            {
                //针对合流点与分合流节点有效
                //获取独立表单的字段
                MapDatas mdes  = new MapDatas();
                string   mypks = "";
                if (nd.IsStartNode == false)
                {
                    qo.addOrderBy(FrmNodeAttr.Idx);
                    qo.DoQuery();
                    foreach (FrmNode fn in frmNodes)
                    {
                        if (fn.HisFrmType == FrmType.Column4Frm || fn.HisFrmType == FrmType.FreeFrm)
                        {
                            mdes.Retrieve(MapDataAttr.No, fn.FK_Frm);
                            //根据设置的关键字段是否有值,进行判断
                            foreach (MapData md in mdes)
                            {
                                Paras ps = new Paras();
                                ps.SQL = "SELECT " + fn.GuanJianZiDuan + " FROM " + md.PTable + " WHERE "
                                         + " OID=" + SystemConfig.AppCenterDBVarStr + "OID";
                                if (this.FID == 0)
                                {
                                    ps.Add("OID", this.WorkID);
                                }
                                else
                                {
                                    ps.Add("OID", this.FID);
                                }
                                try
                                {
                                    DataTable dtmd  = BP.DA.DBAccess.RunSQLReturnTable(ps);
                                    string    dtVal = dtmd.Rows[0]["" + fn.GuanJianZiDuan + ""].ToString();
                                    if (string.IsNullOrWhiteSpace(dtVal))
                                    {
                                        mypks = mypks + "'" + md.No + "',";
                                    }
                                }
                                catch (Exception ex)
                                {
                                    mypks = mypks + "'" + md.No + "',";
                                }
                            }
                        }
                    }
                    mypks = mypks.TrimEnd(',');
                    if (!string.IsNullOrWhiteSpace(mypks))
                    {
                        //添加查询条件
                        qo = new QueryObject(frmNodes);
                        qo.AddWhere(FrmNodeAttr.FK_Node, this.FK_Node);
                        qo.addAnd();
                        qo.AddWhere(FrmNodeAttr.FK_Flow, this.FK_Flow);
                        qo.addAnd();
                        qo.AddWhere(FrmNodeAttr.FK_Frm + " not in(" + mypks + ")");
                        qo.addOrderBy(FrmNodeAttr.Idx);
                        qo.DoQuery();
                    }
                }
                else
                {
                    qo.addOrderBy(FrmNodeAttr.Idx);
                    qo.DoQuery();
                }
            }
            else
            {
                qo.addOrderBy(FrmNodeAttr.Idx);
                qo.DoQuery();
            }
            //文件夹
            SysFormTrees formTrees = new SysFormTrees();
            formTrees.RetrieveAll(SysFormTreeAttr.Name);

            //所有表单集合
            MapDatas mds = new MapDatas();
            mds.RetrieveInSQL("SELECT FK_Frm FROM WF_FrmNode WHERE FK_Node=" + this.FK_Node);

            foreach (FrmNode frmNode in frmNodes)
            {
                #region 增加判断是否启用规则.
                switch (frmNode.FrmEnableRole)
                {
                case FrmEnableRole.Allways:
                    break;

                case FrmEnableRole.WhenHaveData:     //判断是否有数据.
                    MapData md = new MapData(frmNode.FK_Frm);
                    if (DBAccess.RunSQLReturnValInt("SELECT COUNT(*) as Num FROM " + md.PTable + " WHERE OID=" + this.WorkID) == 0)
                    {
                        continue;
                    }
                    break;

                case FrmEnableRole.WhenHaveFrmPara:     //判断是否有参数.
                    string frms = this.Request.QueryString["Frms"];
                    if (frms != null && frms.Contains(frmNode.FK_Frm) == true)
                    {
                        /*包含这个表单.*/
                    }
                    else
                    {
                        continue;
                    }
                    break;

                case FrmEnableRole.ByFrmFields:
                    throw new Exception("@这种类型的判断,ByFrmFields 还没有完成。");

                case FrmEnableRole.BySQL:      // 按照SQL的方式.
                    string mysql = frmNode.FrmEnableExp.Clone() as string;
                    mysql = mysql.Replace("@OID", this.WorkID.ToString());
                    mysql = mysql.Replace("@WorkID", this.WorkID.ToString());

                    mysql = mysql.Replace("@NodeID", this.FK_Node.ToString());
                    mysql = mysql.Replace("@FK_Node", this.FK_Node.ToString());

                    mysql = mysql.Replace("@FK_Flow", this.FK_Flow);

                    if (DBAccess.RunSQLReturnValFloat(mysql) <= 0)
                    {
                        continue;
                    }
                    break;

                case FrmEnableRole.Disable:      // 如果禁用了,就continue出去..
                    continue;

                default:
                    throw new Exception("@没有判断的规则." + frmNode.FrmEnableRole);
                }
                #endregion

                #region 检查是否有没有目录的表单?
                bool isHave = false;
                foreach (MapData md in mds)
                {
                    if (md.FK_FormTree == "")
                    {
                        isHave = true;
                        break;
                    }
                }

                string treeNo = "0";
                if (isHave && mds.Count == 1)
                {
                    treeNo = "0";
                }
                else if (isHave == true)
                {
                    foreach (MapData md in mds)
                    {
                        if (md.FK_FormTree != "")
                        {
                            treeNo = md.FK_FormTree;
                            break;
                        }
                    }
                }
                #endregion 检查是否有没有目录的表单?

                foreach (MapData md in mds)
                {
                    if (frmNode.FK_Frm != md.No)
                    {
                        continue;
                    }

                    #warning 这里有错误, 如果是节点表单的话,就没有这个值,没有这个值就绑定不到表单树,代国强解决.
                    if (md.FK_FormTree == "")
                    {
                        md.FK_FormTree = treeNo;
                    }

                    foreach (SysFormTree formTree in formTrees)
                    {
                        if (md.FK_FormTree != formTree.No)
                        {
                            continue;
                        }
                        if (appFlowFormTree.Contains("No", formTree.No) == false)
                        {
                            BP.WF.Template.FlowFormTree nodeFolder = new BP.WF.Template.FlowFormTree();
                            nodeFolder.No       = formTree.No;
                            nodeFolder.ParentNo = root.No;
                            nodeFolder.Name     = formTree.Name;
                            nodeFolder.NodeType = "folder";
                            appFlowFormTree.AddEntity(nodeFolder);
                        }
                    }
                    //检查必填项
                    bool        IsNotNull  = false;
                    FrmFields   formFields = new FrmFields();
                    QueryObject obj        = new QueryObject(formFields);
                    obj.AddWhere(FrmFieldAttr.FK_Node, this.FK_Node);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.FK_MapData, md.No);
                    obj.addAnd();
                    obj.AddWhere(FrmFieldAttr.IsNotNull, "1");
                    obj.DoQuery();
                    if (formFields != null && formFields.Count > 0)
                    {
                        IsNotNull = true;
                    }

                    BP.WF.Template.FlowFormTree nodeForm = new BP.WF.Template.FlowFormTree();
                    nodeForm.No       = md.No;
                    nodeForm.ParentNo = md.FK_FormTree;
                    nodeForm.Name     = md.Name;
                    nodeForm.NodeType = IsNotNull ? "form|1" : "form|0";
                    nodeForm.IsEdit   = Convert.ToString(Convert.ToInt32(frmNode.IsEdit));
                    appFlowFormTree.AddEntity(nodeForm);
                }
            }
            #endregion

            //扩展工具,显示位置为表单树类型
            NodeToolbars extToolBars = new NodeToolbars();
            QueryObject  info        = new QueryObject(extToolBars);
            info.AddWhere(NodeToolbarAttr.FK_Node, this.FK_Node);
            info.addAnd();
            info.AddWhere(NodeToolbarAttr.ShowWhere, (int)ShowWhere.Tree);
            info.DoQuery();

            foreach (NodeToolbar item in extToolBars)
            {
                string url = "";
                if (string.IsNullOrEmpty(item.Url))
                {
                    continue;
                }

                url = item.Url;

                BP.WF.Template.FlowFormTree formTree = new BP.WF.Template.FlowFormTree();
                formTree.No       = item.OID.ToString();
                formTree.ParentNo = "01";
                formTree.Name     = item.Title;
                formTree.NodeType = "tools|0";
                if (!string.IsNullOrEmpty(item.Target) && item.Target.ToUpper() == "_BLANK")
                {
                    formTree.NodeType = "tools|1";
                }

                formTree.Url = url;
                appFlowFormTree.AddEntity(formTree);
            }
            TansEntitiesToGenerTree(appFlowFormTree, root.No, "");
            return(appendMenus.ToString());
        }
Exemple #7
0
        public void BindFlowFrms()
        {
            FrmNodes fns = new FrmNodes(this.FK_Node);

            this.Pub1.AddH2("流程表单绑定 - 请打钩要绑定的表单,然后点保存按钮。");
            this.Pub1.AddTable("align=left");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("Idx");
            this.Pub1.AddTDTitle("表单编号");
            this.Pub1.AddTDTitle("名称");
            this.Pub1.AddTDTitle("物理表");
            this.Pub1.AddTREnd();

            BP.WF.Node nd  = new BP.WF.Node(this.FK_Node);
            MapDatas   mds = new MapDatas();

            mds.Retrieve(MapDataAttr.AppType, (int)AppType.Application);

            FrmSorts fss = new FrmSorts();

            fss.RetrieveAll();
            int idx = 0;

            foreach (FrmSort fs in fss)
            {
                idx++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(idx);
                this.Pub1.AddTDB("colspan=3", fs.Name);
                this.Pub1.AddTREnd();
                foreach (MapData md in mds)
                {
                    if (md.FK_FrmSort != fs.No)
                    {
                        continue;
                    }
                    idx++;
                    this.Pub1.AddTR();
                    this.Pub1.AddTDIdx(idx);

                    CheckBox cb = new CheckBox();
                    cb.ID      = "CB_" + md.No;
                    cb.Text    = md.No;
                    cb.Checked = fns.Contains(FrmNodeAttr.FK_Frm, md.No);

                    this.Pub1.AddTD(cb);
                    this.Pub1.AddTD(md.Name);
                    this.Pub1.AddTD(md.PTable);
                    //this.Pub1.AddTD(md.Designer);
                    //this.Pub1.AddTD(md.DesignerUnit);
                    //this.Pub1.AddTD(md.DesignerContact);
                    this.Pub1.AddTREnd();
                }
            }
            Button btn = new Button();

            btn.ID       = "Btn_Save";
            btn.Text     = "Save";
            btn.CssClass = "Btn";
            btn.Click   += new EventHandler(btn_SaveFlowFrms_Click);
            this.Pub1.AddTR();
            this.Pub1.AddTD("colspan=5", btn);
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }