コード例 #1
0
        private void MyBind()
        {
            LabelCate_DP.DataSource = bll.GetLabelCateListXML();
            LabelCate_DP.DataBind();
            //----绑定第二步数据表
            DataTable dsList = dsBll.Sel();

            DBList_DP.Items.Add(new ListItem("系统主数据库", "main"));
            DBList2_DP.Items.Add(new ListItem("系统主数据库", "main"));
            foreach (DataRow dr in dsList.Rows)
            {
                ListItem item = new ListItem("[外]" + dr["DSName"].ToString(), dr["ID"].ToString());
                DBList_DP.Items.Add(item);
                DBList2_DP.Items.Add(item);
            }
            DBList_DP.Items.Add(new ListItem("+添加新数据库", "new"));
            DataTable tableDT = DS_GetByDP(D1).Table_List();

            BindTableListToDP(tableDT, TableList_DP);
            BindTableListToDP(tableDT, TableList2_DP);
            //---最终步
            CustomLabel_DP.DataSource = bll.GetLabelCateListXML();
            CustomLabel_DP.DataBind();
            CustomLabel_DP.Items.Insert(0, new ListItem("选择标签类型", ""));
            lblSys.Text = funBll.GetSysLabel(); //系统标签
            lblFun.Text = funBll.GetFunLabel(); //扩展函数
                                                //-----------------绑定已有数据
            if (!string.IsNullOrEmpty(LabelName))
            {
                M_Label labelMod = bll.GetLabelXML(LabelName);
                labelMod.LabelWhere = ClearTableHolder(labelMod.LabelWhere);
                labelMod.LabelField = ClearTableHolder(labelMod.LabelField);
                labelMod.LabelTable = ClearTableHolder(labelMod.LabelTable);
                labelMod.LabelOrder = ClearTableHolder(labelMod.LabelOrder);
                //第一步
                LabelName_T.Text            = labelMod.LableName;
                LabelCate_T.Text            = labelMod.LabelCate;
                LabelType_Rad.SelectedValue = labelMod.LableType.ToString();
                Desc_T.Text = labelMod.Desc;
                //schema_Text.Text = labelMod.ConnectString;
                //第二步
                string t1 = "", t2 = "";
                if (!string.IsNullOrEmpty(labelMod.DataSourceType) && labelMod.DataSourceType.StartsWith("{"))
                {
                    JObject jobj = JsonConvert.DeserializeObject <JObject>(labelMod.DataSourceType);
                    DBList_DP.SelectedValue  = jobj["ds_m"].ToString();
                    DBList2_DP.SelectedValue = jobj["ds_m"].ToString();
                    t1      = jobj["tb_m"].ToString();
                    t2      = jobj["tb_s"].ToString();
                    tableDT = DS_GetByDP(D1).Table_List();
                    BindTableListToDP(tableDT, TableList_DP);
                    BindTableListToDP(tableDT, TableList2_DP);
                }
                else
                {
                    B_Label.GetT1AndT2(labelMod.LabelTable, ref t1, ref t2);
                }
                TableList_DP.SelectedValue  = t1;
                TableList2_DP.SelectedValue = t2;
                TableList_DP_SelectedIndexChanged(null, null);
                TableList2_DP_SelectedIndexChanged(null, null);
                //是否启用了联接查询
                string joinType = B_Label.GetJoinType(labelMod.LabelTable);
                if (!string.IsNullOrEmpty(joinType))
                {
                    SqlJoin_DP.SelectedValue = joinType;
                    string on1 = "", on2 = "";
                    B_Label.GetOnField(labelMod.LabelTable, ref on1, ref on2);
                    OnField_DP.SelectedValue  = on1;
                    OnField2_DP.SelectedValue = on2;
                }
                SqlTable_T.Text = labelMod.LabelTable;
                SqlField_T.Text = labelMod.LabelField;
                //第三步
                RptParam_Bind(labelMod.Param);
                Param_Hid.Value = labelMod.Param;
                Where_T.Text    = labelMod.LabelWhere;
                Order_T.Text    = labelMod.LabelOrder;
                PSize_T.Text    = labelMod.LabelCount;
                //第四步
                textContent.Text              = labelMod.Content;
                Modeltypeinfo.Text            = labelMod.Modeltypeinfo;
                Modelvalue.Text               = labelMod.Modelvalue;
                setroot.SelectedValue         = labelMod.setroot;
                Valueroot.Text                = labelMod.Valueroot;
                BoolMode_Chk.Checked          = labelMod.IsOpen == 1;
                falsecontent.Text             = labelMod.FalseContent;
                bool_addroot_dp.SelectedValue = labelMod.addroot;
                Bread_L.Text = "当前标签:<a href='" + Request.RawUrl + "'>" + labelMod.LableName + "</a>";
            }
            if (string.IsNullOrEmpty(LabelName))
            {
                Bread_L.Text = "添加新标签";
                if (LabelCate_DP.Items.Count > 0)
                {
                    LabelCate_T.Text = LabelCate_DP.SelectedValue;
                }
            }
        }
