Exemple #1
0
        void btn_Click(object sender, EventArgs e)
        {
            Flow fl = new Flow(this.FK_Flow);

            FlowNodes fnds = new FlowNodes();

            fnds.Delete(FlowNodeAttr.FK_Flow, this.FK_Flow);

            BP.WF.Nodes nds = fl.HisNodes;
            foreach (BP.WF.Node nd in nds)
            {
                CheckBox cb = this.Ucsys1.GetCBByID("CB_" + nd.NodeID);
                if (cb.Checked == false)
                {
                    continue;
                }


                FlowNode fn = new FlowNode();
                fn.FK_Flow = this.FK_Flow;
                fn.FK_Node = nd.NodeID;
                fn.Insert();
            }
            this.Response.Redirect(this.Request.RawUrl, true);
        }
Exemple #2
0
 protected void DDL_Frm1()
 {
     BP.WF.Node nd = new BP.WF.Node(this.NodeID);
     this.DDL_Frm.Items.Clear();
     BP.WF.Nodes nds = new BP.WF.Nodes(nd.HisFlow.No);
     foreach (BP.WF.Node item in nds)
     {
         this.DDL_Frm.Items.Add(new ListItem(item.NodeID + " " + item.Name, item.NodeID.ToString()));
     }
 }
        /// <summary>
        /// 设置下一节点的工作人员多维度
        /// </summary>
        /// <param name="flowid"></param>
        /// <param name="workid"></param>
        /// <param name="nodeid"></param>
        /// <param name="emps"></param>
        /// <param name="fid"></param>
        /// <returns></returns>
        public static bool SetNextNodeFH(string flowid, Int64 workid, int nodeid, string emps, int fid)
        {
            try
            {
                BP.WF.Nodes nodes  = BP.WF.Dev2Interface.WorkOpt_GetToNodes(flowid, nodeid, workid, fid);
                int         nodeID = 0;

                foreach (BP.WF.Node node in nodes)
                {
                    nodeID = node.NodeID;
                    break;
                }

                string[] empData = emps.Split(',');

                foreach (string emp in empData)
                {
                    Compeader.Data.Comleader_NodeWork nodeWork = new Compeader.Data.Comleader_NodeWork();

                    string[] empAndTag = emp.Split('@');

                    string userName = "";
                    string tag      = "";
                    string userNo   = "";
                    if (empAndTag.Length >= 2)
                    {
                        tag    = empAndTag[1];
                        userNo = empAndTag[0];

                        try
                        {
                            BP.Port.Emp empSingle = new BP.Port.Emp(userNo);
                            userName = empSingle.Name;
                        }
                        catch (Exception ex)
                        {
                            continue;
                        }
                    }
                    nodeWork.MyPk     = Guid.NewGuid().ToString("N");
                    nodeWork.OID      = workid;
                    nodeWork.NodeID   = nodeid;
                    nodeWork.UserNo   = userNo;
                    nodeWork.Tag      = tag;
                    nodeWork.UserName = userName;
                    nodeWork.Insert();
                }

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        void btn_Click(object sender, EventArgs e)
        {
            Listen li = new Listen();

            if (this.RefOID != 0)
            {
                li.OID = this.RefOID;
                li.Retrieve();
            }

            li     = this.Pub1.Copy(li) as Listen;
            li.OID = this.RefOID;

            BP.WF.Node  nd   = new BP.WF.Node(this.FK_Node);
            BP.WF.Nodes nds  = new BP.WF.Nodes(nd.FK_Flow);
            string      strs = "";

            foreach (BP.WF.Node en in nds)
            {
                if (en.NodeID == this.FK_Node)
                {
                    continue;
                }

                CheckBox cb = this.Pub1.GetCBByID("CB_" + en.NodeID);
                if (cb.Checked)
                {
                    strs += "@" + en.NodeID;
                }
            }

            li.Nodes   = strs;
            li.FK_Node = this.FK_Node;

            if (li.OID == 0)
            {
                li.Insert();
            }
            else
            {
                li.Update();
            }

            var btn = (LinkBtn)sender;

            if (btn.ID == NamesOfBtn.Save)
            {
                this.Response.Redirect("Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New&RefOID=" + li.OID, true);
            }
            else
            {
                this.Response.Redirect("Listen.aspx?FK_Node=" + this.FK_Node + "&DoType=New&RefOID=0", true);
            }
        }
Exemple #5
0
 /// <summary>
 /// 09.与指定节点处理人相同 取值
 /// 12.按指定节点的人员岗位计算
 /// </summary>
 public void bindCBL()
 {
     BP.WF.Node nd = new BP.WF.Node(this.NodeID);
     this.CBL_BySpecNodeEmp.Items.Clear();
     this.CBL_BySpecNodeEmpStation.Items.Clear();
     BP.WF.Nodes nds = new BP.WF.Nodes(nd.HisFlow.No);
     foreach (BP.WF.Node item in nds)
     {
         this.CBL_BySpecNodeEmp.Items.Add(new ListItem(item.NodeID + " " + item.Name, item.NodeID.ToString()));
         this.CBL_BySpecNodeEmpStation.Items.Add(new ListItem(item.NodeID + " " + item.Name, item.NodeID.ToString()));
     }
 }
        /// <summary>
        /// 设置下一步骤的接收人
        /// </summary>
        /// <param name="workid"></param>
        /// <param name="nodeid"></param>
        /// <param name="emps"></param>
        /// <returns></returns>
        public static bool SetNextWork(string flowid, Int64 workid, int nodeid, string emps, int fid)
        {
            try
            {
                BP.WF.Nodes nodes  = BP.WF.Dev2Interface.WorkOpt_GetToNodes(flowid, nodeid, workid, fid);
                int         nodeID = 0;

                foreach (BP.WF.Node node in nodes)
                {
                    nodeID = node.NodeID;
                    break;
                }

                BP.WF.Dev2Interface.Node_AddNextStepAccepters(workid, nodeID, emps);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "字段复制";

            BP.WF.Node  nd  = new BP.WF.Node(this.FK_Node);
            BP.WF.Nodes nds = new BP.WF.Nodes(nd.FK_Flow);

            Node sNd = new Node(this.NodeOfSelect);

            MapAttrs attrs     = new MapAttrs(this.NodeOfSelect);
            MapAttrs attrsCopy = new MapAttrs(this.FK_Node);


            this.Pub1.AddFieldSet("选择节点");
            this.Pub1.AddUL("Main");
            foreach (BP.WF.Node en in nds)
            {
                if (this.NodeOfSelect == en.NodeID.ToString())
                {
                    this.Pub1.AddLiB("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name);
                }
                else
                {
                    this.Pub1.AddLi("CopyFieldFromNode.aspx?FK_Node=" + this.FK_Node + "&NodeOfSelect=ND" + en.NodeID, "步骤:" + en.Step + ",名称:" + en.Name);
                }
            }
            this.Pub1.AddULEnd();
            this.Pub1.AddFieldSetEnd();

            this.Pub2.AddTable("width='500px'");

            //this.Pub2.AddTR();
            //this.Pub2.AddTDTitle(this.ToE("Field", "字段"));
            ////this.Pub2.AddTDTitle("描述");
            ////this.Pub2.AddTDTitle("类型");
            ////this.Pub2.AddTDTitle(this.ToE("Show", "显示"));
            //this.Pub2.AddTREnd();

            GroupFields gfs  = new GroupFields(this.NodeOfSelect);
            MapDtls     dtls = new MapDtls(this.NodeOfSelect);
            MapM2Ms     m2ms = new MapM2Ms(this.NodeOfSelect);
            MapFrames   frms = new MapFrames(this.NodeOfSelect);

            bool isHave = false;

            foreach (GroupField gf in gfs)
            {
                this.Pub2.AddTRSum();
                CheckBox cb = new CheckBox();
                cb.ID   = "CB" + gf.OID;
                cb.Text = "<b>" + gf.Lab + "</b>";
                this.Pub2.AddTD(cb);
                this.Pub2.AddTREnd();

                foreach (MapDtl dtl in dtls)
                {
                    if (dtl.GroupID != gf.OID)
                    {
                        continue;
                    }

                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + dtl.No + "_" + dtl.GroupID;
                    cb.Text = "从表:" + dtl.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }

                foreach (MapM2M m2m in m2ms)
                {
                    if (m2m.GroupID != gf.OID)
                    {
                        continue;
                    }
                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + m2m.MyPK + "_" + m2m.GroupID;
                    cb.Text = "多选" + ":" + m2m.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }

                foreach (MapFrame frm in frms)
                {
                    if (frm.GroupID != gf.OID)
                    {
                        continue;
                    }
                    this.Pub2.AddTR();
                    cb      = new CheckBox();
                    cb.ID   = "CB" + frm.MyPK + "_" + frm.GroupID;
                    cb.Text = "框架" + ":" + frm.Name;
                    this.Pub2.AddTD(cb);
                    this.Pub2.AddTREnd();
                }


                this.Pub2.AddTR();
                this.Pub2.AddTDBigDocBegain();
                foreach (MapAttr attr in attrs)
                {
                    if (gf.OID != attr.GroupID)
                    {
                        continue;
                    }

                    switch (attr.KeyOfEn)
                    {
                    case BP.WF.GEStartWorkAttr.CDT:
                    case BP.WF.GEStartWorkAttr.Emps:
                    case BP.WF.GEStartWorkAttr.FID:
                    case BP.WF.GEStartWorkAttr.OID:
                    case BP.WF.GEStartWorkAttr.RDT:
                    case BP.WF.GEStartWorkAttr.Rec:
                    case BP.WF.GEStartWorkAttr.FK_NY:
                    case BP.WF.GEStartWorkAttr.WFState:
                    case BP.WF.GEStartWorkAttr.MyNum:
                    case BP.WF.GEStartWorkAttr.FK_Dept:
                    case BP.WF.GEStartWorkAttr.FK_DeptText:
                        continue;

                    default:
                        break;
                    }

                    cb      = new CheckBox();
                    cb.ID   = attr.KeyOfEn;
                    cb.Text = attr.KeyOfEn + " " + attr.Name;

                    if (attrsCopy.Contains(MapAttrAttr.KeyOfEn, attr.KeyOfEn))
                    {
                        cb.Enabled = false;
                    }
                    else
                    {
                        cb.Enabled = true;
                    }

                    isHave = true;
                    this.Pub2.Add(cb);
                }
                this.Pub2.AddTDEnd();
                this.Pub2.AddTREnd();
            }

            this.Pub2.AddTableEndWithBR();
            Button btn = new Button();

            btn.CssClass = "Btn";
            if (isHave == false)
            {
                return;
            }
            this.Pub2.Add("到分组:");
            gfs = new GroupFields(this.FK_Node);
            BP.Web.Controls.DDL ddl = new BP.Web.Controls.DDL();
            ddl.ID = "DDL_GroupField";
            ddl.Bind(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab);
            ddl.SetSelectItem(this.GroupField);
            this.Pub2.Add(ddl);
            btn.ID   = "Btn_OK";
            btn.Text = " 复制 ";

            btn.UseSubmitBehavior = false;
            btn.OnClientClick     = "this.disabled=true;";
            //this.disabled='disabled'; return true;";
            // btn.Attributes["onclick"] = " return confirm('您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?');";
            // btn.Attributes["onclick"] = " return confirm('" + this.ToE("AYS", "您确定要复制选择的字段到 [" + nd.Name + "]表单中吗?") + "');";

            btn.Click += new EventHandler(btn_Copy_Click);
            this.Pub2.Add(btn);
        }
        public void BindNew()
        {
            Listen li = new Listen();

            if (this.RefOID != 0)
            {
                li.OID = this.RefOID;
                li.Retrieve();
            }

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

            this.Pub1.AddTable("class='Table' cellSpacing='1' cellPadding='1' border='1' style='width:100%'");
            this.Pub1.AddTR();
            this.Pub1.AddTD("class='GroupTitle'", "设置收听:" + nd.Name + " - <a href='Listen.aspx?FK_Node=" + this.FK_Node + "' >收听列表</a>");
            this.Pub1.AddTR();
            this.Pub1.AddTD("class='GroupTitle'", "选择您要收听的节点(可以选择多个)");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDBegin();

            BP.WF.Nodes nds = new BP.WF.Nodes(nd.FK_Flow);

            foreach (BP.WF.Node en in nds)
            {
                if (en.NodeID == this.FK_Node)
                {
                    continue;
                }

                CheckBox cb = new CheckBox();
                cb.Text = "步骤:" + en.Step + " - " + en.Name;
                cb.ID   = "CB_" + en.NodeID;

                cb.Checked = li.Nodes.Contains("@" + en.NodeID);
                this.Pub1.Add(cb);
                this.Pub1.AddBR();
            }

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("class='GroupTitle'", "设置标题(最大长度不超过250个字符,可以包含字段变量变量以@开头)");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();

            TextBox tb = new TextBox();

            tb.ID      = "TB_Title";
            tb.Columns = 70;
            tb.Style.Add("width", "99%");
            tb.Text = li.Title;

            this.Pub1.AddTDBegin();
            this.Pub1.Add(tb);
            this.Pub1.AddBR();
            this.Pub1.Add("例如:您发起的工作@Title已经被@WebUser.Name处理。");
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("class='GroupTitle'", "内容信息(长度不限制,可以包含字段变量变量以@开头)");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDBegin();

            tb          = new TextBox();
            tb.TextMode = TextBoxMode.MultiLine;
            tb.ID       = "TB_Doc";
            tb.Columns  = 70;
            tb.Rows     = 8;
            tb.Style.Add("width", "99%");
            tb.Text = li.Doc;

            this.Pub1.Add(tb);
            this.Pub1.AddBR();
            this.Pub1.Add("例如:处理时间@RDT,您可以登陆系统查看处理的详细信息,特此通知。");
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            this.Pub1.AddTableEnd();

            this.Pub1.AddBR();
            this.Pub1.AddSpace(1);

            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");

            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);
            this.Pub1.AddSpace(1);

            btn        = new LinkBtn(false, NamesOfBtn.SaveAndNew, "保存并新建");
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);
            this.Pub1.AddSpace(1);

            btn = new LinkBtn(false, NamesOfBtn.Delete, "删除");
            btn.Attributes["onclick"] = " return confirm('您确认删除吗?');";
            btn.Click += new EventHandler(btn_Del_Click);

            if (this.RefOID == 0)
            {
                btn.Enabled = false;
            }

            this.Pub1.Add(btn);
            this.Pub1.AddBR();
            this.Pub1.AddBR();

            this.Pub1.AddEasyUiPanelInfo("特别说明", "消息以什么样的渠道(短信,邮件)发送出去,是以用户设置的 “信息提示”来确定的。");
        }
Exemple #9
0
        public void BindNew()
        {
            Listen li = new Listen();

            if (this.RefOID != 0)
            {
                li.OID = this.RefOID;
                li.Retrieve();
            }

            BP.WF.Node nd = new BP.WF.Node(this.FK_Node);
            this.Pub1.AddTable();
            this.Pub1.AddCaptionLeft("设置收听:" + nd.Name + "- <a href='Listen.aspx?FK_Node=" + this.FK_Node + "' >返回列表</a>");

            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("选择您要收听的节点(可以选择多个)");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDBegin();
            BP.WF.Nodes nds = new BP.WF.Nodes(nd.FK_Flow);
            foreach (BP.WF.Node en in nds)
            {
                if (en.NodeID == this.FK_Node)
                {
                    continue;
                }

                CheckBox cb = new CheckBox();
                cb.Text = "步骤:" + en.Step + " - " + en.Name;
                cb.ID   = "CB_" + en.NodeID;

                cb.Checked = li.Nodes.Contains("@" + en.NodeID);
                this.Pub1.Add(cb);
                this.Pub1.AddBR();
            }
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("设置标题(最大长度不超过250个字符,可以包含字段变量变量以@开头)");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            TextBox tb = new TextBox();

            tb.ID      = "TB_Title";
            tb.Columns = 70;
            tb.Text    = li.Title;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("例如:您发起的工作@Title已经被@WebUser.Name处理。");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("内容信息(长度不限制,可以包含字段变量变量以@开头)");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDBegin();
            tb          = new TextBox();
            tb.TextMode = TextBoxMode.MultiLine;
            tb.ID       = "TB_Doc";
            tb.Columns  = 70;
            tb.Rows     = 8;
            tb.Text     = li.Doc;
            this.Pub1.Add(tb);
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("例如:处理时间@RDT,您可以登陆系统查看处理的详细信息,特此通知。");
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTD("<b>特别说明:</b>消息以什么样的渠道(短信,邮件)发送出去,是以用户设置的 “信息提示”来确定的。");
            this.Pub1.AddTREnd();


            this.Pub1.AddTRSum();
            this.Pub1.AddTDBegin();
            Button btn = new Button();

            btn.Text     = "保存";
            btn.ID       = "Save";
            btn.CssClass = "Btn";
            btn.Click   += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            btn      = new Button();
            btn.Text = "保存并新建";
            btn.ID   = "New";

            btn.CssClass = "Btn";
            btn.Click   += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            btn          = new Button();
            btn.Text     = "删除";
            btn.CssClass = "Btn";
            btn.Attributes["onclick"] = " return confirm('您确认吗?');";
            btn.Click += new EventHandler(btn_Del_Click);
            if (this.RefOID == 0)
            {
                btn.Enabled = false;
            }
            this.Pub1.Add(btn);

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Response.ContentEncoding = System.Text.UTF8Encoding.UTF8;
            this.Request.ContentEncoding  = System.Text.UTF8Encoding.UTF8;

            #region 功能执行.
            if (this.DoType == "Del")
            {
                FrmAttachmentDB delDB = new FrmAttachmentDB();
                delDB.MyPK = this.DelPKVal == null ? this.MyPK : this.DelPKVal;

                delDB.DirectDelete();
            }
            if (this.DoType == "Down")
            {
                FrmAttachmentDB downDB = new FrmAttachmentDB();

                downDB.MyPK = this.DelPKVal == null ? this.MyPK : this.DelPKVal;
                downDB.Retrieve();

                string downpath = GetRealPath(downDB.FileFullName);
                BP.Sys.PubClass.DownloadFile(downpath, downDB.FileName);
                this.WinClose();
                return;
            }

            if (this.DoType == "WinOpen")
            {
                FrmAttachmentDB downDB = new FrmAttachmentDB();
                downDB.MyPK = this.MyPK;
                downDB.Retrieve();
                Response.ContentType = "Application/pdf";
                string downpath = GetRealPath(downDB.FileFullName);
                Response.WriteFile(downpath);
                Response.End();
                return;
            }
            #endregion 功能执行.

            #region 处理权限控制.
            BP.Sys.FrmAttachment athDesc = new BP.Sys.FrmAttachment();
            athDesc.MyPK = this.FK_FrmAttachment;
            if (this.FK_Node == null || this.FK_Flow == null)
            {
                athDesc.RetrieveFromDBSources();
            }
            else
            {
                #region 判断是否可以查询出来,如果查询不出来,就可能是公文流程。
                athDesc.MyPK = this.FK_FrmAttachment;
                if (athDesc.RetrieveFromDBSources() == 0 && string.IsNullOrEmpty(this.FK_Flow) == false)
                {
                    /*如果没有查询到它,就有可能是公文多附件被删除了.*/
                    athDesc.MyPK       = this.FK_FrmAttachment;
                    athDesc.NoOfObj    = "DocMultiAth";
                    athDesc.FK_MapData = this.FK_MapData;
                    athDesc.Exts       = "*.*";

                    //存储路径.
                    athDesc.SaveTo    = "/DataUser/UploadFile/";
                    athDesc.IsNote    = false; //不显示note字段.
                    athDesc.IsVisable = false; // 让其在form 上不可见.

                    //位置.
                    athDesc.X = (float)94.09;
                    athDesc.Y = (float)333.18;
                    athDesc.W = (float)626.36;
                    athDesc.H = (float)150;

                    //多附件.
                    athDesc.UploadType = AttachmentUploadType.Multi;
                    athDesc.Name       = "公文多附件(系统自动增加)";
                    athDesc.SetValByKey("AtPara",
                                        "@IsWoEnablePageset=1@IsWoEnablePrint=1@IsWoEnableViewModel=1@IsWoEnableReadonly=0@IsWoEnableSave=1@IsWoEnableWF=1@IsWoEnableProperty=1@IsWoEnableRevise=1@IsWoEnableIntoKeepMarkModel=1@FastKeyIsEnable=0@IsWoEnableViewKeepMark=1@FastKeyGenerRole=@IsWoEnableTemplete=1");
                    athDesc.Insert();

                    //有可能在其其它的节点上没有这个附件,所以也要循环增加上它.
                    BP.WF.Nodes nds = new BP.WF.Nodes(this.FK_Flow);
                    foreach (BP.WF.Node nd in nds)
                    {
                        athDesc.FK_MapData = "ND" + nd.NodeID;
                        athDesc.MyPK       = athDesc.FK_MapData + "_" + athDesc.NoOfObj;
                        if (athDesc.IsExits == true)
                        {
                            continue;
                        }

                        athDesc.Insert();
                    }

                    //重新查询一次,把默认值加上.
                    athDesc.RetrieveFromDBSources();
                }
                #endregion 判断是否可以查询出来,如果查询不出来,就可能是公文流程。

                #region 处理权限方案。
                /*首先判断是否具有权限方案*/
                string at = BP.Sys.SystemConfig.AppCenterDBVarStr;
                Paras  ps = new BP.DA.Paras();
                ps.SQL = "SELECT FrmSln FROM WF_FrmNode WHERE FK_Node=" + at + "FK_Node AND FK_Flow=" + at + "FK_Flow AND FK_Frm=" + at + "FK_Frm";
                ps.Add("FK_Node", this.FK_Node);
                ps.Add("FK_Flow", this.FK_Flow);
                ps.Add("FK_Frm", this.FK_MapData);
                DataTable dt = DBAccess.RunSQLReturnTable(ps);
                if (dt.Rows.Count == 0)
                {
                    athDesc.RetrieveFromDBSources();
                }
                else
                {
                    int sln = int.Parse(dt.Rows[0][0].ToString());
                    if (sln == 0)
                    {
                        athDesc.RetrieveFromDBSources();
                    }
                    else
                    {
                        int result = athDesc.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData,
                                                      FrmAttachmentAttr.FK_Node, this.FK_Node, FrmAttachmentAttr.NoOfObj, this.Ath);

                        if (result == 0) /*如果没有定义,就获取默认的.*/
                        {
                            athDesc.RetrieveFromDBSources();
                        }
                        //  throw new Exception("@该流程表单在该节点("+this.FK_Node+")使用的是自定义的权限控制,但是没有定义该附件的权限。");
                    }
                }
                #endregion 处理权限方案。
            }

            BP.Sys.FrmAttachmentDBs dbs = new BP.Sys.FrmAttachmentDBs();
            if (athDesc.HisCtrlWay == AthCtrlWay.PWorkID)
            {
                string pWorkID = BP.DA.DBAccess.RunSQLReturnValInt("SELECT PWorkID FROM WF_GenerWorkFlow WHERE WorkID=" + this.PKVal, 0).ToString();
                if (pWorkID == null || pWorkID == "0")
                {
                    pWorkID = this.PKVal;
                }

                if (athDesc.AthUploadWay == AthUploadWay.Inherit)
                {
                    /* 继承模式 */
                    BP.En.QueryObject qo = new BP.En.QueryObject(dbs);
                    qo.AddWhere(FrmAttachmentDBAttr.RefPKVal, pWorkID);
                    qo.addOr();
                    qo.AddWhere(FrmAttachmentDBAttr.RefPKVal, int.Parse(this.PKVal));
                    qo.addOrderBy("RDT");
                    qo.DoQuery();
                }

                if (athDesc.AthUploadWay == AthUploadWay.Interwork)
                {
                    /*共享模式*/
                    dbs.Retrieve(FrmAttachmentDBAttr.RefPKVal, pWorkID);
                }
            }
            else
            {
                int num = dbs.Retrieve(FrmAttachmentDBAttr.FK_FrmAttachment, this.FK_FrmAttachment,
                                       FrmAttachmentDBAttr.RefPKVal, this.PKVal, "RDT");
                if (num == 0 && this.IsCC == "1")
                {
                    CCList cc  = new CCList();
                    int    nnn = cc.Retrieve(CCListAttr.FK_Node, this.FK_Node, CCListAttr.WorkID, this.WorkID, CCListAttr.CCTo, WebUser.No);
                    if (cc.NDFrom != 0)
                    {
                        this._fk_node = cc.NDFrom;

                        dbs.Retrieve(FrmAttachmentDBAttr.FK_FrmAttachment, this.FK_FrmAttachmentExt,
                                     FrmAttachmentDBAttr.FK_MapData, "ND" + cc.NDFrom, FrmAttachmentDBAttr.RefPKVal, this.WorkID.ToString());

                        //重新设置文件描述。
                        athDesc.Retrieve(FrmAttachmentAttr.FK_MapData, this.FK_MapData, FrmAttachmentAttr.NoOfObj, "DocMultiAth");
                    }
                }
            }

            #endregion 处理权限控制.

            #region 生成表头表体.
            this.Title = athDesc.Name;

            #region 如果图片显示.
            if (athDesc.FileShowWay == FileShowWay.Pict)
            {
                /* 如果是图片轮播,就在这里根据数据输出轮播的html代码.*/
                if (dbs.Count == 0 && athDesc.IsUpload == true)
                {
                    /*没有数据并且,可以上传,就转到上传的界面上去.*/
                    this.Response.Redirect("AttachmentUploadImg.aspx?1=1" + this.RequestParas, true);
                    return;
                }

                if (dbs.Count != 0)
                {
                    /*有数据,就输出.*/
                    this.Pub1.Add("<div class='slideBox' id='" + athDesc.MyPK + "' style='width:" + athDesc.W + "px;height:" + athDesc.H + "px; position:relative;  overflow:hidden;'>");
                    this.Pub1.Add("<ul class='items'> ");
                    foreach (FrmAttachmentDB db in dbs)
                    {
                        if (BP.DA.DataType.IsImgExt(db.FileExts) == false)
                        {
                            continue;
                        }
                        if (athDesc.IsDelete != false)
                        {
                            if (athDesc.IsDelete == true)
                            {
                                this.Pub1.Add("<li> <a  title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> | <a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a></li>");
                            }
                            else if (athDesc.IsDeleteInt == 2)
                            {
                                if (db.Rec.Equals(WebUser.No))
                                {
                                    this.Pub1.Add("<li> <a  title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> | <a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a></li>");
                                }
                            }
                            else
                            {
                                this.Pub1.Add("<li> <a  title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> </li>");
                            }
                        }
                        else
                        {
                            this.Pub1.Add("<li> <a  title='" + db.MyNote + "'><img src = '" + db.FileFullName + "' width=" + athDesc.W + " height=" + athDesc.H + "/></a> </li>");
                        }
                    }
                    this.Pub1.Add("</ul>");
                    this.Pub1.Add("</div>");
                    this.Pub1.Add("<script>$(function(){$('#" + athDesc.MyPK + "').slideBox({duration : 0.3,easing : 'linear',delay : 5,hideClickBar : false,clickBarRadius : 10});})</script>");
                }

                if (athDesc.IsUpload == true)
                {
                    /*可以上传,就显示上传的按钮.. */
                    this.Pub1.Add("<a href='AttachmentUploadImg.aspx?1=1" + this.RequestParas + "' >上传</a>");
                }
                return;
            }
            #endregion 如果图片显示.


            float athWidth = athDesc.W - 20;
            // 执行装载模版.
            if (dbs.Count == 0 && athDesc.IsWoEnableTemplete == true)
            {
                /*如果数量为0,就检查一下是否有模版如果有就加载模版文件.*/
                string templetePath = BP.Sys.SystemConfig.PathOfDataUser + "AthTemplete\\" + athDesc.NoOfObj.Trim();
                if (Directory.Exists(templetePath) == false)
                {
                    Directory.CreateDirectory(templetePath);
                }

                /*有模版文件夹*/
                DirectoryInfo mydir = new DirectoryInfo(templetePath);
                FileInfo[]    fls   = mydir.GetFiles();
                if (fls.Length == 0)
                {
                    throw new Exception("@流程设计错误,该多附件启用了模版组件,模版目录:" + templetePath + "里没有模版文件.");
                }

                foreach (FileInfo fl in fls)
                {
                    if (System.IO.Directory.Exists(athDesc.SaveTo) == false)
                    {
                        System.IO.Directory.CreateDirectory(athDesc.SaveTo);
                    }

                    int    oid    = BP.DA.DBAccess.GenerOID();
                    string saveTo = athDesc.SaveTo + "\\" + oid + "." + fl.Name.Substring(fl.Name.LastIndexOf('.') + 1);
                    if (saveTo.Contains("@") == true || saveTo.Contains("*") == true)
                    {
                        /*如果有变量*/
                        saveTo = saveTo.Replace("*", "@");
                        if (saveTo.Contains("@") && this.FK_Node != null)
                        {
                            /*如果包含 @ */
                            BP.WF.Flow       flow = new BP.WF.Flow(this.FK_Flow);
                            BP.WF.Data.GERpt myen = flow.HisGERpt;
                            myen.OID = this.WorkID;
                            myen.RetrieveFromDBSources();
                            saveTo = BP.WF.Glo.DealExp(saveTo, myen, null);
                        }
                        if (saveTo.Contains("@") == true)
                        {
                            throw new Exception("@路径配置错误,变量没有被正确的替换下来." + saveTo);
                        }
                    }
                    fl.CopyTo(saveTo);

                    FileInfo        info     = new FileInfo(saveTo);
                    FrmAttachmentDB dbUpload = new FrmAttachmentDB();

                    dbUpload.CheckPhysicsTable();
                    dbUpload.MyPK             = athDesc.FK_MapData + oid.ToString();
                    dbUpload.NodeID           = FK_Node.ToString();
                    dbUpload.FK_FrmAttachment = this.FK_FrmAttachment;

                    if (athDesc.AthUploadWay == AthUploadWay.Inherit)
                    {
                        /*如果是继承,就让他保持本地的PK. */
                        dbUpload.RefPKVal = this.PKVal.ToString();
                    }

                    if (athDesc.AthUploadWay == AthUploadWay.Interwork)
                    {
                        /*如果是协同,就让他是PWorkID. */
                        string pWorkID = BP.DA.DBAccess.RunSQLReturnValInt("SELECT PWorkID FROM WF_GenerWorkFlow WHERE WorkID=" + this.PKVal, 0).ToString();
                        if (pWorkID == null || pWorkID == "0")
                        {
                            pWorkID = this.PKVal;
                        }
                        dbUpload.RefPKVal = pWorkID;
                    }

                    dbUpload.FK_MapData       = athDesc.FK_MapData;
                    dbUpload.FK_FrmAttachment = this.FK_FrmAttachment;

                    dbUpload.FileExts     = info.Extension;
                    dbUpload.FileFullName = saveTo;
                    dbUpload.FileName     = fl.Name;
                    dbUpload.FileSize     = (float)info.Length;

                    dbUpload.RDT     = DataType.CurrentDataTime;
                    dbUpload.Rec     = BP.Web.WebUser.No;
                    dbUpload.RecName = BP.Web.WebUser.Name;
                    //if (athDesc.IsNote)
                    //    dbUpload.MyNote = this.Pub1.GetTextBoxByID("TB_Note").Text;
                    //if (athDesc.Sort.Contains(","))
                    //    dbUpload.Sort = this.Pub1.GetDDLByID("ddl").SelectedItemStringVal;

                    dbUpload.Insert();

                    dbs.AddEntity(dbUpload);
                }
                //BP.Sys.FrmAttachmentDBs dbs = new BP.Sys.FrmAttachmentDBs();
            }

            #region 处理权限问题.
            // 处理权限问题, 有可能当前节点是可以上传或者删除,但是当前节点上不能让此人执行工作。
            bool isDel    = athDesc.IsDeleteInt == 0 ? false : true;
            bool isUpdate = athDesc.IsUpload;
            if (isDel == true || isUpdate == true)
            {
                if (this.WorkID != 0 &&
                    string.IsNullOrEmpty(this.FK_Flow) == false &&
                    this.FK_Node != 0)
                {
                    isDel = BP.WF.Dev2Interface.Flow_IsCanDoCurrentWork(this.FK_Flow, this.FK_Node, this.WorkID, WebUser.No);
                    if (isDel == false)
                    {
                        isUpdate = false;
                    }
                }
            }
            #endregion 处理权限问题.

            if (athDesc.FileShowWay == FileShowWay.Free)
            {
                this.Pub1.AddTable("border='0' cellspacing='0' cellpadding='0' style='width:" + athWidth + "px'");
                foreach (FrmAttachmentDB db in dbs)
                {
                    this.Pub1.AddTR();
                    if (CanEditor(db.FileExts))
                    {
                        if (athDesc.IsWoEnableWF)
                        {
                            this.Pub1.AddTD("<a href=\"javascript:OpenOfiice('" + this.FK_FrmAttachment + "','" +
                                            this.WorkID + "','" + db.MyPK + "','" + this.FK_MapData + "','" + this.Ath +
                                            "','" + this.FK_Node + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                        }
                        else
                        {
                            this.Pub1.AddTD("<a href=\"javascript:OpenView('" + this.PKVal + "','" + db.MyPK +
                                            "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                        }
                    }
                    else if (DataType.IsImgExt(db.FileExts) || db.FileExts.ToUpper() == "PDF" || db.FileExts.ToUpper() == "CEB")
                    {
                        this.Pub1.AddTD("<a href=\"javascript:OpenView('" + this.PKVal + "','" + db.MyPK +
                                        "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                    }
                    else
                    {
                        this.Pub1.AddTD("<a href='AttachmentUpload.aspx?DoType=Down&MyPK=" + db.MyPK +
                                        "' target=_blank ><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                    }

                    if (athDesc.IsDownload)
                    {
                        this.Pub1.AddTD("<a href=\"javascript:Down('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">下载</a>");
                    }
                    else
                    {
                        this.Pub1.AddTD("");
                    }

                    if (this.IsReadonly != "1")
                    {
                        if (athDesc.IsDelete != false)
                        {
                            if (athDesc.IsDelete == true)
                            {
                                this.Pub1.AddTD("style='border:0px'", "<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>");
                            }
                            else if (athDesc.IsDeleteInt == 2)
                            {
                                if (db.Rec.Equals(WebUser.No))
                                {
                                    this.Pub1.AddTD("style='border:0px'", "<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>");
                                }
                            }
                            else
                            {
                                this.Pub1.AddTD("");
                            }
                        }
                        else
                        {
                            this.Pub1.AddTD("");
                        }
                    }
                    else
                    {
                        this.Pub1.AddTD("");
                        this.Pub1.AddTD("");
                    }

                    this.Pub1.AddTREnd();
                }
                AddFileUpload(isUpdate, athDesc);
                this.Pub1.AddTableEnd();
                return;
            }

            this.Pub1.AddTable("border='0' cellspacing='0' cellpadding='0' style='width:" + athWidth + "px'");
            if (athDesc.IsShowTitle == true)
            {
                this.Pub1.AddTR("style='border:0px'");

                this.Pub1.AddTDTitleExt("序号");
                if (athDesc.Sort.Contains(","))
                {
                    this.Pub1.AddTD("style='background:#f4f4f4; font-size:12px; padding:3px;'", "类别");
                }
                this.Pub1.AddTDTitleExt("文件名");
                this.Pub1.AddTDTitleExt("大小KB");
                this.Pub1.AddTDTitleExt("上传时间");
                this.Pub1.AddTDTitleExt("上传人");
                this.Pub1.AddTDTitleExt("操作");
                this.Pub1.AddTREnd();
            }

            int           i       = 0;
            StringBuilder picHtml = new StringBuilder();
            foreach (FrmAttachmentDB db in dbs)
            {
                i++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(i);
                if (athDesc.Sort.Contains(","))
                {
                    this.Pub1.AddTD(db.Sort);
                }

                // this.Pub1.AddTDIdx(i++);
                if (athDesc.IsDownload)
                {
                    if (athDesc.IsWoEnableWF && CanEditor(db.FileExts))
                    {
                        this.Pub1.AddTD("<a href=\"javascript:OpenOfiice('" + this.FK_FrmAttachment + "','" + this.WorkID + "','" + db.MyPK + "','" + this.FK_MapData + "','" + this.Ath + "','" + this.FK_Node + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                    }
                    else if (db.FileExts.ToUpper() == "TXT" || db.FileExts.ToUpper() == "JPG" || db.FileExts.ToUpper() == "JPEG" || db.FileExts.ToUpper() == "GIF" || db.FileExts.ToUpper() == "PNG" || db.FileExts.ToUpper() == "BMP" || db.FileExts.ToUpper() == "PDF" || db.FileExts.ToUpper() == "CEB")
                    {
                        this.Pub1.AddTD("<a href=\"javascript:OpenView('" + this.PKVal + "','" + db.MyPK + "')\"><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                    }
                    else
                    {
                        this.Pub1.AddTD("<a href='AttachmentUpload.aspx?DoType=Down&MyPK=" + db.MyPK + "' target=_blank ><img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName + "</a>");
                    }
                }
                else
                {
                    this.Pub1.AddTD("<img src='../Img/FileType/" + db.FileExts + ".gif' border=0 onerror=\"src='../Img/FileType/Undefined.gif'\" />" + db.FileName);
                }

                this.Pub1.AddTD(db.FileSize);
                this.Pub1.AddTD(db.RDT);
                this.Pub1.AddTD(db.RecName);

                //输出操作部分.
                this.Pub1.AddTDBegin();
                if (athDesc.IsDownload)
                {
                    this.Pub1.Add("<a href=\"javascript:Down('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">下载</a>");
                }
                if (this.IsReadonly != "1")
                {
                    string op = null;
                    if (isDel == true)
                    {
                        if (athDesc.IsDelete == true)
                        {
                            op = "&nbsp;&nbsp;&nbsp;<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>";
                        }
                        else if (athDesc.IsDeleteInt == 2)
                        {
                            if (db.Rec.Equals(WebUser.No))
                            {
                                op = "&nbsp;&nbsp;&nbsp;<a href=\"javascript:Del('" + this.FK_FrmAttachment + "','" + this.PKVal + "','" + db.MyPK + "')\">删除</a>";
                            }
                        }
                    }

                    this.Pub1.Add(op);
                }
                this.Pub1.AddTDEnd();

                this.Pub1.AddTREnd();
            }
            if (i == 0)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTD("0");
                if (athDesc.Sort.Contains(","))
                {
                    this.Pub1.AddTD("&nbsp&nbsp");
                }
                this.Pub1.AddTD("style='width:100px'", "<span style='color:red;' >上传附件</span>");
                this.Pub1.AddTD("&nbsp&nbsp");
                this.Pub1.AddTD("&nbsp&nbsp");
                this.Pub1.AddTD("&nbsp&nbsp");
                this.Pub1.AddTD("&nbsp&nbsp");
                this.Pub1.AddTREnd();
            }

            AddFileUpload(isUpdate, athDesc);
            this.Pub1.AddTableEnd();

            #endregion 生成表头表体.
        }