using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Reflection; using System.Text; using System.Windows.Forms; namespace SOH.FenZhen.Client { public partial class FrmJiaohao : Form { public FrmJiaohao() { InitializeComponent(); } FrmShowJiaohao fsjh; string ksname; public kstjMessage pdOne = new kstjMessage(); public DataTable ToDataTable(IList list) { DataTable result = new DataTable(); if (list.Count > 0) { PropertyInfo[] propertys = list[0].GetType().GetProperties(); foreach (PropertyInfo pi in propertys) { result.Columns.Add(pi.Name, pi.PropertyType); } for (int i = 0; i < list.Count; i++) { ArrayList tempList = new ArrayList(); foreach (PropertyInfo pi in propertys) { object obj = pi.GetValue(list[i], null); tempList.Add(obj); } object[] array = tempList.ToArray(); result.LoadDataRow(array, true); } } return result; } private void FrmJiaohao_Load(object sender, EventArgs e) { FrmCall fc = (FrmCall)this.Owner; DataTable dt = new DataTable(); dt = ToDataTable(fc.pdlist); if (dt.Rows.Count != 0) { this.dataGridView1.DataSource = dt; this.dataGridView1.Rows[0].Selected = false; } } private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { pdOne.xm = dataGridView1.Rows[e.RowIndex].Cells["Column1"].Value.ToString(); pdOne.pdid = 0; pdOne.pdsj = DateTime.Now; pdOne.zxzt = 0; System.Configuration.Configuration congf = SOH.Configuration.LocalConfig.Config; if (congf.AppSettings.Settings.AllKeys.Contains("wlksname")) { ksname = congf.AppSettings.Settings["wlksname"].Value; } this.TopMost = true; fsjh = new FrmShowJiaohao(); Point mf = new Point(); foreach (var s in Screen.AllScreens) { if (!s.Primary) { mf = s.Bounds.Location; fsjh.Location = mf; fsjh.TopLevel = true; fsjh.TopMost = true; fsjh.ksname = ksname; fsjh.Owner = this; fsjh.WindowState = FormWindowState.Maximized; fsjh.StartPosition = FormStartPosition.Manual; fsjh.Show(); return; } } fsjh.shuaxin(); } private void button1_Click(object sender, EventArgs e) { this.Close(); } } }