Ejemplo n.º 1
0
        private void btnENTER_Click(object sender, EventArgs e)
        {
            Friend f = new Friend();

            f.XM    = txtXM.Text;
            f.XB    = comboBoxXB.Text;
            f.SJH   = txtSJH.Text;
            f.DZ    = txtDZ.Text;
            f.Email = txtEMAIL.Text;
            f.JG    = cmbProvince.Text + " " + cmbCity.Text + " " + cmbdiqu.Text;
            f.QQ    = txtQQ.Text;
            f.WX    = txtWX.Text;
            if (!String.IsNullOrEmpty(PicHead.ImageLocation))
            {
                int index = PicHead.ImageLocation.LastIndexOf(@"\");
                f.Photo = PicHead.ImageLocation.Substring(index + 1);
            }

            f.PY       = txtPY.Text;
            f.Birthday = dtpBirthday.Value.ToString("yyyy-MM-dd");
            Service1 service = new Service1();
            int      x       = service.AddFriend(f);

            if (x == 1)
            {
                MessageBox.Show("添加朋友成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("添加朋友失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Close();
        }