Esempio 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(',');
                    }
                }
            }
        }
Esempio n. 2
0
 //启用
 protected void btnuse_Click(object sender, EventArgs e)
 {
     try
     {
         string TemplateID = hidtemplateid.Value.Trim();
         if (!string.IsNullOrEmpty(TemplateID))
         {
             QueryConfigComponent qcc = new QueryConfigComponent();
             DataTable            qdt = qcc.GetUserQueryColListByTemplateID(Guid.Parse(TemplateID));
             if (qdt != null && qdt.Rows.Count > 0)
             {
                 string tstatus = "FREE";
                 TemplateManageComponent tcc = new TemplateManageComponent();
                 DataTable dt = tcc.GetListByTemplateID(TemplateID);
                 if (dt != null && dt.Rows.Count > 0)//判断有无页面
                 {
                     tstatus = "ENABLE";
                 }
                 if (tmbll.EnableTemplateInfo(TemplateID, tstatus))
                 {
                     //刷新模板缓存
                     BusinessSearchComponent bsbll = new BusinessSearchComponent();
                     bsbll.RefreshTemplateByGuid(TemplateID);
                     hidtemplateid.Value = "";
                     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "suseenable", "layer.alert('模板启用成功!',9);", true);
                     BindTemplateList();
                 }
                 else
                 {
                     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "suseenable", "layer.alert('模板启用失败!',8);", true);
                 }
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "suseenablerror", "layer.alert('模板未配置完成,无法启用!',8);", true);
             }
         }
     }
     catch (Exception ee)
     {
         BaseComponent.Error(ee.Message);
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "suseenablcatch", "layer.alert('模板启用出错!',8);", true);
     }
 }