Пример #1
0
        private void cbxKey_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    DInfo     info = new DInfo();
                    DataTable dt   = info.GetData(cbxKey.Text.Trim(), SystemInfo.userId);
                    dt = info.GetData(cbxKey.Text.Trim(), SystemInfo.userId);
                    StringBuilder contents = new StringBuilder("");
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        contents.Append(dt.Rows[i][1].ToString() + "\n");
                    }

                    if (dt.Rows.Count > 0)
                    {
                        FrmInfoDetail detail = new FrmInfoDetail(contents.ToString());
                        this.Close();
                        detail.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteErrLog(ex);
            }
        }
Пример #2
0
        private void InitalData()
        {
            try
            {
                DInfo     info = new DInfo();
                DataTable dt   = info.GetData("", SystemInfo.userId);

                List <string> infoList = new List <string>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    MInfo model = new MInfo();
                    model.Title   = dt.Rows[i][0].ToString();
                    model.Content = dt.Rows[i][1].ToString();
                    list.Add(model);
                }
            }
            catch (Exception ex)
            {
                Log.WriteErrLog(ex);
            }
        }