public string TBFullCtrlDDL_Init()
        {
            MapExt myme = new MapExt();

            myme.MyPK = this.MyPK;
            myme.RetrieveFromDBSources();
            MapAttrs attrs = new MapAttrs(myme.FK_MapData);

            attrs.Retrieve(MapAttrAttr.FK_MapData, this.FK_MapData,
                           MapAttrAttr.UIIsEnable, 1, MapAttrAttr.UIContralType, (int)UIContralType.DDL);

            string[] strs = myme.Tag.Split('$');
            foreach (MapAttr attr in attrs)
            {
                foreach (string s in strs)
                {
                    if (s == null)
                    {
                        continue;
                    }
                    if (s.Contains(attr.KeyOfEn + ":") == false)
                    {
                        continue;
                    }

                    string[] ss = s.Split(':');
                    attr.DefVal = ss[1]; //使用这个字段作为对应设置的sql.
                }
            }

            return(attrs.ToJson());
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                MapAttr mattrNew = new MapAttr(this.RefNo);

                MapExt me = new MapExt();
                me.MyPK = this.RefNo + "_AutoFull";
                me.RetrieveFromDBSources();
                me.FK_MapData = this.FK_MapData;
                me.AttrOfOper = mattrNew.KeyOfEn;
                me.ExtType    = MapExtXmlList.AutoFull;
                if (me.Tag == "0")
                {
                    this.RB_0.Checked = true;
                    this.TB_Exp.Text  = "";
                }
                else
                {
                    this.RB_0.Checked = false;
                }

                if (me.Tag == "1")
                {
                    this.RB_1.Checked = true;
                }
                else
                {
                    this.RB_1.Checked = false;
                }

                this.TB_Exp.Text = me.Doc;
            }
        }
示例#3
0
        protected void Btn_Save_Click(object sender, EventArgs e)
        {
            BP.Sys.MapExt me = new MapExt();
            if (this.MyPK != null)
            {
                me.MyPK = this.MyPK;
                me.RetrieveFromDBSources();

                me.FK_MapData = this.FK_MapData;
                me.Doc        = this.Fields;
                me.ExtType    = "Sepc" + this.DoType + "SepcUsers";
                me.Tag        = this.FK_Node;
                me.Tag1       = this.TB_Emps.Text;
                me.Update();
            }
            else
            {
                me.MyPK = BP.DA.DBAccess.GenerGUID();

                me.FK_MapData = this.FK_MapData;
                me.Doc        = this.Fields;
                me.Tag        = this.FK_Node;
                me.Tag1       = this.TB_Emps.Text;
                me.ExtType    = "Sepc" + this.DoType + "SepcUsers";
                me.Insert();
            }

            this.WinClose("设置成功.");
        }
示例#4
0
        /// <summary>
        /// 保存它
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btn_SavePageLoadFull_Click(object sender, EventArgs e)
        {
            MapExt me = new MapExt();

            me.MyPK       = this.FK_MapData + "_" + MapExtXmlList.PageLoadFull;
            me.FK_MapData = this.FK_MapData;
            me.ExtType    = MapExtXmlList.PageLoadFull;
            me.RetrieveFromDBSources();

            me.Tag = this.Pub1.GetTextBoxByID("TB_" + MapExtAttr.Tag).Text;
            string  sql  = "";
            MapDtls dtls = new MapDtls(this.FK_MapData);

            foreach (MapDtl dtl in dtls)
            {
                sql += "*" + dtl.No + "=" + this.Pub1.GetTextBoxByID("TB_" + dtl.No).Text;
            }
            me.Tag1 = sql;

            me.MyPK = this.FK_MapData + "_" + MapExtXmlList.PageLoadFull;

            string info = me.Tag1 + me.Tag;

            if (string.IsNullOrEmpty(info))
            {
                me.Delete();
            }
            else
            {
                me.Save();
            }
        }
示例#5
0
        protected void Btn_OK_Click(object sender, EventArgs e)
        {
            me      = new MapExt();
            me.MyPK = this.FK_MapExt;

            if (me.RetrieveFromDBSources() == 0)
            {
                BP.Web.Controls.FrmPopVal pv = new BP.Web.Controls.FrmPopVal(this.FK_MapExt);
                me.Copy(pv);
            }

            int    popValFormat = me.PopValFormat;
            string val          = "";

            foreach (Control ctl in this.Pub1.Controls)
            {
                CheckBox cb = ctl as CheckBox;
                if (cb == null)
                {
                    continue;
                }
                if (cb.ID.Contains("CBs_"))
                {
                    continue;
                }
                if (cb.Checked == false)
                {
                    continue;
                }
                string text = cb.Text.Replace("<font color=green>", "");
                text = cb.Text.Replace("</font>", "");
                switch (popValFormat)
                {
                case 0:      //仅仅编号
                    val += "," + cb.ID.Replace("CB_", "");
                    break;

                case 1:     // 仅名称
                    val += "," + text;
                    break;

                case 2:     // 编号与名称
                    val += "," + cb.ID.Replace("CB_", "") + "," + text;
                    break;

                default:
                    break;
                }
            }
            val = val.Replace("<font color=green>", "");
            val = val.Replace("</font>", "");

            if (val.Length > 2)
            {
                val = val.Substring(1);
            }
            this.WinClose(val);
        }
示例#6
0
        void btn_SaveAutoFull_Click(object sender, EventArgs e)
        {
            MapExt me = new MapExt();

            //删除指定的数据,避免插入重复.
            me.Delete(MapExtAttr.FK_MapData, this.FK_MapData, MapExtAttr.ExtType, this.ExtType, MapExtAttr.AttrOfOper, this.RefNo);

            me.MyPK = this.MyPK;
            if (me.MyPK.Length > 2)
            {
                me.RetrieveFromDBSources();
            }

            me            = (MapExt)this.Pub1.Copy(me);
            me.ExtType    = this.ExtType;
            me.Doc        = this.Pub1.GetTextBoxByID("TB_Doc").Text;
            me.AttrOfOper = this.RefNo;
            me.FK_MapData = this.FK_MapData;
            me.MyPK       = this.FK_MapData + "_" + me.ExtType + "_" + me.AttrOfOper;
            try
            {
                //DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(me.Doc);
                //if (string.IsNullOrEmpty(me.Tag) == false)
                //{
                //    dt = BP.DA.DBAccess.RunSQLReturnTable(me.Tag);
                //    if (dt.Columns.Contains("Name") == false || dt.Columns.Contains("No") == false)
                //        throw new Exception("在您的sql表达式里,必须有No,Name 还两个列。");
                //}

                //if (this.ExtType == MapExtXmlList.TBFullCtrl)
                //{
                //    if (dt.Columns.Contains("Name") == false || dt.Columns.Contains("No") == false)
                //        throw new Exception("在您的sql表达式里,必须有No,Name 还两个列。");
                //}

                //MapAttrs attrs = new MapAttrs(this.FK_MapData);
                //foreach (DataColumn dc in dt.Columns)
                //{
                //    if (dc.ColumnName.ToLower() == "no" || dc.ColumnName.ToLower() == "name")
                //        continue;

                //    if (attrs.Contains(MapAttrAttr.KeyOfEn, dc.ColumnName) == false)
                //        throw new Exception("@系统没有找到您要匹配的列(" + dc.ColumnName + "),注意:您要指定的列名区分大小写。");
                //}
                me.Save();
            }
            catch (Exception ex)
            {
                this.Pub1.AlertMsg_Warning("SQL错误", ex.Message);
                return;
            }
            this.Response.Redirect("TBFullCtrl.aspx?FK_MapData=" + this.FK_MapData + "&RefNo=" + this.RefNo + "&MyPK=" + this.MyPK + "", true);
        }
