public QueryObject InitQueryObjectByEns(Entities ens, bool IsShowSearchKey, DTSearchWay dw, string dtKey, Attrs attrs, AttrsOfSearch attrsOfSearch, AttrSearchs searchAttrs)
        {
            QueryObject qo = new QueryObject(ens);

            #region 关键字
            string keyVal = "";
            //Attrs attrs = en.EnMap.Attrs;
            if (IsShowSearchKey)
            {
                TB keyTB = this.GetTBByID("TB_Key");
                if (keyTB != null)
                {
                    keyVal = keyTB.Text.Trim();
                }
                else
                {
                    UserRegedit ur = new UserRegedit();
                    //ur.MyPK = WebUser.No + ens.GetNewEntity.ClassID + "_SearchAttrs";
                    QueryObject urObj = new QueryObject(ur);
                    urObj.AddWhere("MyPK", WebUser.No + ens.GetNewEntity.ClassID + "_SearchAttrs");
                    urObj.DoQuery();

                    keyVal = ur.SearchKey;
                }
                this.Page.Session["SKey"] = keyVal;
            }

            if (keyVal.Length >= 1)
            {
                Attr attrPK = new Attr();
                foreach (Attr attr in attrs)
                {
                    if (attr.IsPK)
                    {
                        attrPK = attr;
                        break;
                    }
                }
                int i = 0;
                foreach (Attr attr in attrs)
                {
                    switch (attr.MyFieldType)
                    {
                    case FieldType.Enum:
                    case FieldType.FK:
                    case FieldType.PKFK:
                        continue;

                    default:
                        break;
                    }


                    if (attr.MyDataType != DataType.AppString)
                    {
                        continue;
                    }

                    if (attr.MyFieldType == FieldType.RefText)
                    {
                        continue;
                    }

                    if (attr.Key == "FK_Dept")
                    {
                        continue;
                    }

                    i++;
                    if (i == 1)
                    {
                        /* 第一次进来。 */
                        qo.addLeftBracket();
                        switch (SystemConfig.AppCenterDBType)
                        {
                        case BP.DA.DBType.Oracle:
                        case BP.DA.DBType.Informix:
                            qo.AddWhere(attr.Key, " LIKE ", " '%'||" + SystemConfig.AppCenterDBVarStr + "SKey||'%'");
                            break;

                        case BP.DA.DBType.MySQL:
                            qo.AddWhere(attr.Key, " LIKE ", "CONCAT('%'," + SystemConfig.AppCenterDBVarStr + "SKey,'%')");
                            break;

                        default:
                            qo.AddWhere(attr.Key, " LIKE ", " '%'+" + SystemConfig.AppCenterDBVarStr + "SKey+'%'");
                            break;
                        }
                        continue;
                    }
                    qo.addOr();

                    switch (SystemConfig.AppCenterDBType)
                    {
                    case BP.DA.DBType.Oracle:
                    case BP.DA.DBType.Informix:
                        qo.AddWhere(attr.Key, " LIKE ", "'%'||" + SystemConfig.AppCenterDBVarStr + "SKey||'%'");
                        break;

                    case BP.DA.DBType.MySQL:
                        qo.AddWhere(attr.Key, " LIKE ", "CONCAT('%'," + SystemConfig.AppCenterDBVarStr + "SKey,'%')");
                        break;

                    default:
                        qo.AddWhere(attr.Key, " LIKE ", "'%'+" + SystemConfig.AppCenterDBVarStr + "SKey+'%'");
                        break;
                    }
                }
                qo.MyParas.Add("SKey", keyVal);
                qo.addRightBracket();
            }
            else
            {
                qo.addLeftBracket();
                qo.AddWhere("abc", "all");
                qo.addRightBracket();
            }
            #endregion

            #region 普通属性
            string opkey = ""; // 操作符号。
            foreach (AttrOfSearch attr in attrsOfSearch)
            {
                if (attr.IsHidden)
                {
                    qo.addAnd();
                    qo.addLeftBracket();
                    qo.AddWhere(attr.RefAttrKey, attr.DefaultSymbol, attr.DefaultValRun);
                    qo.addRightBracket();
                    continue;
                }

                if (attr.SymbolEnable == true)
                {
                    opkey = this.GetDDLByKey("DDL_" + attr.Key).SelectedItemStringVal;
                    if (opkey == "all")
                    {
                        continue;
                    }
                }
                else
                {
                    opkey = attr.DefaultSymbol;
                }

                qo.addAnd();
                qo.addLeftBracket();

                if (attr.DefaultVal.Length >= 8)
                {
                    string date = "2005-09-01";
                    try
                    {
                        /* 就可能是年月日。 */
                        string y = this.GetDDLByKey("DDL_" + attr.Key + "_Year").SelectedItemStringVal;
                        string m = this.GetDDLByKey("DDL_" + attr.Key + "_Month").SelectedItemStringVal;
                        string d = this.GetDDLByKey("DDL_" + attr.Key + "_Day").SelectedItemStringVal;
                        date = y + "-" + m + "-" + d;

                        if (opkey == "<=")
                        {
                            DateTime dt = DataType.ParseSysDate2DateTime(date).AddDays(1);
                            date = dt.ToString(DataType.SysDataFormat);
                        }
                    }
                    catch
                    {
                    }

                    qo.AddWhere(attr.RefAttrKey, opkey, date);
                }
                else
                {
                    qo.AddWhere(attr.RefAttrKey, opkey, this.GetTBByID("TB_" + attr.Key).Text);
                }
                qo.addRightBracket();
            }
            #endregion

            #region 外键
            foreach (AttrSearch attr1 in searchAttrs)
            {
                Attr attr = attr1.HisAttr;

                if (attr.MyFieldType == FieldType.RefText)
                {
                    continue;
                }


                DDL ddl = this.GetDDLByKey("DDL_" + attr.Key);
                if (ddl.Items.Count == 0)
                {
                    continue;
                }

                string selectVal = ddl.SelectedItemStringVal;
                if (selectVal == "all")
                {
                    continue;
                }

                if (selectVal == "mvals")
                {
                    UserRegedit sUr = new UserRegedit();
                    sUr.MyPK = WebUser.No + this.EnsName + "_SearchAttrs";
                    sUr.RetrieveFromDBSources();

                    /* 如果是多选值 */
                    string cfgVal = sUr.MVals;
                    AtPara ap     = new AtPara(cfgVal);
                    string instr  = ap.GetValStrByKey(attr.Key);
                    if (instr == null || instr == "")
                    {
                        if (attr.Key == "FK_Dept" || attr.Key == "FK_Unit")
                        {
                            if (attr.Key == "FK_Dept")
                            {
                                selectVal         = WebUser.FK_Dept;
                                ddl.SelectedIndex = 0;
                            }

                            //if (attr.Key == "FK_Unit")
                            //{
                            //    selectVal = WebUser.FK_Unit;
                            //    ddl.SelectedIndex = 0;
                            //}
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        instr = instr.Replace("..", ".");
                        instr = instr.Replace(".", "','");
                        instr = instr.Substring(2);
                        instr = instr.Substring(0, instr.Length - 2);

                        qo.addAnd();
                        qo.addLeftBracket();
                        qo.AddWhereIn(attr.Key, "(" + instr + ")");
                        qo.addRightBracket();
                        continue;
                    }
                }


                qo.addAnd();
                qo.addLeftBracket();

                if (attr.UIBindKey == "BP.Port.Depts" || attr.UIBindKey == "BP.Port.Units")  //判断特殊情况。
                {
                    qo.AddWhere(attr.Key, " LIKE ", selectVal + "%");
                }
                else
                {
                    qo.AddWhere(attr.Key, selectVal);
                }

                //qo.AddWhere(attr.Key,this.GetDDLByKey("DDL_"+attr.Key).SelectedItemStringVal ) ;
                qo.addRightBracket();
            }
            #endregion .

            if (dw != DTSearchWay.None)
            {
                string dtFrom = this.GetTBByID("TB_S_From").Text.Trim();
                string dtTo   = this.GetTBByID("TB_S_To").Text.Trim();
                if (dw == DTSearchWay.ByDate)
                {
                    qo.addAnd();
                    qo.addLeftBracket();
                    qo.SQL = dtKey + " >= '" + dtFrom + " 01:01'";
                    qo.addAnd();
                    qo.SQL = dtKey + " <= '" + dtTo + " 23:59'";
                    qo.addRightBracket();

                    //qo.AddWhere(dtKey, ">=", dtFrom+" 01:01");
                    //qo.addAnd();
                    //qo.AddWhere(dtKey, "<=", dtTo + " 23:59");
                    //qo.addRightBracket();
                }

                if (dw == DTSearchWay.ByDateTime)
                {
                    qo.addAnd();
                    qo.addLeftBracket();
                    qo.SQL = dtKey + " >= '" + dtFrom + "'";
                    qo.addAnd();
                    qo.SQL = dtKey + " <= '" + dtTo + "'";
                    qo.addRightBracket();

                    //qo.addAnd();
                    //qo.addLeftBracket();
                    //qo.AddWhere(dtKey, ">=", dtFrom);
                    //qo.addAnd();
                    //qo.AddWhere(dtKey, "<=", dtTo);
                    //qo.addRightBracket();
                }
            }

            //  throw new Exception(qo.SQL);
            return(qo);
        }
        public void InitToolbarOfMapRpt(BP.WF.Flow fl, BP.WF.Rpt.MapRpt currMapRpt, string RptNo, Entity en, int pageidx)
        {
            Map map = en.EnMap;

            this.InitByMapV2(map, 1, RptNo);

            //特殊处理权限.
            AttrSearchs searchs = map.SearchAttrs;
            string      defVal  = "";

            System.Data.DataTable dt = null;
            foreach (AttrSearch attr in searchs)
            {
                DDL mydll = this.GetDDLByKey("DDL_" + attr.Key);
                if (mydll == null)
                {
                    continue;
                }
                defVal = mydll.SelectedItemStringVal;
                mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + RptNo + "','" + attr.Key + "')";

                switch (attr.HisAttr.Key)
                {
                case "FK_NY":
                    dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM " + currMapRpt.PTable + " WHERE FK_NY!='' ORDER BY FK_NY");
                    mydll.Items.Clear();
                    mydll.Items.Add(new ListItem("=>月份", "all"));
                    foreach (DataRow dr in dt.Rows)
                    {
                        mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                    }
                    mydll.SetSelectItem(defVal);
                    break;

                case "FlowStarter":
                case "FlowEnder":
                    string sql = "";
                    switch (fl.HisFlowDeptDataRightCtrlType)
                    {
                    case FlowDeptDataRightCtrlType.MyDeptOnly:         // 我的部门.
                        sql = "SELECT No,Name FROM WF_Emp WHERE FK_Dept='" + WebUser.FK_Dept + "' AND No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    case FlowDeptDataRightCtrlType.MyDeptAndBeloneToMyDeptOnly:         //我的部门,或者隶属我部门下面的部门.
#warning 这里有错误,怎么递归循环出来?
                        sql = "SELECT No,Name FROM WF_Emp WHERE FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + currMapRpt.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    case FlowDeptDataRightCtrlType.BySpecFlowDept:         // 指定权限.
                        sql = "SELECT No,Name FROM WF_Emp WHERE FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + currMapRpt.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    case FlowDeptDataRightCtrlType.AnyoneAndAnydept:          // 任何部门.
                        sql = "SELECT No,Name FROM WF_Emp WHERE No IN (SELECT DISTINCT FlowStarter FROM " + currMapRpt.PTable + " WHERE FlowStarter!='')";
                        break;

                    default:
                        break;
                    }
                    dt = DBAccess.RunSQLReturnTable(sql);

                    mydll.Items.Clear();
                    if (attr.Key == NDXRptBaseAttr.FlowStarter)
                    {
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                    }
                    else
                    {
                        mydll.Items.Add(new ListItem("=>结束人", "all"));
                    }

                    foreach (DataRow dr in dt.Rows)
                    {
                        mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                    }
                    mydll.SetSelectItem(defVal);
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + RptNo + "','" + attr.Key + "')";
                    break;

                case "FK_Dept":
                    if (WebUser.No != "admin")
                    {
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + currMapRpt.FK_Flow + "')");
                        if (dt.Rows.Count == 0)
                        {
                            BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch();
                            dfs.FK_Dept = WebUser.FK_Dept;
                            dfs.FK_Emp  = WebUser.No;
                            dfs.FK_Flow = currMapRpt.FK_Flow;
                            dfs.MyPK    = WebUser.FK_Dept + "_" + WebUser.No + "_" + currMapRpt.FK_Flow;
                            dfs.Insert();
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + currMapRpt.FK_Flow + "')");
                        }
                        mydll.Items.Clear();
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                    }

                    if (mydll.Items.Count >= 2)
                    {
                        ListItem liMvals = new ListItem("*多项组合..", "mvals");
                        liMvals.Attributes.CssStyle.Add("style", "color:green");
                        liMvals.Attributes.Add("color", "green");
                        liMvals.Attributes.Add("style", "color:green");
                    }
                    mydll.SetSelectItem(defVal);
                    break;

                default:
                    break;
                }
            }
        }
        /// <summary>
        /// 初始化map
        /// </summary>
        /// <param name="map">map</param>
        /// <param name="i">选择的页</param>
        public void InitByMapV2(Map map, int page, string ensName)
        {
            UserRegedit ur     = new UserRegedit(WebUser.No, ensName + "_SearchAttrs");
            string      cfgKey = ur.Vals;

            this.InitByMapV2(map.IsShowSearchKey, map.DTSearchWay, map.AttrsOfSearch, map.SearchAttrs, null, page, ur);

            #region 设置默认值
            string[] keys = cfgKey.Split('@');
            foreach (Control ti in this.Controls)
            {
                if (ti.ID == null)
                {
                    continue;
                }

                if (ti.ID == "TB_Key")
                {
                    TB tb = (TB)ti;
                    tb.Text = ur.SearchKey;
                    continue;
                }

                if (ti.ID == "TB_S_From")
                {
                    TB tb = (TB)ti;
                    if (map.DTSearchWay == DTSearchWay.ByDate)
                    {
                        tb.Text = DateTime.Parse(ur.DTFrom_Datatime).ToString("yyyy-MM-dd"); //ur.DTFrom_Data;
                        tb.Attributes["onfocus"] = "WdatePicker();";
                    }
                    else
                    {
                        tb.Text = ur.DTFrom_Datatime;
                    }
                    continue;
                }

                if (ti.ID == "TB_S_To")
                {
                    TB tb = (TB)ti;
                    if (map.DTSearchWay == DTSearchWay.ByDate)
                    {
                        tb.Text = DateTime.Parse(ur.DTTo_Datatime).ToString("yyyy-MM-dd"); //ur.DTTo_Data;
                        tb.Attributes["onfocus"] = "WdatePicker();";
                    }
                    else
                    {
                        tb.Text = ur.DTFrom_Datatime;
                    }
                    continue;
                }


                if (ti.ID.IndexOf("DDL_") == -1)
                {
                    continue;
                }

                if (cfgKey.IndexOf(ti.ID) == -1)
                {
                    continue;
                }

                foreach (string key in keys)
                {
                    if (key.Length < 3)
                    {
                        continue;
                    }

                    if (key.IndexOf(ti.ID) == -1)
                    {
                        continue;
                    }

                    string[] vals = key.Split('=');

                    DDL  ddl    = (DDL)ti;
                    bool isHave = ddl.SetSelectItem(vals[1]);
                    if (isHave == false)
                    {
                        /*没有有找到要选择的人员*/
                        try
                        {
                            Attr attr = map.GetAttrByKey(vals[0].Replace("DDL_", ""));
                            ddl.SetSelectItem(vals[1], attr);
                        }
                        catch
                        {
                        }
                    }
                }
            }
            #endregion 设置默认值

            #region 处理级联关系
            bool IsCheckRelational = false;

            // 获取大类的选择集合。
            AttrSearchs bigAttrs = new AttrSearchs();
            foreach (AttrSearch attr in map.SearchAttrs)
            {
                if (attr.RelationalDtlKey == null)
                {
                    continue;
                }
                bigAttrs.Add(attr);
            }

            // 遍历他们,为他们生成事件。
            foreach (AttrSearch attr in bigAttrs)
            {
                AttrSearch smallAttr = null;
                foreach (AttrSearch attr1 in map.SearchAttrs)
                {
                    if (attr1.Key == attr.RelationalDtlKey)
                    {
                        smallAttr = attr1;
                    }
                }

                if (smallAttr == null)
                {
                    throw new Exception("@您设置的级联子菜单键值在查询集合属性里面不存在。");
                }

                Entities ens = smallAttr.HisAttr.HisFKEns;
                ens.RetrieveAll();
                Entity en = smallAttr.HisAttr.HisFKEn;

                // 增加事件.
                DDL ddl = this.GetDDLByID("DDL_" + attr.Key);
                // ddl.Attributes["onchange"] = "Redirect" + attr.Key + "(this.options.selectedIndex)";

                ddl.Attributes["onchange"] = "Redirect" + attr.Key + "()";
                DDL    ddlSmil = this.GetDDLByID("DDL_" + attr.RelationalDtlKey);
                string script  = "";
                // 判断级联的方式,是按照编号规则级联还是按照外键级联。
                if (en.EnMap.Attrs.Contains(attr.Key))
                {
                    /*按照外键或者枚举类型级联 */
                }
                else
                {
                    /*按照编号规则级联。*/
                    script  = "\t\n<script type='text/javascript'>";
                    script += "\t\n<!--";
                    string arrayStrs = "";
                    bool   isfirst   = true;
                    foreach (EntityNoName en1 in ens)
                    {
                        if (isfirst)
                        {
                            isfirst    = false;
                            arrayStrs += "[\"" + en1.Name + "\",\"" + en1.No + "\"]";
                        }
                        else
                        {
                            arrayStrs += ",[\"" + en1.Name + "\",\"" + en1.No + "\"]";
                        }
                    }
                    script += "\t\n var data" + attr.Key + " = new Array(" + arrayStrs + "); ";
                    script += "\t\n Redirect" + attr.Key + "();";
                    //数据联动
                    script += "\t\n function Redirect" + attr.Key + "(){";
                    // script += "\t\n alert('sss')";
                    script += "\t\n	var ddlBig" + attr.Key + " = document.getElementById(\"" + ddl.ClientID + "\");";
                    script += "\t\n	var ddlSmall" + attr.Key + " = document.getElementById(\"" + ddlSmil.ClientID + "\");";
                    script += "\t\n	var value_Big" + attr.Key + " = getSelectValue" + attr.Key + "( ddlBig" + attr.Key + " );";
                    script += "\t\n	var value_Big_length" + attr.Key + " = value_Big" + attr.Key + ".length;";
                    script += "\t\n	var index" + attr.Key + " = 0;";
                    script += "\t\n	ddlSmall" + attr.Key + ".options.length = 0;";
                    script += "\t\n	for(i=0; i<data" + attr.Key + ".length; i++){					";
                    script += "\t\n		if(data"+ attr.Key + "[i][1].substr(0, value_Big_length" + attr.Key + ") == value_Big" + attr.Key + "){";
                    script += "\t\n			ddlSmall"+ attr.Key + ".options[index" + attr.Key + "++] = new Option(data" + attr.Key + "[i][0],data" + attr.Key + "[i][1]);";
                    script += "\t\n		}";
                    script += "\t\n	}";
                    script += "\t\n	ddlSmall" + attr.Key + ".options[0].selected = true;";
                    script += "\t\n	}";
                    script += " //获取指定下拉列表的值";
                    script += "\t\n function getSelectValue" + attr.Key + "(oper) { ";
                    script += "\t\n	return oper.options[oper.options.selectedIndex].value;";
                    script += "\t\n	} ";
                    script += "\t\n	//-->";
                    script += "\t\n	</script> ";
                }
                // 注册他
                this.Page.RegisterClientScriptBlock(attr.Key, script);
            }
            #endregion
        }
        /// <summary>
        /// 查询方式
        /// </summary>
        /// <param name="isShowKey"></param>
        /// <param name="sw"></param>
        /// <param name="dtSearchKey"></param>
        /// <param name="attrsOfSearch"></param>
        /// <param name="attrsOfFK"></param>
        /// <param name="attrD1"></param>
        /// <param name="page"></param>
        /// <param name="ur"></param>
        public void InitByMapV2(bool isShowKey, DTSearchWay sw, AttrsOfSearch attrsOfSearch, AttrSearchs attrsOfFK, Attrs attrD1, int page, UserRegedit ur)
        {
            int keysNum = 0;

            // 关键字。
            if (isShowKey)
            {
                this.AddLab("Lab_Key", "关键字:&nbsp;");
                TB tb = new TB();
                tb.ID      = "TB_Key";
                tb.Columns = 13;
                this.AddTB(tb);
                keysNum++;
            }
            this.Add("&nbsp;");

            if (sw != DTSearchWay.None)
            {
                Label lab = new Label();
                lab.ID   = "Lab_From";
                lab.Text = "日期从:";
                this.Add(lab);
                TB tbDT = new TB();
                tbDT.ID = "TB_S_From";
                if (sw == DTSearchWay.ByDate)
                {
                    tbDT.ShowType = TBType.Date;
                }
                if (sw == DTSearchWay.ByDateTime)
                {
                    tbDT.ShowType = TBType.DateTime;
                }
                this.Add(tbDT);

                lab      = new Label();
                lab.ID   = "Lab_To";
                lab.Text = "到:";
                this.Add(lab);

                tbDT    = new TB();
                tbDT.ID = "TB_S_To";
                if (sw == DTSearchWay.ByDate)
                {
                    tbDT.ShowType = TBType.Date;
                }
                if (sw == DTSearchWay.ByDateTime)
                {
                    tbDT.ShowType = TBType.DateTime;
                }
                this.Add(tbDT);
            }


            // 非外键属性。
            foreach (AttrOfSearch attr in attrsOfSearch)
            {
                if (attr.IsHidden)
                {
                    continue;
                }

                this.AddLab("Lab_" + attr.Key, attr.Lab);
                keysNum++;

                if (attr.SymbolEnable == true)
                {
                    DDL ddl = new DDL();
                    ddl.ID                 = "DDL_" + attr.Key;
                    ddl.SelfShowType       = DDLShowType.Ens; //  attr.UIDDLShowType;
                    ddl.SelfBindKey        = "BP.Sys.Operators";
                    ddl.SelfEnsRefKey      = "No";
                    ddl.SelfEnsRefKeyText  = "Name";
                    ddl.SelfDefaultVal     = attr.DefaultSymbol;
                    ddl.SelfAddAllLocation = AddAllLocation.None;
                    ddl.SelfIsShowVal      = false; ///不让显示编号
                    //ddl.ID="DDL_"+attr.Key;
                    //ddl.SelfBind();
                    this.AddDDL(ddl);
                    this.GetDDLByKey("DDL_" + attr.Key).SelfBind();
                }

                if (attr.DefaultVal.Length >= 8)
                {
                    DateTime mydt = BP.DA.DataType.ParseSysDate2DateTime(attr.DefaultVal);

                    DDL ddl = new DDL();
                    ddl.ID                 = "DDL_" + attr.Key + "_Year";
                    ddl.SelfShowType       = DDLShowType.Ens;
                    ddl.SelfBindKey        = "BP.Pub.NDs";
                    ddl.SelfEnsRefKey      = "No";
                    ddl.SelfEnsRefKeyText  = "Name";
                    ddl.SelfDefaultVal     = mydt.ToString("yyyy");
                    ddl.SelfAddAllLocation = AddAllLocation.None;
                    ddl.SelfIsShowVal      = false; ///不让显示编号
                    this.AddDDL(ddl);
                    ddl.SelfBind();
                    //ddl.SelfBind();

                    ddl                    = new DDL();
                    ddl.ID                 = "DDL_" + attr.Key + "_Month";
                    ddl.SelfShowType       = DDLShowType.Ens;
                    ddl.SelfBindKey        = "BP.Pub.YFs";
                    ddl.SelfEnsRefKey      = "No";
                    ddl.SelfEnsRefKeyText  = "Name";
                    ddl.SelfDefaultVal     = mydt.ToString("MM");
                    ddl.SelfAddAllLocation = AddAllLocation.None;
                    ddl.SelfIsShowVal      = false; ///不让显示编号
                    //	ddl.SelfBind();
                    this.AddDDL(ddl);
                    ddl.SelfBind();

                    ddl                    = new DDL();
                    ddl.ID                 = "DDL_" + attr.Key + "_Day";
                    ddl.SelfShowType       = DDLShowType.Ens;
                    ddl.SelfBindKey        = "BP.Pub.Days";
                    ddl.SelfEnsRefKey      = "No";
                    ddl.SelfEnsRefKeyText  = "Name";
                    ddl.SelfDefaultVal     = mydt.ToString("dd");
                    ddl.SelfAddAllLocation = AddAllLocation.None;
                    ddl.SelfIsShowVal      = false; ///不让显示编号
                    //ddl.SelfBind();
                    this.AddDDL(ddl);
                    this.GetDDLByKey(ddl.ID).SelfBind();
                }
                else
                {
                    TB tb = new TB();
                    tb.ID      = "TB_" + attr.Key;
                    tb.Text    = attr.DefaultVal;
                    tb.Columns = attr.TBWidth;
                    this.AddTB(tb);
                }
            }

            string ensName = this.Page.Request.QueryString["EnsName"];
            string cfgVal  = "";

            cfgVal = ur.Vals;


            // 外键属性查询。
            bool isfirst = true;

            foreach (AttrSearch attr1 in attrsOfFK)
            {
                Attr attr = attr1.HisAttr;

                if (attr.MyFieldType == FieldType.RefText)
                {
                    continue;
                }

                DDL ddl = new DDL();
                ddl.ID = "DDL_" + attr.Key;
                this.AddDDL(ddl);
                keysNum++;
                //if (keysNum == 3 || keysNum == 6 || keysNum == 9)
                //    this.AddBR("b_" + keysNum);
                if (attr.MyFieldType == FieldType.Enum)
                {
                    this.GetDDLByKey("DDL_" + attr.Key).BindSysEnum(attr.UIBindKey, false, AddAllLocation.TopAndEndWithMVal);
                    this.GetDDLByKey("DDL_" + attr.Key).Items[0].Text = ">>" + attr.Desc;

                    this.GetDDLByKey("DDL_" + attr.Key).Attributes["onclick"] = "DDL_mvals_OnChange(this,'" + ensName + "','" + attr.Key + "')";
                    // this.GetDDLByKey("DDL_" + attr.Key).Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + ur.MyPK + "','" + attr.Key + "')";

                    // ddl.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + ur.MyPK + "','" + attr.Key + "')";
                }
                else
                {
                    ListItem liMvals = new ListItem("*多项组合..", "mvals");
                    liMvals.Attributes.CssStyle.Add("style", "color:green");
                    liMvals.Attributes.Add("color", "green");
                    liMvals.Attributes.Add("style", "color:green");

                    // liMvals.Attributes.Add("onclick", "alert('sss')");

                    switch (attr.UIBindKey)
                    {
                    case "BP.Port.Depts":
                        ddl.Items.Clear();
                        BP.Port.Depts depts = new BP.Port.Depts();
                        depts.RetrieveAll();
                        foreach (BP.Port.Dept dept in depts)
                        {
                            string space = "";
                            //   space = space.PadLeft(dept.Grade - 1, '-');
                            ListItem li = new ListItem(space + dept.Name, dept.No);
                            this.GetDDLByKey("DDL_" + attr.Key).Items.Add(li);
                        }
                        if (depts.Count > SystemConfig.MaxDDLNum)
                        {
                            this.AddLab("lD", "<a href=\"javascript:onDDLSelectedMore('DDL_" + attr.Key + "', '" + this.EnsName + "', 'BP.Port.Depts', 'No','Name')\" >...</a>");
                        }

                        if (ddl.Items.Count >= 2)
                        {
                            ddl.Items.Add(liMvals);
                        }

                        ddl.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + ensName + "','" + attr.Key + "')";
                        break;
                    //case "BP.Port.Units":
                    //    ddl.Items.Clear();
                    //    BP.Port.Units units = new BP.Port.Units();
                    //    units.RetrieveAll();
                    //    foreach (BP.Port.Unit unit in units)
                    //    {
                    //        string space = "";
                    //        space = space.PadLeft(unit.No.Length / 2 - 1, '-');
                    //        ListItem li = new ListItem(space + unit.Name, unit.No);
                    //        this.GetDDLByKey("DDL_" + attr.Key).Items.Add(li);
                    //    }
                    //    if (units.Count > SystemConfig.MaxDDLNum)
                    //        this.AddLab("lD", "<a href=\"javascript:onDDLSelectedMore('DDL_" + attr.Key + "', '" + this.EnsName + "', 'BP.Port.Units', 'No','Name')\" >...</a>");

                    //    if (ddl.Items.Count >= 2)
                    //        ddl.Items.Add(liMvals);

                    //    ddl.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + ensName + "','" + attr.Key + "')";
                    // break;
                    default:
                        ddl.Items.Clear();
                        if (attr.MyDataType == DataType.AppBoolean)
                        {
                            ddl.Items.Add(new ListItem(">>" + attr.Desc, "all"));
                            ddl.Items.Add(new ListItem("是", "1"));
                            ddl.Items.Add(new ListItem("否", "0"));
                            break;
                        }
                        Entities ens = attr.HisFKEns;
                        ens.RetrieveAll();
                        ddl.Items.Add(new ListItem(">>" + attr.Desc, "all"));
                        foreach (Entity en in ens)
                        {
                            ddl.Items.Add(new ListItem(en.GetValStrByKey("Name"), en.GetValStrByKey("No")));
                        }

                        if (ddl.Items.Count >= 2)
                        {
                            ddl.Items.Add(liMvals);
                        }

                        ddl.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + ensName + "','" + attr.Key + "')";
                        break;
                    }
                }
                if (isfirst)
                {
                    isfirst = false;
                }
            }
            if (_AddSearchBtn)
            {
                this.AddLinkBtn(NamesOfBtn.Search, " 查询 ");
            }
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Entities ens = ClassFactory.GetEns(this.EnsName);
            Entity   en  = ens.GetNewEntity;
            Map      map = en.EnMap;

            this.Title = this.HisEn.EnMap.EnDesc;

            // this.ToolBar1.AddLab("sd", this.GenerCaption(this.HisEn.EnMap.EnDesc + "" + this.HisEn.EnMap.TitleExt));
            this.ToolBar1.AddLab("sd", "<b>" + this.HisEn.EnMap.EnDesc + "</b>:");

            this.ToolBar1.InitByMapV2(map, 1);

            #region 设置选择的 默认值
            //判断是否有传进来的设置的查询条件,如果有就设置为空。
            bool        isHave  = false;
            AttrSearchs searchs = map.SearchAttrs;
            foreach (AttrSearch attr in searchs)
            {
                string mykey = this.Request.QueryString[attr.Key];
                if (mykey == "" || mykey == null)
                {
                    continue;
                }
                isHave = true;
            }

            if (isHave == true)
            {
                this.ToolBar1.GetTBByID("TB_Key").Text = "";
                /*清空现有的查询条件设置 */
                foreach (AttrSearch attr in searchs)
                {
                    string mykey = this.Request.QueryString[attr.Key];
                    if (mykey == "" || mykey == null)
                    {
                        if (attr.Key == "FK_Dept")
                        {
                            this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem(WebUser.FK_Dept, attr.HisAttr);
                        }
                        else
                        {
                            this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem("all", attr.HisAttr);
                        }
                        continue;
                    }
                    this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem(mykey, attr.HisAttr);
                }
            }
            #endregion

            //   this.BPToolBar1.ButtonClick += new System.EventHandler(this.ButtonClick);
            if (en.HisUAC.IsInsert)
            {
                this.ToolBar1.AddLab("inse",
                                     "<input type=button class=Btn id='ToolBar1$Btn_New' name='ToolBar1$Btn_New' onclick=\"javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + this.EnsName + "','cd','" + BP.Sys.EnsAppCfgs.GetValInt(this.EnsName, "WinCardH") + "' , '" + BP.Sys.EnsAppCfgs.GetValInt(this.EnsName, "WinCardW") + "');\"  value='新建(N)' />");
            }

            if (WebUser.No == "admin")
            {
                this.ToolBar1.AddLab("sw", "<input type=button class=Btn  id='ToolBar1$Btn_P' class=Btn name='ToolBar1$Btn_P'  onclick=\"javascript:OpenAttrs('" + this.EnsName + "');\"  value='设置(P)'  />");
            }

            //this.ToolBar1.AddLab("sw", "<input type=button class=Btn  id='ToolBar1$Btn_P' name='ToolBar1$Btn_P'  onclick=\"javascript:OpenAttrs('" + this.EnsName + "');\"  value='设置(P)'  />");

            // this.ToolBar1.AddLab("s", "<input type=button onclick=\"javascript:OpenAttrs('" + this.EnsName + "');\"  value='设置(S)'  />");
            this.SetDGData();

            //输出执行信息。
            if (this.Session["Info"] != null)
            {
                if (this.Session["Info"].ToString().Contains("正在中止线程") ||
                    this.Session["Info"].ToString().Contains("Thread"))
                {
                    this.Session["Info"] = null;
                }
                else
                {
                    this.ResponseWriteBlueMsg(this.Session["Info"].ToString());
                    this.Session["Info"] = null;
                }
            }

            this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ButtonClick);
            //this.ToolBar1.Btn_Click();
            //   this.GenerLabel(this.Lab1, this.HisEn);
            //this.GenerLabel(this.Lab1, "<b>" + map.EnDesc + "</b>" + map.TitleExt);
            this.UCSys2.Add("<a href='./Sys/EnsDataIO.aspx?EnsName=" + this.EnsName + "' target=_blank><img src='/WF/Img/Btn/Excel.gif' border=0 />导入/导出</a>");
        }
