protected void btnAddNew_Click(object sender, EventArgs e) { try { trbig.Attributes.Add("style", "display:;"); trsmall.Attributes.Add("style", "display:;"); //BindSourceTemplate(); txtName.Value = ""; txtSelected.Text = ""; DataTable dt = new DataTable(); CommunicationDetailList.DataSource = dt; CommunicationDetailList.DataBind(); ddlSourceTemplate.Enabled = true; ddlCATEGORY.SelectedIndex = 0; ddlsmallcategory.Items.Clear(); ddlSourceTemplate.Items.Clear(); ddlsmallcategory.Items.Insert(0, new ListItem("请选择", "")); ddlSourceTemplate.Items.Insert(0, new ListItem("请选择", "")); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showDetail", "showDetail();", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertException", "javascript:showMessage('操作发生错误:" + ex.Message.Replace("'", "").Replace("\"", "") + "!',8);", true); } }
protected void btnEdit_Click(object sender, EventArgs e) { try { trbig.Attributes.Add("style", "display:none;"); trsmall.Attributes.Add("style", "display:none;"); BindSourceTemplate("", ""); string communicationID = hidCommunicationID.Value; if (communicationID.Length <= 0) { return; } DataTable dtCommu = dc.GetCommunicationConfigInfoByID(communicationID); string sourceTemplateID = ""; if (dtCommu != null && dtCommu.Rows.Count > 0) { sourceTemplateID = Convert.ToString(dtCommu.Rows[0]["SourceTemplateID"]); txtName.Value = Convert.ToString(dtCommu.Rows[0]["Name"]); } if (!string.IsNullOrEmpty(sourceTemplateID)) { ddlSourceTemplate.Items.FindByValue(sourceTemplateID).Selected = true; txtSourceTemplate.Text = sourceTemplateID; CMICT.CSP.Model.BS_DATASOURCE model = bll.GetModel(sourceTemplateID); if (model != null) { CommunicationConfigComponent dcserver = new CommunicationConfigComponent(model.SourceIP, model.UserName, model.Password, model.DBName); DataTable dtSourceColumns = dcserver.GetSourceDataColumnBytemID(sourceTemplateID, model.ObjectType, model.ObjectName); if (dtSourceColumns != null && dtSourceColumns.Rows.Count > 0) { foreach (DataRow dr in dtSourceColumns.Rows) { dr["TargetColumnName"] = dc.GetTargetColumnNameByColNameAndComid(dr["ColumnName"].ToString(), communicationID); } } //DataTable dtSourceColumns = dc.GetCommunicationDetailByID(communicationID); CommunicationDetailList.DataSource = dtSourceColumns; CommunicationDetailList.DataBind(); if (dtSourceColumns != null) { txtSelected.Text = dtSourceColumns.Rows.Count.ToString(); } } } ddlSourceTemplate.Enabled = false; ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showDetail", "showDetail();", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertException", "javascript:showMessage('操作发生错误:" + ex.Message.Replace("'", "").Replace("\"", "") + "!',8);", true); } }
protected void ddlSourceTemplate_SelectedIndexChanged(object sender, EventArgs e) { try { string sourceTemplateID = ddlSourceTemplate.SelectedValue; if (!string.IsNullOrEmpty(sourceTemplateID)) { CMICT.CSP.Model.BS_DATASOURCE model = bll.GetModel(sourceTemplateID); if (model != null) { CommunicationConfigComponent dcserver = new CommunicationConfigComponent(model.SourceIP, model.UserName, model.Password, model.DBName); DataTable dtCommu = dcserver.GetSourceDataColumnBytemID(sourceTemplateID, model.ObjectType, model.ObjectName); CommunicationDetailList.DataSource = dtCommu; CommunicationDetailList.DataBind(); } } ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showDetail", "showDetail();", true); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alertException", "javascript:showMessage('操作发生错误:" + ex.Message.Replace("'", "").Replace("\"", "") + "!',8);", true); } }