示例#7
0
        void btn_SaveJiLian_Click(object sender, EventArgs e)
        {
            MapExt me = new MapExt();

            me.MyPK = this.MyPK;
            if (me.MyPK.Length > 2)
            {
                me.RetrieveFromDBSources();
            }
            me               = (MapExt)this.Pub1.Copy(me);
            me.ExtType       = this.ExtType;
            me.Doc           = this.Pub1.GetTextBoxByID("TB_Doc").Text;
            me.AttrOfOper    = this.RefNo;
            me.AttrsOfActive = this.Pub1.GetDDLByID("DDL_Attr").SelectedItemStringVal;
            if (me.AttrsOfActive == me.AttrOfOper)
            {
                this.Alert("两个项目不能相同.");
                return;
            }
            try
            {
                if (this.Pub1.GetRadioButtonByID("RB_1").Checked)
                {
                    me.DoWay = 1;
                }
                else
                {
                    me.DoWay = 0;
                }
            }
            catch
            {
                me.DoWay = 0;
            }

            me.FK_MapData = this.FK_MapData;
            try
            {
                me.MyPK = this.FK_MapData + "_" + me.ExtType + "_" + me.AttrOfOper + "_" + me.AttrsOfActive;
                if (me.Doc.Contains("No") == false || me.Doc.Contains("Name") == false)
                {
                    throw new Exception("在您的SQL表达式里,必须有No,Name 还两个列,分别标识编码与名称。");
                }
                me.Save();
            }
            catch (Exception ex)
            {
                this.Alert(ex.Message);
                return;
            }
            this.Response.Redirect("ActiveDDL.aspx?FK_MapData=" + this.FK_MapData + "&ExtType=" + this.ExtType + "&RefNo=" + this.RefNo + "&MyPK=" + me.MyPK, true);
        }
示例#8
0
        protected void Btn_Save_Click(object sender, EventArgs e)
        {
            MapExt me = new MapExt();

            me.MyPK = this.FK_MapData + "_" + me.ExtType + "_" + me.AttrOfOper;
            me.RetrieveFromDBSources();
            me.ExtType    = this.ExtType;
            me.Doc        = this.TB_SQL.Text;
            me.AttrOfOper = this.RefNo;
            me.FK_MapData = this.FK_MapData;
            me.FK_DBSrc   = this.DDL_DBSrc.SelectedValue;
            me.Save();
        }
示例#9
0
        /// <summary>
        /// 返回
        /// </summary>
        /// <returns></returns>
        public string PopVal_Init()
        {
            MapExt ext = new MapExt();

            ext.MyPK = this.MyPK;
            if (ext.RetrieveFromDBSources() == 0)
            {
                // throw new Exception("err@主键=" + ext.MyPK + "的配置数据丢失");
                ext.PopValSelectModel = PopValSelectModel.One;
                ext.PopValWorkModel   = PopValWorkModel.TableOnly;
            }

            // ext.SetValByKey
            return(ext.PopValToJson());
        }
示例#10
0
        protected void Btn_Save_Click(object sender, EventArgs e)
        {
            MapAttr mattrNew = new MapAttr(this.RefNo);

            MapExt me = new MapExt();

            me.MyPK = this.RefNo + "_AutoFull";
            me.RetrieveFromDBSources();
            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = mattrNew.KeyOfEn;
            me.ExtType    = MapExtXmlList.AutoFull;
            if (this.RB_0.Checked)
            {
                me.Tag           = "0";
                this.TB_Exp.Text = "";
                me.Doc           = "";
            }

            if (this.RB_1.Checked)
            {
                me.Tag = "1";
                me.Doc = this.TB_Exp.Text;

                /*检查字段是否填写正确.*/
                MapAttrs attrsofCheck = new MapAttrs(this.FK_MapData);
                string   docC         = me.Doc;
                foreach (MapAttr attrC in attrsofCheck)
                {
                    if (attrC.IsNum == false)
                    {
                        continue;
                    }
                    docC = docC.Replace("@" + attrC.KeyOfEn, "");
                    docC = docC.Replace("@" + attrC.Name, "");
                }

                if (docC.Contains("@"))
                {
                    this.Alert("您填写的表达公式不正确,导致一些数值类型的字段没有被正确的替换。" + docC);
                    return;
                }
            }
            me.Save();
        }
