protected void BindDataSourceList() { ViewState["id"] = null; int i, j; string SourceName = txtSourceName.Text.Trim(); ViewState["txtSourceName"] = SourceName; string SourceIP = txtSourceIP.Text.Trim(); ViewState["txtSourceIP"] = SourceIP; string DBName = txtDBName.Text.Trim(); ViewState["txtDBName"] = DBName; string ObjectType = ""; if (!string.IsNullOrWhiteSpace(hidisdefault.Value)) { ObjectType = (ddlDataType.SelectedValue == "all" ? "" : ddlDataType.SelectedValue); } ViewState["ddlDataType"] = ObjectType; string ObjectName = txtObjectName.Text; ViewState["txtObjectName"] = ObjectName; string SourceStatus = ""; if (!string.IsNullOrWhiteSpace(hidisdefault.Value)) { SourceStatus = (ddlStatus.SelectedValue == "all" ? "" : ddlStatus.SelectedValue); } ViewState["ddlStatus"] = SourceStatus; int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; string bigcate = (ddlCATEGORY.SelectedValue == "all" ? "" : ddlCATEGORY.SelectedValue); ViewState["ddlCATEGORY"] = bigcate; string smallcate = (ddlsmallcategory.SelectedValue == "all" ? "" : ddlsmallcategory.SelectedValue); ViewState["ddlsmallcategory"] = smallcate; DataSourceConfigComponent tmbll = new DataSourceConfigComponent(); DataTable dt = tmbll.GetDataSourceList(SourceName, SourceIP, DBName, ObjectType, ObjectName, SourceStatus, bigcate, smallcate, "", AspNetPager1.CurrentPageIndex, PageSize, out i, out j); AspNetPager1.RecordCount = i; DataSourceList.DataSource = dt; DataSourceList.DataBind(); if (dt == null || dt.Rows.Count == 0) { lblnodata.Visible = true; } else { lblnodata.Visible = false; } ReCodePager(); //ViewState["TemplateList"] = dt; }
protected void BindDataSourceList() { int i, j; string SourceName = txtSourceName.Text.Trim(); string SourceIP = txtSourceIP.Text.Trim(); string DBName = txtDBName.Text.Trim(); string ObjectType = ddlDataType.SelectedValue; string ObjectName = txtObjectName.Text; int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; DataSourceConfigComponent tmbll = new DataSourceConfigComponent(); DataTable dt = tmbll.GetDataSourceList(SourceName, SourceIP, DBName, ObjectType, ObjectName, "", AspNetPager1.CurrentPageIndex, PageSize, out i, out j); AspNetPager1.RecordCount = i; DataSourceList.DataSource = dt; DataSourceList.DataBind(); }
protected string GetTemplateInfoBySourceID(string SourceID) { string pinfo = string.Empty; if (!string.IsNullOrEmpty(SourceID)) { DataSourceConfigComponent pbll = new DataSourceConfigComponent(); DataTable dt = pbll.GetTemplateListBySourceID(SourceID); if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { pinfo += dr["TemplateName"].ToString() + ","; } } } return(pinfo.TrimEnd(',')); }
protected void BindDataSourceListByOrderBy(string orderby) { int i, j; string SourceName = (ViewState["txtSourceName"] == null?txtSourceName.Text.Trim():ViewState["txtSourceName"].ToString()); string SourceIP = (ViewState["txtSourceIP"] == null?txtSourceIP.Text.Trim():ViewState["txtSourceIP"].ToString()); string DBName = (ViewState["txtDBName"] == null?txtDBName.Text.Trim():ViewState["txtDBName"].ToString()); string ObjectType = (ViewState["ddlDataType"] == null?ddlDataType.SelectedValue:ViewState["ddlDataType"].ToString()); string ObjectName = (ViewState["txtObjectName"] == null?txtObjectName.Text.Trim():ViewState["txtObjectName"].ToString()); string SourceStatus = (ViewState["ddlStatus"] == null?ddlStatus.SelectedValue:ViewState["ddlStatus"].ToString()); int startIndex = (AspNetPager1.CurrentPageIndex - 1) * AspNetPager1.PageSize + 1; int PageSize = AspNetPager1.PageSize; string bigcate = (ViewState["ddlCATEGORY"] == null?ddlCATEGORY.SelectedValue:ViewState["ddlCATEGORY"].ToString()); string smallcate = (ViewState["ddlsmallcategory"] == null?ddlsmallcategory.SelectedValue:ViewState["ddlsmallcategory"].ToString()); DataSourceConfigComponent tmbll = new DataSourceConfigComponent(); DataTable dt = tmbll.GetDataSourceList(SourceName, SourceIP, DBName, ObjectType, ObjectName, SourceStatus, bigcate, smallcate, orderby, AspNetPager1.CurrentPageIndex, PageSize, out i, out j); AspNetPager1.RecordCount = i; DataSourceList.DataSource = dt; DataSourceList.DataBind(); //ViewState["TemplateList"] = dt; ReCodePager(); }
//删除 protected void lbtndel_Click(object sender, EventArgs e) { try { string TemplateID = hidtemplateid.Value.Trim(); string SourceID = hidsourceid.Value.Trim(); if (!string.IsNullOrEmpty(TemplateID)) { //删除通信配置 CommunicationConfigComponent cccbll = new CommunicationConfigComponent(); cccbll.DeleteCommunicationByTemplateID(TemplateID); if (tmbll.DelTemplateInfo(TemplateID)) { hidtemplateid.Value = ""; if (!string.IsNullOrEmpty(SourceID)) { //删除后查询原数据源是否还有被其它模板引用,没有则更新状态为空闲 ConnectionConfigComponent ccc = new ConnectionConfigComponent(); DataTable dstable = ccc.GetTemplateIDBySourceID(Guid.Parse(SourceID)); if (dstable == null || dstable.Rows.Count == 0) { DataSourceConfigComponent dbll = new DataSourceConfigComponent(); dbll.UpdateSourceStatusBySourceID(hidsourceid.Value.Trim()); } } ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "sdel", "layer.alert('模板删除成功!',9);", true); BindTemplateList(); } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "sdel", "layer.alert('模板删除失败!',8);", true); } } } catch (Exception ee) { BaseComponent.Error(ee.Message); } }