示例#6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.DoType == "Print")
            {
                Bill b = new Bill(this.MyPK);
                b.DoOpen();
                return;
            }

            if (this.Request.QueryString["PageIdx"] == null)
            {
                this.PageIdx = 1;
            }
            else
            {
                this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]);
            }

            #region 处理查询设的默认.
            if (this.DoType == "My")
            {
                Entity      en      = this.HisEns.GetNewEntity;
                Map         map     = en.EnMap;
                AttrSearchs searchs = map.SearchAttrs;
            }
            else
            {
                #region 处理查询权限
                Entity en  = this.HisEns.GetNewEntity;
                Map    map = en.EnMap;
                this.ToolBar1.InitByMapV2(map, 1, this.EnsName);
                this.ToolBar1.AddBtn(BP.Web.Controls.NamesOfBtn.Export);
                AttrSearchs           searchs = map.SearchAttrs;
                string                defVal  = "";
                System.Data.DataTable dt      = null;
                foreach (AttrSearch attr in searchs)
                {
                    DDL mydll = this.ToolBar1.GetDDLByKey("DDL_" + attr.Key);
                    if (mydll == null)
                    {
                        continue;
                    }
                    defVal = mydll.SelectedItemStringVal;
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + this.EnsName + "','" + attr.Key + "')";
                    switch (attr.Key)
                    {
                    case "FK_Emp":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_Emp FROM WF_Bill WHERE FK_Emp!='' AND FK_Flow='" + this.FK_Flow + "' ORDER BY FK_Emp");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>打印人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FK_NY":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM WF_Bill WHERE FK_NY!='' AND FK_Flow='" + this.FK_Flow + "' ORDER BY FK_NY");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>月份", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            //  BP.WF.Bill
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FlowStarter":
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM WF_Emp WHERE  FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM WF_Bill WHERE FlowStarter!='')");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'ND" + int.Parse(this.FK_Flow) + "Rpt','" + attr.Key + "')";
                        break;

                    case "FK_Dept":
                        if (WebUser.No != "admin")
                        {
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            if (dt.Rows.Count == 0)
                            {
                                BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch();
                                dfs.FK_Dept = WebUser.FK_Dept;
                                dfs.FK_Emp  = WebUser.No;
                                dfs.FK_Flow = this.FK_Flow;
                                dfs.MyPK    = WebUser.FK_Dept + "_" + WebUser.No + "_" + this.FK_Flow;
                                dfs.Insert();
                                dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            }
                            mydll.Items.Clear();
                            foreach (DataRow dr in dt.Rows)
                            {
                                mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                            }
                        }

                        if (mydll.Items.Count >= 2)
                        {
                            ListItem liMvals = new ListItem("*多项组合..", "mvals");
                            liMvals.Attributes.CssStyle.Add("style", "color:green");
                            liMvals.Attributes.Add("color", "green");
                            liMvals.Attributes.Add("style", "color:green");
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    default:
                        break;
                    }
                }
                #endregion 处理查询权限
                this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick);
                this.ToolBar1.GetBtnByID(BP.Web.Controls.NamesOfBtn.Export).Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            }
            #endregion 处理查询设的默认。

            this.SetDGData();
        }