示例#11
0
        public int BindRegularExpressionEditExt(int idx, string myEvent)
        {
            // 查询.
            MapExt me = new MapExt();

            me.FK_MapData = this.FK_MapData;
            me.Tag        = myEvent;
            me.AttrOfOper = this.RefNo;
            me.MyPK       = me.FK_MapData + "_" + this.RefNo + "_" + this.ExtType + "_" + myEvent;
            me.RetrieveFromDBSources();

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx);
            this.Pub1.AddTD("style='font-size:12px'", myEvent);

            TextBox tb = new TextBox();

            tb.TextMode = TextBoxMode.MultiLine;
            tb.ID       = "TB_Doc_" + myEvent;
            tb.Text     = me.Doc;
            tb.Columns  = 50;
            tb.Rows     = 1;
            tb.Style.Add("width", "99%");
            this.Pub1.AddTD(tb);

            tb         = new TextBox();
            tb.ID      = "TB_Tag1_" + myEvent;
            tb.Text    = me.Tag1;
            tb.Columns = 20;
            tb.Rows    = 3;
            tb.Style.Add("width", "99%");
            this.Pub1.AddTD(tb);
            this.Pub1.AddTREnd();
            idx = idx + 1;
            return(idx);
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            me      = new MapExt();
            me.MyPK = this.FK_MapExt;

            if (me.RetrieveFromDBSources() == 0)
            {
                BP.Web.Controls.FrmPopVal pv = new BP.Web.Controls.FrmPopVal(this.FK_MapExt);
                me.Copy(pv);
            }

            string sqlGroup = me.Tag1;

            sqlGroup = sqlGroup.Replace("@WebUser.No", BP.Web.WebUser.No);
            sqlGroup = sqlGroup.Replace("@WebUser.Name", BP.Web.WebUser.Name);
            sqlGroup = sqlGroup.Replace("@WebUser.FK_Dept", BP.Web.WebUser.FK_Dept);
            DataTable dtGroup = DBAccess.RunSQLReturnTable(sqlGroup);

            if (dtGroup.Rows.Count == 0)
            {
                this.Pub1.AddFieldSet("配置错误", "分组数据源为空:" + sqlGroup);
                return;
            }

            this.Left.AddUL();
            foreach (DataRow dr in dtGroup.Rows)
            {
                string no   = dr[0].ToString();
                string name = dr[1].ToString();
                this.Left.AddLi("<a href='FrmPopValDir.aspx?GroupVal=" + no + "&FK_MapExt=" + this.FK_MapExt + "&RefPK=" + this.RefPK + "&CtrlVal=" + this.CtrlVal + "' >" + dr[1].ToString() + "</a>");
            }
            this.Left.AddULEnd();


            string gVal = this.GroupVal;

            if (string.IsNullOrEmpty(gVal))
            {
                gVal = dtGroup.Rows[0][0].ToString();
            }
            string sqlObjs = me.Tag2;

            sqlObjs = sqlObjs.Replace("@WebUser.No", BP.Web.WebUser.No);
            sqlObjs = sqlObjs.Replace("@WebUser.Name", BP.Web.WebUser.Name);
            sqlObjs = sqlObjs.Replace("@WebUser.FK_Dept", BP.Web.WebUser.FK_Dept);
            sqlObjs = sqlObjs.Replace("@GroupVal", gVal);
            DataTable dtObjs = DBAccess.RunSQLReturnTable(sqlObjs);

            bool isCheckbox = false;

            if (me.PopValSelectModel == 1)
            {
                isCheckbox = true;
            }

            foreach (DataRow dr in dtObjs.Rows)
            {
                string no   = dr[0].ToString();
                string name = dr[1].ToString();

                if (isCheckbox == true)
                {
                    CheckBox cb = new CheckBox();
                    cb.ID   = "CB_" + no;
                    cb.Text = name;
                    this.Pub1.Add(cb);
                }
                else
                {
                    RadioButton rb = new RadioButton();
                    rb.ID        = "RB_" + no;
                    rb.Text      = name;
                    rb.GroupName = "ss";
                    this.Pub1.Add(rb);
                }
            }

            if (dtObjs.Rows.Count == 0)
            {
                this.Pub1.AddFieldSet("配置或者数据源错误", "查询的entity是空的:" + sqlObjs);
            }
        }
