private PipMessage getMessage(string pipid) { string sql = string.Format("SELECT * FROM MessagesFromLOB where PIPInstanceID='{0}' ", pipid); PipMessage msg = new PipMessage(); using (SqlConnection db = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Db"])) { db.Open(); SqlCommand cmd = db.CreateCommand(); cmd.CommandText = sql; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { msg.PipCode = reader.GetString(8); msg.PipVer = reader.GetString(9); msg.Source = reader.GetString(7); msg.Destination = reader.GetString(6); msg.PipId = reader.GetString(1); string doccontent = reader.GetString(3); int i = doccontent.LastIndexOf("[<"); int l = doccontent.LastIndexOf("]]"); //XDocument doc = new XDocument(doccontent.Substring(i,l); MessageBox.Show(doccontent.Substring(i + 1, (l - i) - 1)); msg.XmlContent = doccontent.Substring(i + 1, (l - i) - 1); this.DialogResult = DialogResult.OK; } } return(msg); }
private PipMessage getMessage(string pipid) { string sql = string.Format("SELECT * FROM MessagesFromLOB where PIPInstanceID='{0}' ", pipid); PipMessage msg = new PipMessage(); using (SqlConnection db = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["Db"])) { db.Open(); SqlCommand cmd = db.CreateCommand(); cmd.CommandText = sql; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { msg.PipCode = reader.GetString(8); msg.PipVer = reader.GetString(9); msg.Source = reader.GetString(7); msg.Destination = reader.GetString(6); msg.PipId = reader.GetString(1); string doccontent = reader.GetString(3); int i = doccontent.LastIndexOf("[<"); int l = doccontent.LastIndexOf("]]"); //XDocument doc = new XDocument(doccontent.Substring(i,l); MessageBox.Show(doccontent.Substring(i+1,(l-i)-1)); msg.XmlContent = doccontent.Substring(i + 1, (l - i) - 1); this.DialogResult = DialogResult.OK; } } return msg; }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int idx= e.RowIndex; if (idx > -1) { DataGridViewRow row = this.dataGridView1.Rows[idx]; _pipmessage = getMessage(row.Cells[1].Value.ToString()); } }
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int idx = e.RowIndex; if (idx > -1) { DataGridViewRow row = this.dataGridView1.Rows[idx]; _pipmessage = getMessage(row.Cells[1].Value.ToString()); } }
private void button1_Click(object sender, EventArgs e) { FindPIPMessages frm = new FindPIPMessages(); DialogResult res = frm.ShowDialog(); if (res == DialogResult.OK) { PipMessage msg = frm._pipmessage; this.sourceParty.Text = msg.Source; this.destinationParty.Text = msg.Destination; this.pipName.Text = msg.PipCode; this.pipVersion.Text = msg.PipVer; this.xmlcontenttxt.Text = msg.XmlContent; this.messageCategory.SelectedIndex = 0; } }