コード例 #1
0
        private void Newfenlei_Click(object sender, EventArgs e)//添加分组
        {
            Newfenlei f = new Newfenlei();

            f.ShowDialog();
            if (f.DialogResult == DialogResult.OK)
            {
                Listfenzu.Items.Clear();
                sql = new SqlHelp("data source=mydb.db");
                SQLiteDataReader reader = sql.ReadFullTable("fenzu");
                while (reader.Read())
                {
                    Listfenzu.Items.Add(reader.GetString(reader.GetOrdinal("Name")));
                }
                sql.CloseConnection();
            }
        }
コード例 #2
0
 private void NewOK_Click(object sender, EventArgs e)
 {
     if (NewContent.Text != "")
     {
         sql = new SqlHelp("data source=mydb.db");
         sql.CreateTable("fenzu", new string[] { "Name" }, new string[] { "TEXT" });
         sql.InsertValues("fenzu", new string[] { NewContent.Text });
         sql.CloseConnection();
         MessageBox.Show("添加成功!");
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         MessageBox.Show("分组名称不能为空!");
     }
 }
コード例 #3
0
 private void OK_Click(object sender, EventArgs e)
 {
     if (tname.Text.Trim() == "")
     {
         MessageBox.Show("姓名不能为空!");
     }
     else if (tfenlei.Text.Trim().Length == 0)
     {
         MessageBox.Show("请务必选择分组");
     }
     else
     {
         name = tname.Text;
         if (tphone.Text.Trim() != "")
         {
             phone = tphone.Text;
         }
         if (temail.Text.Trim() != "")
         {
             email = temail.Text;
         }
         if (tqq.Text.Trim() != "")
         {
             qq = tqq.Text;
         }
         if (tweixin.Text.Trim() != "")
         {
             weixin = tweixin.Text;
         }
         if (tbeizhu.Text.Trim() != "")
         {
             beizhu = tbeizhu.Text;
         }
         fenlei = tfenlei.SelectedItem.ToString();
         sql    = new SqlHelp("data source=mydb.db");
         sql.InsertValues("tongxunlu", new string[] { name, phone, fenlei, email, qq, weixin, beizhu });
         MessageBox.Show("添加成功");
         sql.CloseConnection();
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     //MessageBox.Show(name);
 }
コード例 #4
0
        public XGview()
        {
            InitializeComponent();
            tname.Text   = InfoClass.TName;
            tphone.Text  = InfoClass.Phone;
            temail.Text  = InfoClass.Email;
            tqq.Text     = InfoClass.QQ;
            tweixin.Text = InfoClass.Weixin;
            tbeizhu.Text = InfoClass.Info;
            sql          = new SqlHelp("data source=mydb.db");
            SQLiteDataReader reader = sql.ReadFullTable("fenzu");

            while (reader.Read())
            {
                int i = 0;
                tfenlei.Items.Insert(i, reader.GetString(reader.GetOrdinal("Name")));
                i++;
            }
            sql.CloseConnection();
        }
コード例 #5
0
 private void XGButton_Click(object sender, EventArgs e)
 {
     if (ListView.SelectedItems.Count > 0)
     {
         InfoClass.TName  = ListView.FocusedItem.SubItems[0].Text;
         InfoClass.Phone  = ListView.FocusedItem.SubItems[1].Text;
         InfoClass.Email  = ListView.FocusedItem.SubItems[3].Text;
         InfoClass.QQ     = ListView.FocusedItem.SubItems[4].Text;
         InfoClass.Weixin = ListView.FocusedItem.SubItems[5].Text;
         InfoClass.Info   = ListView.FocusedItem.SubItems[6].Text;
         XGview f = new XGview();
         f.ShowDialog();
         if (f.DialogResult == DialogResult.OK)
         {
             sql = new SqlHelp("data source=mydb.db");
             ListView.Items.Clear();
             //读取整张表
             SQLiteDataReader reader = sql.ReadFullTable("tongxunlu");
             this.ListView.BeginUpdate();   //数据更新,UI暂时挂起,直到EndUpdate绘制控件,可以有效避免闪烁并大大提高加载速度
             while (reader.Read())
             {
                 ListViewItem lvi = new ListViewItem();
                 lvi.Text = reader.GetString(reader.GetOrdinal("Name"));
                 lvi.SubItems.Add(reader.GetString(reader.GetOrdinal("Phone")));
                 lvi.SubItems.Add(reader.GetString(reader.GetOrdinal("Groups")));
                 lvi.SubItems.Add(reader.GetString(reader.GetOrdinal("Email")));
                 lvi.SubItems.Add(reader.GetString(reader.GetOrdinal("QQ")));
                 lvi.SubItems.Add(reader.GetString(reader.GetOrdinal("Weixin")));
                 lvi.SubItems.Add(reader.GetString(reader.GetOrdinal("Info")));
                 this.ListView.Items.Add(lvi);
             }
             this.ListView.EndUpdate();  //结束数据处理,UI界面一次性绘制。 sql.CloseConnection();
             sql.CloseConnection();
             ImageList imgList = new ImageList();
             imgList.ImageSize       = new Size(1, 35);//分别是宽和高
             ListView.SmallImageList = imgList;
             MessageBox.Show("修改成功");
         }
     }
 }
コード例 #6
0
 private void OK_Click(object sender, EventArgs e)
 {
     if (tfenlei.Text.Trim().Length == 0)
     {
         MessageBox.Show("请务必选择分组");
     }
     else
     {
         name = tname.Text;
         if (tphone.Text.Trim() != "")
         {
             phone = tphone.Text;
         }
         if (temail.Text.Trim() != "")
         {
             email = temail.Text;
         }
         if (tqq.Text.Trim() != "")
         {
             qq = tqq.Text;
         }
         if (tweixin.Text.Trim() != "")
         {
             weixin = tweixin.Text;
         }
         if (tbeizhu.Text.Trim() != "")
         {
             beizhu = tbeizhu.Text;
         }
         fenlei = tfenlei.SelectedItem.ToString();
         sql    = new SqlHelp("data source=mydb.db");
         sql.UpdateValues("tongxunlu", new string[] { "Name", "Phone", "Groups", "Email", "QQ", "Weixin", "Info" }, new string[] { name, phone, fenlei, email, qq, weixin, beizhu }, "Name", InfoClass.TName);
         sql.CloseConnection();
         this.Close();
     }
 }