private void buttonSelectId_Click_1(object sender, EventArgs e)
        {
            SelectContactForm SelectContactF = new SelectContactForm();

            SelectContactF.ShowDialog();
            try
            {
                if (SelectContactF.dataGridViewListContact.Rows.Count != 0)
                {
                    int       contactId = Convert.ToInt32(SelectContactF.dataGridViewListContact.CurrentRow.Cells[0].Value.ToString());
                    DataTable table     = BUSContact.getContactById(contactId);

                    this.textBoxId.Text              = table.Rows[0]["Id"].ToString();
                    this.textBoxFname.Text           = table.Rows[0]["fname"].ToString();
                    this.textBoxlname.Text           = table.Rows[0]["lname"].ToString();
                    this.comboBoxGroup.SelectedValue = table.Rows[0]["group_id"];
                    this.textBoxPhone.Text           = table.Rows[0]["phone"].ToString();
                    this.textBoxEmail.Text           = table.Rows[0]["email"].ToString();
                    this.textBoxAdress.Text          = table.Rows[0]["address"].ToString();
                    byte[]       pic     = (byte[])table.Rows[0]["picture"];
                    MemoryStream picture = new MemoryStream(pic);
                    this.PictureBoxStudentImage.Image = Image.FromStream(picture);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Loi " + ex.Message, "Edit Contact", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
 private void btnSelectCnt_Click(object sender, EventArgs e)
 {
     try
     {
         SelectContactForm SelectContactF = new SelectContactForm();
         SelectContactF.ShowDialog();
         if (SelectContactF.dataGridViewListContact.RowCount != 0)
         {
             int contactId          = Convert.ToInt32(SelectContactF.dataGridViewListContact.CurrentRow.Cells[0].Value.ToString());
             SelectContactForm form = new SelectContactForm();
             this.txtContact.Text = contactId.ToString();
         }
         //int id = int.Parse(this.txtContact.Text);
         //DataTable table = this.contact.getContactbyID(id);
         //if (table.Rows.Count > 0)
         //{
         //    MessageBox.Show("có tồn tại contact này");
         //}
         //else
         //{
         //    MessageBox.Show("Không tồn tại contact này vui lòng chọn lại");
         //}
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 3
0
        private void buttonSelect_Click_1(object sender, EventArgs e)
        {
            SelectContactForm SelectContactF = new SelectContactForm();

            SelectContactF.ShowDialog();
            try
            {
                int       contactId = Convert.ToInt32(SelectContactF.dataGridViewListContact.CurrentRow.Cells[0].Value.ToString());
                DataTable table     = BUSContact.getContactById(contactId);

                this.textBoxContactID.Text = table.Rows[0]["Id"].ToString();
            }
            catch (Exception)
            {
                MessageBox.Show("Loi", "Select Contact", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 4
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            SelectContactForm SelectContactF = new SelectContactForm();

            SelectContactF.ShowDialog();
            try
            {
                if (SelectContactF.dataGridViewListContact.Rows.Count != 0)
                {
                    this.IDContact = Convert.ToInt32(SelectContactF.dataGridViewListContact.CurrentRow.Cells[0].Value.ToString());
                    DataTable table = BUScontact.getContactById(IDContact);
                    this.txtID.Text = table.Rows[0]["Id"].ToString();
                    this.reloadListBoxData();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Loi", "Edit Contact", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }