예제 #1
0
 public string Demo_HandlerDepts()
 {
     BP.Port.Depts depts = new BP.Port.Depts();
     depts.RetrieveAll();
     return(depts.ToJson());
 }
예제 #2
0
        public void SetDataV2()
        {
            this.UCSys1.Clear();

            Entities ens = DA.ClassFactory.GetEns(this.Request.QueryString["EnsName"]);

            ens.RetrieveAll();

            Entity en    = ens.GetNewEntity;
            string space = "";

            if (this.DropDownList1.SelectedValue == "None")
            {
                bool isGrade = ens.IsGradeEntities;
                if (isGrade)
                {
                    this.UCSys1.Add("<a name='top' ></a>");
                    int num = ens.GetCountByKey("Grade", 2);
                    if (num > 1)
                    {
                        int i = 0;
                        this.UCSys1.AddTable();
                        this.UCSys1.AddTR();
                        this.UCSys1.AddTDTitle("序号");
                        this.UCSys1.AddTDTitle("<img src='../Images/Home.gif' border=0 />数据选择导航");
                        this.UCSys1.AddTREnd();
                        foreach (Entity myen in ens)
                        {
                            if (myen.GetValIntByKey("Grade") != 2)
                            {
                                continue;
                            }

                            i++;
                            this.UCSys1.AddTR();
                            this.UCSys1.AddTDIdx(i);
                            this.UCSys1.AddTD("<a href='#ID" + myen.GetValStringByKey(this.RefKey) + "' >&nbsp;&nbsp;" + myen.GetValStringByKey(this.RefKey) + "&nbsp;&nbsp;" + myen.GetValStringByKey(this.RefText) + "</a>");
                            this.UCSys1.AddTREnd();
                        }
                        this.UCSys1.AddTableEnd();
                    }
                }

                this.UCSys1.AddTable();
                this.UCSys1.AddTR();
                this.UCSys1.AddTDTitle("IDX");
                this.UCSys1.AddTDTitle("");
                this.UCSys1.AddTREnd();

                bool is1 = false;

                int idx = 0;
                foreach (Entity myen in ens)
                {
                    idx++;
                    is1 = this.UCSys1.AddTR(is1);
                    this.UCSys1.AddTDIdx(idx);
                    RadioBtn rb = new RadioBtn();
                    rb.GroupName = "s";
                    if (isGrade)
                    {
                        int grade = myen.GetValIntByKey("Grade");
                        space = "";
                        space = space.PadLeft(grade - 1, '-');
                        space = space.Replace("-", "&nbsp;&nbsp;&nbsp;");
                        //    this.UCSys1.AddTD(space);
                        switch (grade)
                        {
                        case 2:
                            rb.Text = "<a href='#top' name='ID" + myen.GetValStringByKey(this.RefKey) + "' ><Img src='../Images/Top.gif' border=0 /></a><b><font color=green>" + myen.GetValStringByKey(this.RefKey) + myen.GetValStringByKey(this.RefText) + "</font></b>";
                            break;

                        case 3:
                            rb.Text = "<b>" + myen.GetValStringByKey(this.RefKey) + myen.GetValStringByKey(this.RefText) + "</b>";
                            break;

                        default:
                            rb.Text = myen.GetValStringByKey(this.RefKey) + myen.GetValStringByKey(this.RefText);
                            break;
                        }
                    }
                    else
                    {
                        rb.Text = myen.GetValStringByKey(this.RefText);
                    }
                    rb.ID = "RB_" + myen.GetValStringByKey(this.RefKey);

                    string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();";
                    rb.Attributes["onclick"] = clientscript;
                    //this.UCSys1.Add(rb);
                    //this.UCSys1.AddBR();
                    this.UCSys1.AddTD(rb);
                    this.UCSys1.AddTREnd();
                }
                this.UCSys1.AddTableEnd();
                return;
            }

            string key  = this.DropDownList1.SelectedValue;
            Attr   attr = en.EnMap.GetAttrByKey(key);

            if (attr.MyFieldType == FieldType.Enum || attr.MyFieldType == FieldType.PKEnum)
            {
                SysEnums ses = new SysEnums(attr.Key);
                this.UCSys1.AddTable(); //("<TABLE border=1 >");
                foreach (SysEnum se in ses)
                {
                    this.UCSys1.Add("<TR><TD class='Toolbar'>");
                    this.UCSys1.Add(se.Lab);
                    this.UCSys1.Add("</TD></TR>");

                    this.UCSys1.Add("<TR><TD>");

                    #region add dtl
                    this.UCSys1.AddTable();
                    int i = -1;
                    foreach (Entity myen in ens)
                    {
                        if (myen.GetValIntByKey(attr.Key) != se.IntKey)
                        {
                            continue;
                        }

                        i++;
                        if (i == 3)
                        {
                            i = 0;
                        }
                        if (i == 0)
                        {
                            this.UCSys1.Add("<TR>");
                        }

                        RadioBtn rb = new RadioBtn();
                        rb.GroupName = "dsfsd";
                        rb.Text      = myen.GetValStringByKey(this.RefText);
                        rb.ID        = "RB_" + myen.GetValStringByKey(this.RefKey);

                        string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();";
                        // rb.Attributes["ondblclick"] = clientscript;
                        rb.Attributes["onclick"] = clientscript;

                        this.UCSys1.AddTD(rb);

                        if (i == 2)
                        {
                            this.UCSys1.Add("</TR>");
                        }
                    }
                    this.UCSys1.Add("</TABLE>");
                    #endregion add dtl.

                    this.UCSys1.Add("</TD></TR>");
                }
                this.UCSys1.Add("</TABLE>");
                return;
            }

            if (attr.Key == "FK_Dept")
            {
                BP.Port.Depts Depts = new BP.Port.Depts();
                Depts.RetrieveAll();

                this.UCSys1.AddTR();
                this.UCSys1.AddTDToolbar("一级分组");
                this.UCSys1.AddTREnd();

                this.UCSys1.AddTR();
                this.UCSys1.AddTDBegin();

                this.UCSys1.AddTable();
                /* 显示导航信息 */
                int i = 0;
                //int span = 2;
                foreach (BP.Port.Dept Dept in Depts)
                {
                    if (Dept.Grade == 2 || Dept.Grade == 1)
                    {
                        i++;
                        this.UCSys1.Add("<TR>");
                        this.UCSys1.AddTDIdx(i);
                        this.UCSys1.AddTD("<a href='#ID_2" + Dept.No + "' >&nbsp;&nbsp;" + Dept.No + "&nbsp;&nbsp;" + Dept.Name + "</a><BR>");
                        this.UCSys1.Add("</TR>");
                    }
                }
                this.UCSys1.AddTableEnd();
                this.UCSys1.AddTDEnd();
                this.UCSys1.AddTREnd();


                // =====================
                this.UCSys1.AddTR();
                this.UCSys1.AddTDToolbar("二级分组");
                this.UCSys1.AddTREnd();

                this.UCSys1.AddTDBegin();
                this.UCSys1.AddTable();
                /* 显示导航信息 */
                // int i = 0;
                //int span = 2;
                i = 0;
                foreach (BP.Port.Dept Dept in Depts)
                {
                    i++;
                    this.UCSys1.Add("<TR>");
                    this.UCSys1.AddTDIdx(i);
                    if (Dept.Grade == 2)
                    {
                        this.UCSys1.AddTD("&nbsp;&nbsp;<a name='ID_2" + Dept.No + "' >" + Dept.No + "</A>&nbsp;&nbsp;<a href='#ID" + Dept.No + "' ><b>" + Dept.Name + "</b></a><A HREF='#top'><Img src='../Images/Top.gif' border=0 /></a><BR>");
                    }
                    else
                    {
                        this.UCSys1.AddTD("&nbsp;&nbsp;" + Dept.No + "&nbsp;&nbsp;<a href='#ID" + Dept.No + "' name='#ID_2" + Dept.No + "' >" + Dept.Name + "</a><BR>");
                    }

                    this.UCSys1.Add("</TR>");
                }
                this.UCSys1.Add("</Table>");
                this.UCSys1.Add("</TD></TR>");


                //============ 数据
                foreach (BP.Port.Dept groupen in Depts)
                {
                    this.UCSys1.Add("<TR><TD class='Toolbar' >");
                    this.UCSys1.Add("<a href='#ID_2" + groupen.No + "' name='ID" + groupen.No + "' ><Img src='../Images/Top.gif' border=0 /></a>&nbsp;&nbsp;" + groupen.GetValStringByKey(attr.UIRefKeyText));
                    this.UCSys1.Add("</TD></TR>");
                    this.UCSys1.Add("<TR><TD>");

                    #region add info .
                    this.UCSys1.AddTable();
                    i = -1;
                    foreach (Entity myen in ens)
                    {
                        if (myen.GetValStringByKey(attr.Key) != groupen.GetValStringByKey(attr.UIRefKeyValue))
                        {
                            continue;
                        }

                        i++;
                        if (i == 3)
                        {
                            i = 0;
                        }

                        if (i == 0)
                        {
                            this.UCSys1.Add("<TR>");
                        }

                        RadioBtn rb = new RadioBtn();
                        rb.GroupName = "dsfsd";
                        rb.Text      = myen.GetValStringByKey(this.RefText);
                        rb.ID        = "RB_" + myen.GetValStringByKey(this.RefKey);

                        string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();";
                        // rb.Attributes["ondblclick"] = clientscript;
                        rb.Attributes["onclick"] = clientscript;

                        this.UCSys1.AddTD(rb);

                        if (i == 2)
                        {
                            this.UCSys1.Add("</TR>");
                        }
                    }
                    this.UCSys1.Add("</Table>");
                    #endregion add info .

                    this.UCSys1.Add("</TD></TR>");
                }
                this.UCSys1.Add("</TABLE>");
            }
            else
            {
                Entities groupens = ClassFactory.GetEns(attr.UIBindKey);
                groupens.RetrieveAll();

                this.UCSys1.AddTable(); //("<TABLE border=1 >");
                if (groupens.Count > 19)
                {
                    this.UCSys1.Add("<TR><TD class='Toolbar' ><img src='../Images/Home.gif' border=0 />数据选择导航&nbsp;&nbsp;&nbsp;<font size='2'>提示:点分组连接就可到达分组数据</font></TD></TR>");

                    this.UCSys1.Add("<TR><TD>");
                    this.UCSys1.AddTable();
                    /* 显示导航信息 */
                    int i = 0;
                    //int span = 2;
                    foreach (Entity groupen in groupens)
                    {
                        i++;
                        this.UCSys1.AddTR();
                        this.UCSys1.AddTDIdx(i);
                        this.UCSys1.AddTD("<a href='#ID" + groupen.GetValStringByKey(attr.UIRefKeyValue) + "' >&nbsp;&nbsp;" + groupen.GetValStringByKey(attr.UIRefKeyValue) + "&nbsp;&nbsp;" + groupen.GetValStringByKey(attr.UIRefKeyText) + "</a><BR>");
                        this.UCSys1.AddTREnd();
                    }
                    this.UCSys1.Add("</Table>");
                    this.UCSys1.Add("</TD></TR>");
                }

                foreach (Entity groupen in groupens)
                {
                    this.UCSys1.Add("<TR><TD class='Toolbar' >");
                    this.UCSys1.Add("<a href='#top' name='ID" + groupen.GetValStringByKey(attr.UIRefKeyValue) + "' ><Img src='../Images/Top.gif' border=0 /></a>&nbsp;&nbsp;" + groupen.GetValStringByKey(attr.UIRefKeyText));
                    this.UCSys1.Add("</TD></TR>");

                    this.UCSys1.Add("<TR><TD>");

                    #region add info .
                    this.UCSys1.AddTable();
                    int i = -1;
                    foreach (Entity myen in ens)
                    {
                        if (myen.GetValStringByKey(attr.Key) != groupen.GetValStringByKey(attr.UIRefKeyValue))
                        {
                            continue;
                        }

                        i++;
                        if (i == 3)
                        {
                            i = 0;
                        }

                        if (i == 0)
                        {
                            this.UCSys1.AddTR();
                        }

                        RadioBtn rb = new RadioBtn();
                        rb.GroupName = "dsfsd";
                        rb.Text      = myen.GetValStringByKey(this.RefText);
                        rb.ID        = "RB_" + myen.GetValStringByKey(this.RefKey);

                        string clientscript = "window.returnValue = '" + myen.GetValStringByKey(this.RefKey) + "';window.close();";
                        // rb.Attributes["ondblclick"] = clientscript;
                        rb.Attributes["onclick"] = clientscript;

                        this.UCSys1.AddTD(rb);

                        if (i == 2)
                        {
                            this.UCSys1.AddTREnd();
                        }
                    }

                    this.UCSys1.AddTableEnd();
                    #endregion add info .

                    this.UCSys1.Add("</TD></TR>");
                }
                this.UCSys1.AddTableEnd();
            }
        }