示例#13
0
        /// <summary>
        /// BindPageLoadFull
        /// </summary>
        public void BindPageLoadFull()
        {
            MapExt me = new MapExt();

            me.MyPK = this.FK_MapData + "_" + MapExtXmlList.PageLoadFull;
            me.RetrieveFromDBSources();

            this.Pub1.AddTable("class='Table' cellspacing='0' cellpadding='0' border='0' style='width:100%'");
            this.Pub1.AddTR();
            this.Pub1.AddTDGroupTitle("主表SQL设置" + BP.WF.Glo.GenerHelpCCForm("帮助", "", ""));
            this.Pub1.AddTREnd();

            TextBox tb = new TextBox();

            tb.ID       = "TB_" + MapExtAttr.Tag;
            tb.Text     = me.Tag;
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 7;
            tb.Columns  = 70;
            tb.Style.Add("width", "99%");

            this.Pub1.AddTR();
            this.Pub1.AddTDBegin();
            this.Pub1.Add(tb);
            this.Pub1.AddBR();
            this.Pub1.Add("说明:填充主表的sql,表达式里支持@变量与约定的公用变量。 <br>比如: SELECT No,Name,Tel FROM Port_Emp WHERE No='@WebUser.No' , 如果列名与开始表单字段名相同,就会自动给值。");
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            MapDtls dtls = new MapDtls(this.FK_MapData);

            if (dtls.Count != 0)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTDGroupTitle("明细表SQL设置");
                this.Pub1.AddTREnd();

                string[] sqls = me.Tag1.Split('*');
                foreach (MapDtl dtl in dtls)
                {
                    this.Pub1.AddTR();
                    this.Pub1.AddTD("明细表:[" + dtl.No + "]&nbsp;" + dtl.Name);
                    this.Pub1.AddTREnd();
                    tb    = new TextBox();
                    tb.ID = "TB_" + dtl.No;
                    foreach (string sql in sqls)
                    {
                        if (string.IsNullOrEmpty(sql))
                        {
                            continue;
                        }
                        string key = sql.Substring(0, sql.IndexOf('='));
                        if (key == dtl.No)
                        {
                            tb.Text = sql.Substring(sql.IndexOf('=') + 1);
                            break;
                        }
                    }

                    tb.TextMode = TextBoxMode.MultiLine;
                    tb.Rows     = 5;
                    tb.Columns  = 70;
                    tb.Style.Add("width", "99%");

                    this.Pub1.AddTR();
                    this.Pub1.AddTDBegin();
                    this.Pub1.Add(tb);
                    this.Pub1.AddBR();
                    this.Pub1.Add("说明:结果集合填充从表");
                    this.Pub1.AddTREnd();
                }
            }

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

            btn.Click += new EventHandler(btn_SavePageLoadFull_Click);

            this.Pub1.AddTR();
            this.Pub1.AddTD(btn);
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
            return;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btn_Click(object sender, EventArgs e)
        {
            MapAttr mattrNew = new MapAttr(this.RefNo);

            MapExt me = new MapExt();

            me.MyPK = this.RefNo + "_AutoFull";
            me.RetrieveFromDBSources();
            me.FK_MapData = this.FK_MapData;
            me.AttrOfOper = mattrNew.KeyOfEn;
            me.ExtType    = MapExtXmlList.AutoFull;
            if (this.Pub1.GetRadioButtonByID("RB_Way_0").Checked)
            {
                me.Tag = "0";
            }

            // JS 方式。
            if (this.Pub1.GetRadioButtonByID("RB_Way_1").Checked)
            {
                me.Tag = "1";
                me.Doc = this.Pub1.GetTextBoxByID("TB_JS").Text;

                /*检查字段是否填写正确.*/
                MapAttrs attrsofCheck = new MapAttrs(this.FK_MapData);
                string   docC         = me.Doc;
                foreach (MapAttr attrC in attrsofCheck)
                {
                    if (attrC.IsNum == false)
                    {
                        continue;
                    }
                    docC = docC.Replace("@" + attrC.KeyOfEn, "");
                    docC = docC.Replace("@" + attrC.Name, "");
                }

                if (docC.Contains("@"))
                {
                    this.Alert("您填写的表达公式不正确,导致一些数值类型的字段没有被正确的替换。" + docC);
                    return;
                }
            }

            // 外键方式。
            if (this.Pub1.GetRadioButtonByID("RB_Way_2").Checked)
            {
                me.Tag = "2";
                me.Doc = this.Pub1.GetTextBoxByID("TB_SQL").Text;

                //mattr.HisAutoFull = AutoFullWay.Way2_SQL;
                //mattr.AutoFullDoc = this.Pub1.GetTextBoxByID("TB_SQL").Text;
            }

            // 本表单中外键列。
            string doc = "";

            if (this.Pub1.GetRadioButtonByID("RB_Way_3").Checked)
            {
                me.Tag = "3";

                // mattr.HisAutoFull = AutoFullWay.Way3_FK;
                MapData md    = new MapData(this.FK_MapData);
                Attrs   attrs = md.GenerHisMap().HisFKAttrs;
                foreach (Attr attr in attrs)
                {
                    if (attr.IsRefAttr)
                    {
                        continue;
                    }

                    if (this.Pub1.GetRadioButtonByID("RB_FK_" + attr.Key).Checked == false)
                    {
                        continue;
                    }
                    // doc = " SELECT " + this.Pub1.GetDDLByID("DDL_" + attr.Key).SelectedValue + " FROM " + attr.HisFKEn.EnMap.PhysicsTable + " WHERE NO=@" + attr.Key;
                    doc = "@AttrKey=" + attr.Key + "@Field=" + this.Pub1.GetDDLByID("DDL_" + attr.Key).SelectedValue + "@Table=" + attr.HisFKEn.EnMap.PhysicsTable;
                }
                me.Doc = doc;
            }

            // 本表单中从表列。
            if (this.Pub1.GetRadioButtonByID("RB_Way_4").Checked)
            {
                me.Tag = "4";

                MapDtls dtls = new MapDtls(this.FK_MapData);
                //   mattr.HisAutoFull = AutoFullWay.Way4_Dtl;
                foreach (MapDtl dtl in dtls)
                {
                    try
                    {
                        if (this.Pub1.GetRadioButtonByID("RB_" + dtl.No).Checked == false)
                        {
                            continue;
                        }
                    }
                    catch
                    {
                        continue;
                    }
                    //  doc = "SELECT " + this.Pub1.GetDDLByID( "DDL_"+dtl.No + "_Way").SelectedValue + "(" + this.Pub1.GetDDLByID("DDL_"+dtl.No+"_F").SelectedValue + ") FROM " + dtl.No + " WHERE REFOID=@OID";
                    doc = "@Table=" + dtl.No + "@Field=" + this.Pub1.GetDDLByID("DDL_" + dtl.No + "_F").SelectedValue + "@Way=" + this.Pub1.GetDDLByID("DDL_" + dtl.No + "_Way").SelectedValue;
                }
                me.Doc = doc;
            }

            try
            {
                me.Save();
            }
            catch (Exception ex)
            {
                this.ResponseWriteRedMsg(ex);
                return;
            }

            this.Alert("保存成功");
            this.Pub1.Clear();
            //Button btn = sender as Button;
            var btn = sender as LinkBtn;

            if (btn.ID.Contains("Close"))
            {
                this.WinClose();
                return;
            }
            else
            {
                this.Response.Redirect(this.Request.RawUrl, true);
            }
        }
        public void BindNumType(MapAttr mattr_del)
        {
            MapExt me = new MapExt();

            me.MyPK = this.RefNo + "_AutoFull";
            me.RetrieveFromDBSources();

            //this.Pub1.AddTable("align=left");
            this.Pub1.AddTable("class='Table' cellpadding='0' cellspacing='0' border='0' style='width:100%'");
            //this.Pub1.AddCaptionLeft("数据获取 - 当一个字段值需要从其它表中得到时,请设置此功能。");
            this.Pub1.AddTRGroupTitle("数据获取 - 当一个字段值需要从其它表中得到时,请设置此功能。");
            this.Pub1.AddTR();
            //this.Pub1.Add("<TD>");
            this.Pub1.AddTDBegin();

            RadioBtn rb = new RadioBtn();

            rb.GroupName = "s";
            rb.Text      = "方式0:不做任何设置。";
            rb.ID        = "RB_Way_0";
            if (me.Tag == "0")
            {
                rb.Checked = true;
            }

            //this.Pub1.AddFieldSet(rb);
            //this.Pub1.Add(  "不做任何设置。");
            //this.Pub1.AddFieldSetEnd();

            this.Pub1.Add(rb);
            this.Pub1.AddBR();
            this.Pub1.Add("不做任何设置。");

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

            this.Pub1.AddTR();
            //this.Pub1.Add("<TD>");
            this.Pub1.AddTDBegin();

            rb           = new RadioBtn();
            rb.GroupName = "s";
            rb.Text      = "方式1:本表单中数据计算。"; //"";
            rb.ID        = "RB_Way_1";
            if (me.Tag == "1")
            {
                rb.Checked = true;
            }

            //this.Pub1.AddFieldSet(rb);
            //this.Pub1.Add( "比如:@单价*@数量");
            //this.Pub1.AddBR();
            this.Pub1.Add(rb);
            this.Pub1.AddBR();
            this.Pub1.Add("比如:@单价*@数量。");
            this.Pub1.AddBR();

            TextBox tb = new TextBox();

            tb.ID = "TB_JS";
            //tb.Width = 450;
            tb.Style.Add("width", "99%");
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 5;
            if (me.Tag == "1")
            {
                tb.Text = me.Doc;
            }

            this.Pub1.Add(tb);
            //this.Pub1.AddFieldSetEnd();
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            // 方式2 利用SQL自动填充
            this.Pub1.AddTR();
            //this.Pub1.Add("<TD>");
            this.Pub1.AddTDBegin();

            rb           = new RadioBtn();
            rb.GroupName = "s";
            rb.Text      = "方式2:利用SQL自动填充(此功能已经在ccflow5中取消,需要此功能的请把逻辑放入的节点或者表单事件里完成)。";
            rb.ID        = "RB_Way_2";
            rb.Enabled   = false;

            if (me.Tag == "2")
            {
                rb.Checked = true;
            }

            // if (mattr.HisAutoFull == AutoFullWay.Way2_SQL)

            //this.Pub1.AddFieldSet(rb);
            this.Pub1.Add(rb);
            this.Pub1.AddBR();
            this.Pub1.Add("比如:Select Addr From 商品表 WHERE No=@FK_Pro  FK_Pro是本表中的任意字段名<BR>");

            tb    = new TextBox();
            tb.ID = "TB_SQL";
            //tb.Width = 450;
            tb.Style.Add("width", "99%");
            tb.TextMode = TextBoxMode.MultiLine;
            tb.Rows     = 5;
            if (me.Tag == "2")
            {
                tb.Text = me.Doc;
            }

            this.Pub1.Add(tb);

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

            // 方式3 本表单中外键列
            this.Pub1.AddTR();
            //this.Pub1.Add("<TD>");
            this.Pub1.AddTDBegin();

            rb           = new RadioBtn();
            rb.GroupName = "s";
            rb.Text      = "方式3:本表单中外键列。";
            // rb.Text = "方式3:本表单中外键列</font></b>";
            rb.ID = "RB_Way_3";
            if (me.Tag == "3")
            {
                rb.Checked = true;
            }

            //if (mattr.HisAutoFull == AutoFullWay.Way3_FK)

            //this.Pub1.AddFieldSet(rb);
            this.Pub1.Add(rb);
            this.Pub1.AddBR();
            this.Pub1.Add("比如:表单中有商品编号列,需要填充商品地址、供应商电话。");
            this.Pub1.AddBR();

            // 让它等于外键表的一个值。
            Attrs   attrs = null;
            MapData md    = new MapData();

            md.No = this.FK_MapData;
            if (md.RetrieveFromDBSources() == 0)
            {
                attrs = md.GenerHisMap().HisFKAttrs;
            }
            else
            {
                MapDtl mdtl = new MapDtl();
                mdtl.No = this.FK_MapData;
                attrs   = mdtl.GenerMap().HisFKAttrs;
            }

            if (attrs.Count > 0)
            {
            }
            else
            {
                rb.Enabled = false;
                if (rb.Checked)
                {
                    rb.Checked = false;
                }
                this.Pub1.Add("@本表没有外键字段。");
            }

            foreach (Attr attr in attrs)
            {
                if (attr.IsRefAttr)
                {
                    continue;
                }

                rb           = new RadioBtn();
                rb.Text      = attr.Desc;
                rb.ID        = "RB_FK_" + attr.Key;
                rb.GroupName = "sd";

                if (me.Doc.Contains(attr.Key))
                {
                    rb.Checked = true;
                }

                this.Pub1.Add(rb);
                DDL ddl = new DDL();
                ddl.ID = "DDL_" + attr.Key;

                string sql = "";
                switch (BP.Sys.SystemConfig.AppCenterDBType)
                {
                case DBType.Oracle:
                case DBType.Informix:
                    continue;
                    sql = "Select fname as 'No' ,fDesc as 'Name' FROM Sys_FieldDesc WHERE tableName='" + attr.HisFKEn.EnMap.PhysicsTable + "'";
                    break;

                case DBType.MySQL:
                    sql = "Select COLUMN_NAME as No,COLUMN_NAME as Name from information_schema.COLUMNS WHERE TABLE_NAME='" + attr.HisFKEn.EnMap.PhysicsTable + "'";
                    break;

                default:
                    sql = "Select name as 'No' ,Name as 'Name' from syscolumns WHERE ID=OBJECT_ID('" + attr.HisFKEn.EnMap.PhysicsTable + "')";
                    break;
                }

                //  string sql = "Select fname as 'No' ,fDesc as 'Name' FROM Sys_FieldDesc WHERE tableName='" + attr.HisFKEn.EnMap.PhysicsTable + "'";
                //string sql = "Select NO , NAME  FROM Port_Emp ";

                DataTable dt = DBAccess.RunSQLReturnTable(sql);
                foreach (DataRow dr in dt.Rows)
                {
                    //  ddl.Items.Add(new ListItem(this.ToE("Field") + dr[0].ToString() + " " + this.ToE("Desc") + " " + dr[1].ToString(), dr[0].ToString()));
                    ListItem li = new ListItem(dr[0].ToString() + ";" + dr[1].ToString(), dr[0].ToString());
                    if (me.Doc.Contains(dr[0].ToString()))
                    {
                        li.Selected = true;
                    }

                    ddl.Items.Add(li);
                }

                this.Pub1.Add(ddl);
                this.Pub1.AddBR();
            }

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

            // 方式3 本表单中外键列
            this.Pub1.AddTR();
            //this.Pub1.Add("<TD>");
            this.Pub1.AddTDBegin();

            rb           = new RadioBtn();
            rb.GroupName = "s";
            rb.Text      = "方式4:对一个从表的列求值。";
            rb.ID        = "RB_Way_4";
            if (me.Tag == "4")
            {
                rb.Checked = true;
            }

            //this.Pub1.AddFieldSet(rb);
            this.Pub1.Add(rb);
            this.Pub1.Add("比如:对从表中的列求值。");
            this.Pub1.AddBR();

            // 让它对一个从表求和、求平均、求最大、求最小值。
            MapDtls dtls = new MapDtls(this.FK_MapData);

            if (dtls.Count > 0)
            {
            }
            else
            {
                rb.Enabled = false;
                if (rb.Checked)
                {
                    rb.Checked = false;
                }
                // this.Pub1.Add("@没有从表。");
            }
            foreach (MapDtl dtl in dtls)
            {
                DDL ddlF = new DDL();
                ddlF.ID = "DDL_" + dtl.No + "_F";
                MapAttrs mattrs1 = new MapAttrs(dtl.No);
                int      count   = 0;
                foreach (MapAttr mattr1 in mattrs1)
                {
                    if (mattr1.LGType != FieldTypeS.Normal)
                    {
                        continue;
                    }

                    if (mattr1.KeyOfEn == MapAttrAttr.MyPK)
                    {
                        continue;
                    }

                    if (mattr1.IsNum == false)
                    {
                        continue;
                    }
                    switch (mattr1.KeyOfEn)
                    {
                    case "OID":
                    case "RefOID":
                    case "FID":
                        continue;

                    default:
                        break;
                    }
                    count++;
                    ListItem li = new ListItem(mattr1.Name, mattr1.KeyOfEn);
                    if (me.Tag == "4")
                    {
                        if (me.Doc.Contains("=" + mattr1.KeyOfEn))
                        {
                            li.Selected = true;
                        }
                    }
                    ddlF.Items.Add(li);
                }
                if (count == 0)
                {
                    continue;
                }

                rb           = new RadioBtn();
                rb.Text      = dtl.Name;
                rb.ID        = "RB_" + dtl.No;
                rb.GroupName = "dtl";
                if (me.Doc.Contains(dtl.No))
                {
                    rb.Checked = true;
                }

                this.Pub1.Add(rb);

                DDL ddl = new DDL();
                ddl.ID = "DDL_" + dtl.No + "_Way";
                ddl.Items.Add(new ListItem("求合计", "SUM"));
                ddl.Items.Add(new ListItem("求平均", "AVG"));
                ddl.Items.Add(new ListItem("求最大", "MAX"));
                ddl.Items.Add(new ListItem("求最小", "MIN"));
                this.Pub1.Add(ddl);

                if (me.Tag == "4")
                {
                    if (me.Doc.Contains("SUM"))
                    {
                        ddl.SetSelectItem("SUM");
                    }
                    if (me.Doc.Contains("AVG"))
                    {
                        ddl.SetSelectItem("AVG");
                    }
                    if (me.Doc.Contains("MAX"))
                    {
                        ddl.SetSelectItem("MAX");
                    }
                    if (me.Doc.Contains("MIN"))
                    {
                        ddl.SetSelectItem("MIN");
                    }
                }

                this.Pub1.Add(ddlF);
                this.Pub1.AddBR();
            }

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


            #region 方式5
            //this.Pub1.AddTD();
            //this.Pub1.AddTR();

            //this.Pub1.AddFieldSet(rb);
            //this.Pub1.Add(this.ToE("Way2D", "嵌入的JS"));
            //tb = new TextBox();
            //tb.ID = "TB_JS";
            //tb.Width = 450;
            //tb.TextMode = TextBoxMode.MultiLine;
            //tb.Rows = 5;
            //if (mattr.HisAutoFull == AutoFullWay.Way5_JS)
            //    tb.Text = mattr.AutoFullDoc;
            //this.Pub1.Add(tb);
            //this.Pub1.AddFieldSetEnd();

            //this.Pub1.AddTDEnd();
            //this.Pub1.AddTREnd();
            #endregion 方式5

            this.Pub1.AddTableEnd();
            this.Pub1.AddBR();
            this.Pub1.AddBR();

            //this.Pub1.AddTRSum();
            //this.Pub1.AddTDBegin("aligen=center");
            //Button btn = new Button();
            var btn = new LinkBtn(false, NamesOfBtn.Save, "保存");
            //btn.ID = "Btn_Save";
            //btn.CssClass = "Btn";
            //btn.Text = " 保存 ";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);
            this.Pub1.AddSpace(1);

            btn = new LinkBtn(false, NamesOfBtn.SaveAndClose, "保存并关闭");
            //btn.ID = "Btn_SaveAndClose";
            //btn.CssClass = "Btn";
            //btn.Text = " 保存并关闭 ";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);
            //this.Pub1.AddTREnd();
            //this.Pub1.AddTableEnd();
            //return;
        }