示例#7
0
    /// <summary>
    /// EnsName
    /// </summary>
    public void Bind()
    {
        BP.Sys.UserRegedit urd = new UserRegedit(WebUser.No, this.EnsName + "_SearchAttrs");
        Entities           ens = ClassFactory.GetEns(this.EnsName);
        Entity             en  = ens.GetNewEntity;

        this.Ucsys1.AddTable();
        this.Ucsys1.AddCaptionLeft("查询条件高级设置");

        //  AttrsOfSearch attrs = en.EnMap.AttrsOfSearch;
        //  Attrs attrs = en.EnMap.AttrsOfSearch;
        AttrSearchs attrs = en.EnMap.SearchAttrs;

        foreach (AttrSearch attr in attrs)
        {
            if (attr.Key.Contains("Text"))
            {
                continue;
            }

            if (attr.HisAttr.UIBindKey == null)
            {
                continue;
            }

            //if (attr.IsHidden)
            //    continue;

            //if (attr.DefaultVal.Length >= 8)
            //    continue;

            //if (attr.SymbolEnable == true)
            //    continue;

            this.Ucsys1.AddTR();
            // this.Ucsys1.AddTD(attr.Desc);
            /* 可以使用的情况. */
            //    Attr myattr = en.EnMap.GetAttrByKey(attr.Key);

            DDL ddl1 = new DDL(attr.HisAttr, urd.CfgKey, "enumLab", true, this.Page.Request.ApplicationPath);

            ddl1.ID = "DDL_" + attr.Key;

            this.Ucsys1.AddContral(attr.HisAttr.Desc, ddl1, true);
            this.Ucsys1.AddTREnd();
        }


        this.Ucsys1.AddTR();
        Btn btn = new Btn();

        btn.Text = "  确  定  ";
        btn.ID   = "Btn_OK";

        btn.Click += new EventHandler(btn_Click_OK);
        this.Ucsys1.AddTD(btn);

        btn        = new Btn();
        btn.Text   = "  取  消  ";
        btn.ID     = "Btn_Cancel";
        btn.Click += new EventHandler(btn_Click);
        this.Ucsys1.AddTD(btn);
        this.Ucsys1.AddTREnd();
        this.Ucsys1.AddTableEnd();
    }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.Page.RegisterClientScriptBlock("s",
                                                "<link href='./Style/Table" + BP.Web.WebUser.Style + ".css' rel='stylesheet' type='text/css' />");
            UAC uac = this.HisEn.HisUAC;

            if (uac.IsView == false)
            {
                throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限.");
            }

            if (this.IsReadonly)
            {
                uac.IsDelete = false;
                uac.IsInsert = false;
                uac.IsUpdate = false;
            }

            if (this.Request.QueryString["PageIdx"] == null)
            {
                this.PageIdx = 1;
            }
            else
            {
                this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]);
            }

            Entity   en  = this.HisEn;
            UIConfig cfg = new UIConfig(en);
            Map      map = en.EnMap;

            this.ShowWay = ShowWay.Dtl;
            if (uac.IsView == false)
            {
                throw new Exception("@对不起,您没有查看的权限!");
            }

            #region 设置toolbar2 的 contral  设置查寻功能.
            this.ToolBar1.InitByMapV2(map, 1);
            this.ToolBar1.AddSpt("spt2");
            this.ToolBar1.AddBtn(NamesOfBtn.Excel);
            bool isEdit = true;
            if (this.IsReadonly)
            {
                isEdit = false;
            }
            if (uac.IsInsert == false)
            {
                isEdit = false;
            }
            if (isEdit)
            {
                this.ToolBar1.AddLab("inse",
                                     "<input type=button id='ToolBar1$Btn_New' class=Btn name='ToolBar1$Btn_New' onclick=\"javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + this.EnsName + "','cd','" + cfg.WinCardH + "' , '" + cfg.WinCardW + "');\"  value='新建(N)'  />");
            }

            if (WebUser.No == "admin")
            {
                this.ToolBar1.AddLab("sw", "<input type=button class=Btn  id='ToolBar1$Btn_P' class=Btn name='ToolBar1$Btn_P'  onclick=\"javascript:OpenAttrs('" + this.EnsName + "');\"  value='设置(P)'  />");
            }
            #endregion

            #region 设置选择的 默认值
            AttrSearchs searchs = map.SearchAttrs;
            foreach (AttrSearch attr in searchs)
            {
                string mykey = this.Request.QueryString[attr.Key];
                if (mykey == "" || mykey == null)
                {
                    continue;
                }
                else
                {
                    this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem(mykey, attr.HisAttr);
                }
            }

            if (this.Request.QueryString["Key"] != null)
            {
                this.ToolBar1.GetTBByID("TB_Key").Text = this.Request.QueryString["Key"];
            }
            #endregion

            this.SetDGData();
            this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            this.ToolBar1.GetBtnByID("Btn_Excel").Click  += new System.EventHandler(this.ToolBar1_ButtonClick);
            this.Label1.Text = this.GenerCaption(this.HisEn.EnMap.EnDesc + "" + this.HisEn.EnMap.TitleExt);
        }
