Пример #1
0
    public void BindToolBar()
    {
        BP.Port.Depts Depts = new BP.Port.Depts();
        Depts.RetrieveAll();


        BP.DA.Paras ps = new Paras();
        ps.SQL = "SELECT NO ,NAME FROM TAX_Dept WHERE ( GRADE>=3 ) AND NO LIKE '%'||:Dept||'%' order by no ";
        ps.Add("Dept", WebUser.FK_Dept);

        System.Data.DataTable dt = DBAccess.RunSQLReturnTable(ps);
        foreach (DataRow dr in dt.Rows)
        {
            ListItem li = new ListItem();
            li.Value = dr["No"].ToString();
            li.Text  = dr["No"] + dr["Name"].ToString();
            this.DropDownList1.Items.Add(li);
        }

        //ToolbarDDL ddl = new ToolbarDDL("DDL_Dept",Depts,"No","Name",false);
        // ddl.BindEntities(Depts, false, AddAllLocation.None);
        //this.BPToolBar1.AddDDL(ddl, false);
        //this.BPToolBar1.AddBtn("Btn_Search", "关键字");
    }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region  组织维度数据源.
            BP.Pub.YFs ens1 = new BP.Pub.YFs();
            ens1.RetrieveAll();

            BP.Port.Depts ens2 = new BP.Port.Depts();
            ens2.RetrieveAll();

            BP.Port.Emps ens3 = new BP.Port.Emps();
            ens3.RetrieveAll();
            #endregion  组织维度数据源.

            // 组织数据源.
            EmpCents ensData = new EmpCents();
            ensData.RetrieveAll();

            //开始输出.
            this.Pub1.AddTable();
            this.Pub1.AddCaption("员工月份考勤得分");

            #region  输出维度1
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("部门");
            this.Pub1.AddTDTitle("人员");

            foreach (BP.Pub.YF en1 in ens1)
            {
                this.Pub1.AddTDTitle(en1.Name);
            }
            this.Pub1.AddTREnd();
            #endregion  输出维度1


            #region  输出表体
            foreach (BP.Port.Dept en2 in ens2)
            {
                int numOfD2 = ens3.GetCountByKey(BP.Port.EmpAttr.FK_Dept, en2.No);

                if (numOfD2 == 0)
                {
                    continue; // 如果没有数据源就continue.
                }
                this.Pub1.AddTR();
                this.Pub1.AddTD("rowspan=" + numOfD2, en2.Name);
                int idx = -1;
                foreach (BP.Port.Emp en3 in ens3)
                {
                    if (en3.FK_Dept != en2.No)
                    {
                        continue;
                    }

                    idx++;
                    if (idx == 0) // 第一条记录.
                    {
                    }
                    else
                    {
                        this.Pub1.AddTR();
                    }

                    this.Pub1.AddTD(en3.Name);
                    foreach (BP.Pub.YF en1 in ens1)
                    {
                        TextBox tb = new TextBox();
                        tb.CssClass = "TBNum";
                        tb.ID       = "TB_" + en1.No + "_" + en3.No;
                        EmpCent enData = ensData.GetEntityByKey(EmpCentAttr.FK_Emp, en3.No, EmpCentAttr.FK_NY, en1.No) as EmpCent;
                        if (enData == null)
                        {
                            tb.Text = "0";
                            this.Pub1.AddTD(tb);
                        }
                        else
                        {
                            tb.Text = enData.Cent.ToString();
                            this.Pub1.AddTD(tb);
                        }
                    }

                    this.Pub1.AddTREnd();
                }
                this.Pub1.AddTREnd();
            }
            #endregion  输出表体
            this.Pub1.AddTableEndWithHR();

            Button btn = new Button();
            btn.ID     = "Btn_Save";
            btn.Text   = "保存";
            btn.Click += new EventHandler(btn_Click);

            this.Pub1.Add(btn);
        }
        /// <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, " 查询 ");
            }
        }
Пример #4
0
 /// <summary>
 /// 选择部门呈现信息.
 /// </summary>
 /// <returns></returns>
 public string CC_SelectDepts()
 {
     BP.Port.Depts depts = new BP.Port.Depts();
     depts.RetrieveAll();
     return(depts.ToJson());
 }