示例#16
0
        /// <summary>
        /// 保存设置.
        /// </summary>
        /// <returns></returns>
        public string PopVal_Save()
        {
            try
            {
                MapExt me = new MapExt();
                me.MyPK       = this.FK_MapExt;
                me.FK_MapData = this.FK_MapData;
                me.ExtType    = "PopVal";
                me.AttrOfOper = this.KeyOfEn;
                me.RetrieveFromDBSources();

                string valWorkModel = this.GetValFromFrmByKey("Model");

                switch (valWorkModel)
                {
                case "None":
                    me.PopValWorkModel = PopValWorkModel.None;
                    break;

                case "SelfUrl":     //URL模式.
                    me.PopValWorkModel = PopValWorkModel.SelfUrl;
                    me.PopValUrl       = this.GetValFromFrmByKey("TB_Url");
                    break;

                case "TableOnly":     //表格模式.
                    me.PopValWorkModel = PopValWorkModel.TableOnly;
                    me.PopValEntitySQL = this.GetValFromFrmByKey("TB_Table_SQL");
                    break;

                case "TablePage":     //分页模式.
                    me.PopValWorkModel         = PopValWorkModel.TablePage;
                    me.PopValTablePageSQL      = this.GetValFromFrmByKey("TB_TablePage_SQL");
                    me.PopValTablePageSQLCount = this.GetValFromFrmByKey("TB_TablePage_SQLCount");
                    break;

                case "Group":     //分组模式.
                    me.PopValWorkModel = PopValWorkModel.Group;

                    me.PopValGroupSQL  = this.GetValFromFrmByKey("TB_GroupModel_Group");
                    me.PopValEntitySQL = this.GetValFromFrmByKey("TB_GroupModel_Entity");

                    //me.PopValUrl = this.GetValFromFrmByKey("TB_Url");
                    break;

                case "Tree":     //单实体树.
                    me.PopValWorkModel    = PopValWorkModel.Tree;
                    me.PopValTreeSQL      = this.GetValFromFrmByKey("TB_TreeSQL");
                    me.PopValTreeParentNo = this.GetValFromFrmByKey("TB_TreeParentNo");
                    break;

                case "TreeDouble":                                                       //双实体树.
                    me.PopValWorkModel    = PopValWorkModel.TreeDouble;
                    me.PopValTreeSQL      = this.GetValFromFrmByKey("TB_DoubleTreeSQL"); // 树SQL
                    me.PopValTreeParentNo = this.GetValFromFrmByKey("TB_DoubleTreeParentNo");

                    me.PopValDoubleTreeEntitySQL = this.GetValFromFrmByKey("TB_DoubleTreeEntitySQL");     //实体SQL
                    break;

                default:
                    break;
                }

                //高级属性.
                me.W = int.Parse(this.GetValFromFrmByKey("TB_Width"));
                me.H = int.Parse(this.GetValFromFrmByKey("TB_Height"));
                me.PopValColNames   = this.GetValFromFrmByKey("TB_ColNames");         //中文列名的对应.
                me.PopValTitle      = this.GetValFromFrmByKey("TB_Title");            //标题.
                me.PopValSearchTip  = this.GetValFromFrmByKey("TB_PopValSearchTip");  //关键字提示.
                me.PopValSearchCond = this.GetValFromFrmByKey("TB_PopValSearchCond"); //查询条件.


                //数据返回格式.
                string popValFormat = this.GetValFromFrmByKey("PopValFormat");
                switch (popValFormat)
                {
                case "OnlyNo":
                    me.PopValFormat = PopValFormat.OnlyNo;
                    break;

                case "OnlyName":
                    me.PopValFormat = PopValFormat.OnlyName;
                    break;

                case "NoName":
                    me.PopValFormat = PopValFormat.NoName;
                    break;

                default:
                    break;
                }

                //选择模式.
                string seleModel = this.GetValFromFrmByKey("PopValSelectModel");
                if (seleModel == "One")
                {
                    me.PopValSelectModel = PopValSelectModel.One;
                }
                else
                {
                    me.PopValSelectModel = PopValSelectModel.More;
                }

                me.Save();
                return("保存成功.");
            }
            catch (Exception ex)
            {
                return("@保存失败:" + ex.Message);
            }
        }