示例#9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            UAC uac = this.HisEn.HisUAC;

            if (uac.IsView == false)
            {
                throw new Exception("您没有查看[" + this.HisEn.EnDesc + "]数据的权限.");
            }

            if (this.IsReadonly)
            {
                uac.IsDelete = false;
                uac.IsInsert = false;
                uac.IsUpdate = false;
            }

            if (this.Request.QueryString["PageIdx"] == null)
            {
                this.PageIdx = 1;
            }
            else
            {
                this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]);
            }

            Entity   en  = this.HisEn;
            UIConfig cfg = new UIConfig(en);

            // edit by stone : 增加了实施的获取map, 可以让用户动态的设置查询条件.
            Map map = en.EnMapInTime;

            this.ShowWay = ShowWay.Dtl;
            if (uac.IsView == false)
            {
                throw new Exception("@对不起,您没有查看的权限!");
            }

            #region 设置toolbar2 的 contral  设置查寻功能.
            this.ToolBar1.InitByMapV2(map, 1);

            bool isEdit = true;
            if (this.IsReadonly)
            {
                isEdit = false;
            }
            if (uac.IsInsert == false)
            {
                isEdit = false;
            }

            string js = "javascript:ShowEn('./RefFunc/UIEn.aspx?EnsName=" + this.EnsName + "','cd','" + cfg.WinCardH + "' , '" + cfg.WinCardW + "');";
            if (isEdit)
            {
                this.ToolBar1.AddLinkBtn(NamesOfBtn.New, "新建", js);
            }

            js = "javascript:OpenAttrs('" + this.EnsName + "');";

            if (WebUser.No == "admin")
            {
                this.ToolBar1.AddLinkBtn(NamesOfBtn.Setting, "设置", js);
            }

            js = "javascript:DoExp();";
            this.ToolBar1.AddLinkBtn(NamesOfBtn.Excel, "导出", js);

            #endregion

            #region 设置选择的 默认值
            AttrSearchs searchs  = map.SearchAttrs;
            bool        isChange = false;
            foreach (AttrSearch attr in searchs)
            {
                string mykey = this.Request.QueryString[attr.Key];
                if (mykey == "" || mykey == null)
                {
                    continue;
                }
                else
                {
                    this.ToolBar1.GetDDLByKey("DDL_" + attr.Key).SetSelectItem(mykey, attr.HisAttr);
                    isChange = true;
                }
            }

            if (this.Request.QueryString["Key"] != null)
            {
                this.ToolBar1.GetTBByID("TB_Key").Text = this.Request.QueryString["Key"];
                isChange = true;
            }

            if (isChange == true)
            {
                /*如果是保存了*/
                this.ToolBar1.SaveSearchState(this.EnsName, null);
            }
            #endregion

            this.SetDGData();
            this.ToolBar1.GetLinkBtnByID(NamesOfBtn.Search).Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            this.Label1.Text = this.GenerCaption(this.HisEn.EnMap.EnDesc + "" + this.HisEn.EnMap.TitleExt);
            //临时文件名
            this.expFileName.Value = this.HisEns.GetNewEntity.EnDesc + "数据导出" + "_" + BP.DA.DataType.CurrentDataCNOfLong + "_" + WebUser.Name + ".xls";
        }
