Ejemplo n.º 1
0
        //根据sourceid获取数据源信息
        protected void BindColumnList()
        {
            string           sourceid = hidsourceid.Value.Trim();
            BS_DATASOURCEBLL blld     = new BS_DATASOURCEBLL();

            CMICT.CSP.Model.BS_DATASOURCE model = blld.GetModel(Guid.Parse(sourceid));
            string templateid = hidTemplateID.Value.Trim();

            if (model != null)
            {
                if (!string.IsNullOrEmpty(templateid))//绑定已经配置的列名与显示名信息
                {
                    DataTable dtt = bll.GetUserQueryColListByTemplateID(Guid.Parse(templateid));
                    if (dtt != null && dtt.Rows.Count > 0)
                    {
                        string configcolinfo = string.Empty;
                        foreach (DataRow drr in dtt.Rows)
                        {
                            configcolinfo += Convert.ToString(drr["name"]) + "|" + Convert.ToString(drr["DisplayName"]) + ";";
                        }
                        hidconfigcolinfo.Value = configcolinfo;
                    }
                }
                DataTable dt = dc.GetColumnListByType(model.ObjectType, model.ObjectName, "");

                //绑定默认筛选条件中列名下拉
                ddlColumnName.DataSource     = dt;
                ddlColumnName.DataTextField  = "name";
                ddlColumnName.DataValueField = "data_type";
                ddlColumnName.DataBind();
                ddlColumnName.Items.Insert(0, new ListItem("请选择", ""));
                ViewState["DfColumnList"] = dt;
                //绑定排序中列名下拉
                ddluqcol.DataSource     = dt;
                ddluqcol.DataTextField  = "name";
                ddluqcol.DataValueField = "name";
                ddluqcol.DataBind();
                ddluqcol.Items.Insert(0, new ListItem("请选择", ""));
                ViewState["ColumnList"] = dt;
                if (model.ObjectType == "PROC")
                {
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        string paralist = string.Empty;
                        foreach (DataRow dr in dt.Rows)
                        {
                            string cname = Convert.ToString(dr["name"]).Trim();
                            if (cname.IndexOf('@') != -1)
                            {
                                paralist += cname + ",";
                            }
                        }
                        hidprocparalist.Value = paralist.TrimEnd(',');
                    }
                }
            }
        }
Ejemplo n.º 2
0
        //根据sourceid获取数据源信息
        protected void BindColumnList()
        {
            string           sourceid = hidsourceid.Value.Trim();
            BS_DATASOURCEBLL bll      = new BS_DATASOURCEBLL();

            CMICT.CSP.Model.BS_DATASOURCE model = bll.GetModel(Guid.Parse(sourceid));
            if (model != null)
            {
                DataTable dt = dcserver.GetColumnListByType(model.ObjectType, model.ObjectName);
                ColumnList.DataSource = dt;
                ColumnList.DataBind();
                //绑定排序中列名下拉
                ddlColumnName.DataSource     = dt;
                ddlColumnName.DataTextField  = "name";
                ddlColumnName.DataValueField = "name";
                ddlColumnName.DataBind();
                ddlColumnName.Items.Insert(0, new ListItem("请选择", ""));
                //if (ddlDisplayType.SelectedValue == "ROW")
                //{
                //    rptgroupcol.DataSource = dt;
                //    rptgroupcol.DataBind();
                //}
            }
        }