예제 #1
0
        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);
            }
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string edit = string.Empty;
                if (!string.IsNullOrEmpty(Page.Request.QueryString["type"]))
                {
                    hidisedit.Value = "edit";
                }
                if (!string.IsNullOrEmpty(Page.Request.QueryString["sourceID"]))
                {
                    try
                    {
                        hidsourceid.Value = Page.Request.QueryString["sourceID"];
                        CMICT.CSP.Model.BS_DATASOURCE model = bll.GetModel(Guid.Parse(hidsourceid.Value));
                        if (model != null)
                        {
                            BindBigCategory();
                            CommunicationConfigComponent dcserver = new CommunicationConfigComponent(model.SourceIP, model.UserName, model.Password, model.DBName);
                            if (!string.IsNullOrEmpty(Page.Request.QueryString["templateID"]))
                            {
                                hidTemplateID.Value = Page.Request.QueryString["templateID"];
                                BindCommunicationData();

                                DataTable dtTargetColumns = dcserver.GetSourceDataColumnBytemID(hidTemplateID.Value, model.ObjectType, model.ObjectName);
                                //DataTable dtTargetColumns = dc.GetDataColumnByTemplateID(hidTemplateID.Value);
                                ViewState["TargetColumns"] = dtTargetColumns;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        BaseComponent.Error("CommunicationConfig-页面加载出错:" + ex.Message);
                    }
                }
            }
        }