示例#10
0
        public void InitToolbar()
        {
            AttrSearchs searchs = null;

            #region 处理查询设的默认.
            if (this.DoType == "My")
            {
                #region 处理查询权限
                Entity en  = this.HisEns.GetNewEntity;
                Map    map = en.EnMap;
                this.ToolBar1.InitByMapV2(map, 1, this.EnsName);
                searchs = map.SearchAttrs;
                string defVal            = "";
                System.Data.DataTable dt = null;
                foreach (AttrSearch attr in searchs)
                {
                    DDL mydll = this.ToolBar1.GetDDLByKey("DDL_" + attr.Key);
                    if (mydll == null)
                    {
                        continue;
                    }
                    defVal = mydll.SelectedItemStringVal;
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + this.EnsName + "','" + attr.Key + "')";
                    switch (attr.Key)
                    {
                    case "FK_NY":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM " + this.EnsName + " WHERE FK_NY!='' ORDER BY FK_NY");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>月份", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FlowStarter":
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM WF_Emp WHERE  FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + this.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + this.EnsName + " WHERE FlowStarter!='')");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'ND" + int.Parse(this.FK_Flow) + "Rpt','" + attr.Key + "')";
                        break;

                    case "FK_Dept":
                        if (WebUser.No != "admin")
                        {
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + this.FK_Flow + "')");
                            if (dt.Rows.Count == 0)
                            {
                                this.Right.AddMsgOfWarning("提示", "<h2>系统管理员没有给您设置查询权限。</h2>");
                                this.ToolBar1.Controls.Clear();
                                return;
                            }
                            mydll.Items.Clear();
                            foreach (DataRow dr in dt.Rows)
                            {
                                mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                            }
                        }
                        if (mydll.Items.Count >= 2)
                        {
                            ListItem liMvals = new ListItem("*多项组合..", "mvals");
                            liMvals.Attributes.CssStyle.Add("style", "color:green");
                            liMvals.Attributes.Add("color", "green");
                            liMvals.Attributes.Add("style", "color:green");
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    default:
                        break;
                    }
                }
                #endregion 处理查询权限
            }
            else
            {
                #region 处理查询权限
                Entity en  = this.HisEns.GetNewEntity;
                Map    map = en.EnMap;
                this.ToolBar1.InitByMapV2(map, 1, this.EnsName);
                searchs = map.SearchAttrs;
                string defVal            = "";
                System.Data.DataTable dt = null;
                foreach (AttrSearch attr in searchs)
                {
                    DDL mydll = this.ToolBar1.GetDDLByKey("DDL_" + attr.Key);
                    if (mydll == null)
                    {
                        continue;
                    }
                    defVal = mydll.SelectedItemStringVal;
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + this.EnsName + "','" + attr.Key + "')";
                    switch (attr.Key)
                    {
                    case "FK_NY":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM " + this.EnsName + " WHERE FK_NY!='' ORDER BY FK_NY");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>月份", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FlowStarter":
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM WF_Emp WHERE  FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + this.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + this.EnsName + " WHERE FlowStarter!='')");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'ND" + int.Parse(this.FK_Flow) + "Rpt','" + attr.Key + "')";
                        break;

                    case "FK_Dept":
                        if (WebUser.No != "admin")
                        {
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + this.FK_Flow + "')");
                            if (dt.Rows.Count == 0)
                            {
                                this.Right.AddMsgOfWarning("提示", "<h2>系统管理员没有给您设置查询权限。</h2>");
                                this.ToolBar1.Controls.Clear();
                                return;
                            }
                            mydll.Items.Clear();
                            foreach (DataRow dr in dt.Rows)
                            {
                                mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                            }
                        }

                        if (mydll.Items.Count >= 2)
                        {
                            ListItem liMvals = new ListItem("*多项组合..", "mvals");
                            liMvals.Attributes.CssStyle.Add("style", "color:green");
                            liMvals.Attributes.Add("color", "green");
                            liMvals.Attributes.Add("style", "color:green");
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    default:
                        break;
                    }
                }
                #endregion 处理查询权限

                this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick);
                //  this.ToolBar1.GetBtnByID(BP.Web.Controls.NamesOfBtn.Export).Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            }
            #endregion 处理查询设的默认。
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 处理风格
            this.Page.RegisterClientScriptBlock("sds",
                                                "<link href='/WF/Comm/Style/Table" + BP.Web.WebUser.Style + ".css' rel='stylesheet' type='text/css' />");

            if (this.Request.QueryString["PageIdx"] == null)
            {
                this.PageIdx = 1;
            }
            else
            {
                this.PageIdx = int.Parse(this.Request.QueryString["PageIdx"]);
            }
            #endregion 处理风格

            //if (WebUser.IsWap)
            //{
            //    this.Pub1.Add("<a href='./../WAP/Home.aspx' ><img src='./../WAP/Img/Home.gif' />Home</a>");
            //    this.Pub1.Add("-<a href='./../WAP/FlowSearch.aspx' >查询</a>");
            //    this.Pub1.Add(" - <a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=My' ><img src='/WF/Img/Btn/Authorize.gif' />我参与的流程</a>");
            //    this.Pub1.Add(" - <a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=Dept' ><img src='/WF/Img/Btn/CC.gif' />我部门的流程</a><br>");
            //}
            //else
            //{
            //    this.Pub1.Add("<a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=My' ><img src='/WF/Img/Btn/Authorize.gif' />我参与的流程</a>");
            //    this.Pub1.Add(" - <a href='Search.aspx?FK_Flow=" + this.FK_Flow + "&EnsName=" + this.EnsName + "&DoType=Dept' ><img src='/WF/Img/Btn/CC.gif' />我部门的流程</a><br>");
            //}


            #region 处理查询设的默认.
            if (this.DoType == "My")
            {
                Entity      en      = this.HisEns.GetNewEntity;
                Map         map     = en.EnMap;
                AttrSearchs searchs = map.SearchAttrs;
            }
            else
            {
                #region 处理查询权限
                Entity en  = this.HisEns.GetNewEntity;
                Map    map = en.EnMap;
                this.ToolBar1.InitByMapV2(map, 1, this.EnsName);

                this.ToolBar1.AddBtn(BP.Web.Controls.NamesOfBtn.Export);
                AttrSearchs           searchs = map.SearchAttrs;
                string                defVal  = "";
                System.Data.DataTable dt      = null;
                foreach (AttrSearch attr in searchs)
                {
                    DDL mydll = this.ToolBar1.GetDDLByKey("DDL_" + attr.Key);
                    if (mydll == null)
                    {
                        continue;
                    }
                    defVal = mydll.SelectedItemStringVal;
                    mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'" + this.EnsName + "','" + attr.Key + "')";
                    switch (attr.Key)
                    {
                    case "FK_NY":
                        dt = DBAccess.RunSQLReturnTable("SELECT DISTINCT FK_NY FROM " + this.EnsName + " WHERE FK_NY!='' ORDER BY FK_NY");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>月份", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[0].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    case "FlowStarter":
                        dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM WF_Emp WHERE  FK_Dept IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "'  AND FK_Flow='" + this.FK_Flow + "') AND No IN (SELECT DISTINCT FlowStarter FROM " + this.EnsName + " WHERE FlowStarter!='')");
                        mydll.Items.Clear();
                        mydll.Items.Add(new ListItem("=>发起人", "all"));
                        foreach (DataRow dr in dt.Rows)
                        {
                            mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                        }
                        mydll.SetSelectItem(defVal);
                        mydll.Attributes["onchange"] = "DDL_mvals_OnChange(this,'ND" + int.Parse(this.FK_Flow) + "Rpt','" + attr.Key + "')";
                        break;

                    case "FK_Dept":
                        if (WebUser.No != "admin")
                        {
                            dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            if (dt.Rows.Count == 0)
                            {
                                BP.WF.Port.DeptFlowSearch dfs = new BP.WF.Port.DeptFlowSearch();
                                dfs.FK_Dept = WebUser.FK_Dept;
                                dfs.FK_Emp  = WebUser.No;
                                dfs.FK_Flow = this.FK_Flow;
                                dfs.MyPK    = WebUser.FK_Dept + "_" + WebUser.No + "_" + this.FK_Flow;
                                dfs.Insert();
                                dt = DBAccess.RunSQLReturnTable("SELECT No,Name FROM Port_Dept WHERE No IN (SELECT FK_Dept FROM  WF_DeptFlowSearch WHERE FK_Emp='" + WebUser.No + "' AND FK_Flow='" + this.FK_Flow + "')");
                            }
                            mydll.Items.Clear();
                            foreach (DataRow dr in dt.Rows)
                            {
                                mydll.Items.Add(new ListItem(dr[1].ToString(), dr[0].ToString()));
                            }
                        }

                        if (mydll.Items.Count >= 2)
                        {
                            ListItem liMvals = new ListItem("*多项组合..", "mvals");
                            liMvals.Attributes.CssStyle.Add("style", "color:green");
                            liMvals.Attributes.Add("color", "green");
                            liMvals.Attributes.Add("style", "color:green");
                        }
                        mydll.SetSelectItem(defVal);
                        break;

                    default:
                        break;
                    }
                }
                #endregion 处理查询权限

                this.ToolBar1.GetBtnByID("Btn_Search").Click += new System.EventHandler(this.ToolBar1_ButtonClick);
                this.ToolBar1.GetBtnByID(BP.Web.Controls.NamesOfBtn.Export).Click += new System.EventHandler(this.ToolBar1_ButtonClick);
            }
            #endregion 处理查询设的默认。

            //处理按钮.
            this.SetDGData();
        }