コード例 #2
0
ファイル: LabelSql.aspx.cs プロジェクト: zoomlacms/web003
    private void MyBind()
    {
        LabelCate_DP.DataSource = bll.GetLabelCateListXML();
        LabelCate_DP.DataBind();
        //----绑定第二步数据表
        DBList_DP.Items.Add(new ListItem("系统主数据库", "main"));
        DBList_DP.Items.Add(new ListItem("从数据库", "second"));
        DBList_DP.Items.Add(new ListItem("+添加新数据库", "new"));
        DBList2_DP.Items.Add(new ListItem("系统主数据库", "main"));
        DBList2_DP.Items.Add(new ListItem("从数据库", "second"));
        DataTable tableDT = DBCenter.DB.Table_List();

        BindTableListToDP(tableDT, TableList_DP);
        BindTableListToDP(tableDT, TableList2_DP);
        //---最终步
        CustomLabel_DP.DataSource = bll.GetLabelCateListXML();
        CustomLabel_DP.DataBind();
        CustomLabel_DP.Items.Insert(0, new ListItem("选择标签类型", ""));
        lblSys.Text = funBll.GetSysLabel(); //系统标签
        lblFun.Text = funBll.GetFunLabel(); //扩展函数
        //-----------------绑定已有数据
        if (!string.IsNullOrEmpty(LabelName))
        {
            M_Label labelMod = bll.GetLabelXML(LabelName);
            //第一步
            LabelName_T.Text            = labelMod.LableName;
            LabelCate_T.Text            = labelMod.LabelCate;
            LabelType_Rad.SelectedValue = labelMod.LableType.ToString();
            Desc_T.Text = labelMod.Desc;
            //schema_Text.Text = labelMod.ConnectString;
            //第二步
            string t1 = "", t2 = "";
            B_Label.GetT1AndT2(labelMod.LabelTable, ref t1, ref t2);
            TableList_DP.SelectedValue  = t1;
            TableList2_DP.SelectedValue = t2;
            TableList_DP_SelectedIndexChanged(null, null);
            TableList2_DP_SelectedIndexChanged(null, null);
            //是否启用了联接查询
            string joinType = B_Label.GetJoinType(labelMod.LabelTable);
            if (!string.IsNullOrEmpty(joinType))
            {
                SqlJoin_DP.SelectedValue = joinType;
                string on1 = "", on2 = "";
                B_Label.GetOnField(labelMod.LabelTable, ref on1, ref on2);
                OnField_DP.SelectedValue  = on1;
                OnField2_DP.SelectedValue = on2;
            }
            SqlTable_T.Text = labelMod.LabelTable;
            SqlField_T.Text = labelMod.LabelField;
            //第三步
            RptParam_Bind(labelMod.Param);
            Param_Hid.Value = labelMod.Param;
            Where_T.Text    = labelMod.LabelWhere;
            Order_T.Text    = labelMod.LabelOrder;
            PSize_T.Text    = labelMod.LabelCount;
            //第四步
            textContent.Text              = labelMod.Content;
            Modeltypeinfo.Text            = labelMod.Modeltypeinfo;
            Modelvalue.Text               = labelMod.Modelvalue;
            setroot.SelectedValue         = labelMod.setroot;
            Valueroot.Text                = labelMod.Valueroot;
            BoolMode_Chk.Checked          = labelMod.IsOpen == 1;
            falsecontent.Text             = labelMod.FalseContent;
            bool_addroot_dp.SelectedValue = labelMod.addroot;
            Bread_L.Text = "当前标签:<a href='" + Request.RawUrl + "'>" + labelMod.LableName + "</a>";
        }
        if (string.IsNullOrEmpty(LabelName))
        {
            Bread_L.Text = "添加新标签";
        }
    }