示例#17
0
        public void DTS_Flow(BP.WF.Flow fl)
        {
            #region 读取数据.
            BP.Sys.MapExt me = new MapExt();
            me.MyPK = "ND" + int.Parse(fl.No) + "01" + "_" + MapExtXmlList.StartFlow;
            int i = me.RetrieveFromDBSources();
            if (i == 0)
            {
                BP.DA.Log.DefaultLogWriteLineError("没有为流程(" + fl.Name + ")的开始节点设置发起数据,请参考说明书解决.");
                return;
            }
            if (string.IsNullOrEmpty(me.Tag))
            {
                BP.DA.Log.DefaultLogWriteLineError("没有为流程(" + fl.Name + ")的开始节点设置发起数据,请参考说明书解决.");
                return;
            }

            // 获取从表数据.
            DataSet  ds      = new DataSet();
            string[] dtlSQLs = me.Tag1.Split('*');
            foreach (string sql in dtlSQLs)
            {
                if (string.IsNullOrEmpty(sql))
                {
                    continue;
                }

                string[]  tempStrs = sql.Split('=');
                string    dtlName  = tempStrs[0];
                DataTable dtlTable = BP.DA.DBAccess.RunSQLReturnTable(sql.Replace(dtlName + "=", ""));
                dtlTable.TableName = dtlName;
                ds.Tables.Add(dtlTable);
            }
            #endregion 读取数据.

            #region 检查数据源是否正确.
            string errMsg = "";
            // 获取主表数据.
            DataTable dtMain = BP.DA.DBAccess.RunSQLReturnTable(me.Tag);
            if (dtMain.Rows.Count == 0)
            {
                BP.DA.Log.DefaultLogWriteLineError("流程(" + fl.Name + ")此时无任务.");
                this.SetText("流程(" + fl.Name + ")此时无任务.");
                return;
            }

            this.SetText("@查询到(" + dtMain.Rows.Count + ")条任务.");

            if (dtMain.Columns.Contains("Starter") == false)
            {
                errMsg += "@配值的主表中没有Starter列.";
            }

            if (dtMain.Columns.Contains("MainPK") == false)
            {
                errMsg += "@配值的主表中没有MainPK列.";
            }

            if (errMsg.Length > 2)
            {
                this.SetText(errMsg);
                BP.DA.Log.DefaultLogWriteLineError("流程(" + fl.Name + ")的开始节点设置发起数据,不完整." + errMsg);
                return;
            }
            #endregion 检查数据源是否正确.

            #region 处理流程发起.
            string nodeTable = "ND" + int.Parse(fl.No) + "01";
            int    idx       = 0;
            foreach (DataRow dr in dtMain.Rows)
            {
                idx++;

                string mainPK = dr["MainPK"].ToString();
                string sql    = "SELECT OID FROM " + nodeTable + " WHERE MainPK='" + mainPK + "'";
                if (DBAccess.RunSQLReturnTable(sql).Rows.Count != 0)
                {
                    this.SetText("@" + fl.Name + ",第" + idx + "条,此任务在之前已经完成。");
                    continue; /*说明已经调度过了*/
                }

                string starter = dr["Starter"].ToString();
                if (WebUser.No != starter)
                {
                    BP.Web.WebUser.Exit();
                    BP.Port.Emp emp = new BP.Port.Emp();
                    emp.No = starter;
                    if (emp.RetrieveFromDBSources() == 0)
                    {
                        this.SetText("@" + fl.Name + ",第" + idx + "条,设置的发起人员:" + emp.No + "不存在.");
                        BP.DA.Log.DefaultLogWriteLineInfo("@数据驱动方式发起流程(" + fl.Name + ")设置的发起人员:" + emp.No + "不存在。");
                        continue;
                    }
                    WebUser.SignInOfGener(emp);
                }

                #region  给值.
                //System.Collections.Hashtable ht = new Hashtable();

                Work wk = fl.NewWork();

                string err = "";
                #region 检查用户拼写的sql是否正确?
                foreach (DataColumn dc in dtMain.Columns)
                {
                    string f = dc.ColumnName.ToLower();
                    switch (f)
                    {
                    case "starter":
                    case "mainpk":
                    case "refmainpk":
                    case "tonode":
                        break;

                    default:
                        bool isHave = false;
                        foreach (Attr attr in wk.EnMap.Attrs)
                        {
                            if (attr.Key.ToLower() == f)
                            {
                                isHave = true;
                                break;
                            }
                        }
                        if (isHave == false)
                        {
                            err += " " + f + " ";
                        }
                        break;
                    }
                }
                if (string.IsNullOrEmpty(err) == false)
                {
                    throw new Exception("您设置的字段:" + err + "不存在开始节点的表单中,设置的sql:" + me.Tag);
                }

                #endregion 检查用户拼写的sql是否正确?

                foreach (DataColumn dc in dtMain.Columns)
                {
                    wk.SetValByKey(dc.ColumnName, dr[dc.ColumnName].ToString());
                }

                if (ds.Tables.Count != 0)
                {
                    // MapData md = new MapData(nodeTable);
                    MapDtls dtls = new MapDtls(nodeTable);
                    foreach (MapDtl dtl in dtls)
                    {
                        foreach (DataTable dt in ds.Tables)
                        {
                            if (dt.TableName != dtl.No)
                            {
                                continue;
                            }

                            //删除原来的数据。
                            GEDtl dtlEn = dtl.HisGEDtl;
                            dtlEn.Delete(GEDtlAttr.RefPK, wk.OID.ToString());

                            // 执行数据插入。
                            foreach (DataRow drDtl in dt.Rows)
                            {
                                if (drDtl["RefMainPK"].ToString() != mainPK)
                                {
                                    continue;
                                }

                                dtlEn = dtl.HisGEDtl;
                                foreach (DataColumn dc in dt.Columns)
                                {
                                    dtlEn.SetValByKey(dc.ColumnName, drDtl[dc.ColumnName].ToString());
                                }

                                dtlEn.RefPK = wk.OID.ToString();
                                dtlEn.OID   = 0;
                                dtlEn.Insert();
                            }
                        }
                    }
                }
                #endregion  给值.


                int toNodeID = 0;
                try
                {
                    toNodeID = int.Parse(dr["ToNode"].ToString());
                }
                catch
                {
                    /*有可能在4.5以前的版本中没有tonode这个约定.*/
                }

                // 处理发送信息.
                //  Node nd =new Node();
                string msg = "";
                try
                {
                    if (toNodeID == 0)
                    {
                        WorkNode wn = new WorkNode(wk, fl.HisStartNode);
                        msg = wn.NodeSend().ToMsgOfText();
                    }

                    if (toNodeID == fl.StartNodeID)
                    {
                        /* 发起后让它停留在开始节点上,就是为开始节点创建一个待办。*/
                        Int64 workID = BP.WF.Dev2Interface.Node_CreateStartNodeWork(fl.No, null, null, WebUser.No, null);
                        if (workID != wk.OID)
                        {
                            throw new Exception("@异常信息:不应该不一致的workid.");
                        }
                        else
                        {
                            wk.Update();
                        }
                        msg = "已经为(" + WebUser.No + ") 创建了开始工作节点. ";
                    }

                    BP.DA.Log.DefaultLogWriteLineInfo(msg);
                    this.SetText("@" + fl.Name + ",第" + idx + "条,发起人员:" + WebUser.No + "-" + WebUser.Name + "已完成.\r\n" + msg);
                }
                catch (Exception ex)
                {
                    this.SetText("@" + fl.Name + ",第" + idx + "条,发起人员:" + WebUser.No + "-" + WebUser.Name + "发起时出现错误.\r\n" + ex.Message);
                    BP.DA.Log.DefaultLogWriteLineWarning(ex.Message);
                }
            }
            #endregion 处理流程发起.
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            me      = new MapExt();
            me.MyPK = this.FK_MapExt;

            if (me.RetrieveFromDBSources() == 0)
            {
                BP.Web.Controls.FrmPopVal pv = new BP.Web.Controls.FrmPopVal(this.FK_MapExt);
                me.Copy(pv);
            }

            if (me.PopValShowModel == 1)
            {
                this.Response.Redirect("FrmPopValDir.aspx?a=2" + this.RequestParas, true);
                return;
            }

            bool isCheckBox = false;

            if (me.PopValSelectModel == 0)
            {
                isCheckBox = true;
            }
            else
            {
                isCheckBox = false;
            }

            string sqlGroup = me.Tag1;

            sqlGroup = sqlGroup.Replace("@WebUser.No", BP.Web.WebUser.No);
            sqlGroup = sqlGroup.Replace("@WebUser.Name", BP.Web.WebUser.Name);
            sqlGroup = sqlGroup.Replace("@WebUser.FK_Dept", BP.Web.WebUser.FK_Dept);

            string sqlObjs = me.Tag2;

            sqlObjs = sqlObjs.Replace("@WebUser.No", BP.Web.WebUser.No);
            sqlObjs = sqlObjs.Replace("@WebUser.Name", BP.Web.WebUser.Name);
            sqlObjs = sqlObjs.Replace("@WebUser.FK_Dept", BP.Web.WebUser.FK_Dept);

            bool      isHaveUnGroup = true;
            DataTable dtGroup       = new DataTable();

            if (sqlGroup.Length > 5)
            {
                isHaveUnGroup = false;
                dtGroup       = BP.DA.DBAccess.RunSQLReturnTable(sqlGroup);
            }
            else
            {
                dtGroup.Columns.Add("No", typeof(string));
                dtGroup.Columns.Add("Name", typeof(string));
                DataRow dr = dtGroup.NewRow();
                dr["No"]   = "01";
                dr["Name"] = "全部选择";
                dtGroup.Rows.Add(dr);
            }

            DataTable dtObj = BP.DA.DBAccess.RunSQLReturnTable(sqlObjs);

            if (dtObj.Columns.Count == 2)
            {
                dtObj.Columns.Add("Group", typeof(string));
                foreach (DataRow dr in dtObj.Rows)
                {
                    dr["Group"] = "01";
                }
            }

            int cols = 4;

            this.Pub1.AddTable("width=95% border=0");
            if (isHaveUnGroup == false)
            {
                foreach (DataRow drGroup in dtGroup.Rows)
                {
                    string ctlIDs  = "";
                    string groupNo = drGroup[0].ToString();

                    //增加全部选择.
                    this.Pub1.AddTR();
                    CheckBox cbx = new CheckBox();
                    cbx.ID   = "CBs_" + drGroup[0].ToString();
                    cbx.Text = drGroup[1].ToString();
                    this.Pub1.AddTDTitle("align=left", cbx);
                    this.Pub1.AddTREnd();

                    this.Pub1.AddTR();
                    this.Pub1.AddTDBegin("nowarp=false");

                    this.Pub1.AddTable("border=0");
                    int colIdx = -1;
                    foreach (DataRow drObj in dtObj.Rows)
                    {
                        string no    = drObj[0].ToString();
                        string name  = drObj[1].ToString();
                        string group = drObj[2].ToString();
                        if (group.Trim() != groupNo.Trim())
                        {
                            continue;
                        }

                        colIdx++;
                        if (colIdx == 0)
                        {
                            this.Pub1.AddTR();
                        }

                        CheckBox cb = new CheckBox();
                        cb.ID   = "CB_" + no;
                        ctlIDs += cb.ID + ",";
                        cb.Attributes["onclick"] = "isChange=true;";
                        cb.Text    = name;
                        cb.Checked = this.CtrlVal.Contains("," + no + ",");
                        if (cb.Checked)
                        {
                            cb.Text = "<font color=green>" + cb.Text + "</font>";
                        }
                        this.Pub1.AddTD(cb);
                        if (cols - 1 == colIdx)
                        {
                            this.Pub1.AddTREnd();
                            colIdx = -1;
                        }
                    }
                    cbx.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                    if (colIdx != -1)
                    {
                        while (colIdx != cols - 1)
                        {
                            colIdx++;
                            this.Pub1.AddTD();
                        }
                        this.Pub1.AddTREnd();
                    }
                    this.Pub1.AddTableEnd();
                    this.Pub1.AddTDEnd();
                    this.Pub1.AddTREnd();
                }
            }
            #region 处理未分组的情况.
            if (isHaveUnGroup == true)
            {
                this.Pub1.AddTR();
                this.Pub1.AddTDBigDocBegain(); // ("nowarp=true");
                this.Pub1.AddTable();
                int    colIdx = -1;
                string ctlIDs = "";
                //增加全部选择.
                this.Pub1.AddTR();
                CheckBox cbx = new CheckBox();
                cbx.ID   = "CBs_" + dtGroup.Rows[0][0].ToString();
                cbx.Text = dtGroup.Rows[0][1].ToString();

                this.Pub1.AddTDTitle("align=left colspan=4", cbx);
                this.Pub1.AddTREnd();

                foreach (DataRow drObj in dtObj.Rows)
                {
                    string group = drObj[2].ToString();
                    isHaveUnGroup = true;
                    foreach (DataRow drGroup in dtGroup.Rows)
                    {
                        string groupNo = drGroup[0].ToString();
                        if (group != groupNo)
                        {
                            isHaveUnGroup = true;
                            break;
                        }
                    }

                    if (isHaveUnGroup == false)
                    {
                        continue;
                    }

                    string no   = drObj[0].ToString();
                    string name = drObj[1].ToString();

                    colIdx++;
                    if (colIdx == 0)
                    {
                        this.Pub1.AddTR();
                    }

                    CheckBox cb = new CheckBox();
                    cb.ID      = "CB_" + no;
                    ctlIDs    += cb.ID + ",";
                    cb.Text    = name + group;
                    cb.Checked = this.CtrlVal.Contains("," + no + ",");
                    if (cb.Checked)
                    {
                        cb.Text = "<font color=green>" + cb.Text + "</font>";
                    }

                    this.Pub1.AddTD(cb);

                    if (cols - 1 == colIdx)
                    {
                        this.Pub1.AddTREnd();
                        colIdx = -1;
                    }
                }
                cbx.Attributes["onclick"] = "SetSelected(this,'" + ctlIDs + "')";

                if (colIdx != -1)
                {
                    while (colIdx != cols - 1)
                    {
                        colIdx++;
                        this.Pub1.AddTD();
                    }
                    this.Pub1.AddTREnd();
                }
                this.Pub1.AddTableEnd();
                this.Pub1.AddTDEnd();
                this.Pub1.AddTREnd();
            }
            #endregion 处理未分组的情况.

            this.Pub1.AddTableEnd();

            Button btn = new Button();
            btn.ID     = "s";
            btn.Text   = " OK ";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            btn        = new Button();
            btn.ID     = "Cancel";
            btn.Text   = " Cancel ";
            btn.Click += new EventHandler(btn_Click);
            this.Pub1.Add(btn);
        }