private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     //Edit
     if (dataGridView1.Rows.Count == 0)
     {
         MessageBox.Show("Please choose 1 row for editing");
         return;
     }
     else
     {
         Frm_PHT_Card_GiaoNhanThe_Update a = new Frm_PHT_Card_GiaoNhanThe_Update();
         a.type = "1";
         a.card_nbr = dataGridView1["card_number", dataGridView1.CurrentCell.RowIndex].Value.ToString();
         a.ShowDialog();
         LoadDetails();
     }
 }
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.Rows.Count == 0)
            {
                MessageBox.Show("Please choose 1 row for editing");
                return;
            }
            else
            {
                string card_nbr = dataGridView1["card_number", dataGridView1.CurrentCell.RowIndex].Value.ToString();

                if (CheckCardExists(card_nbr.Trim()) == true)
                {
                    //đã có hoặc có lỗi
                    if (MessageBox.Show("Đã cập nhật thẻ này. Bạn có muốn cập nhật tình trạng?", "Thông Báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        Frm_PHT_Card_GiaoNhanThe_Update Frm_update = new Frm_PHT_Card_GiaoNhanThe_Update();
                        Frm_update.type = "1";
                        Frm_update.card_nbr = card_nbr;
                      //  this.Close();
                        Frm_update.ShowDialog();
                    }
                    else
                    {
                        ClearDetails();
                    }
                }
                else
                {
                    //Chưa có thì load Details
                    tbCardNbr.Text = card_nbr;
                    tbEmbosing.Text = dataGridView1["embossed_name", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                    tbStatus.Text = dataGridView1["status", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                    tbDelivery.Text = dataGridView1["delivery_flag", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                    tbClientNbr.Text = dataGridView1["client_code", dataGridView1.CurrentCell.RowIndex].Value.ToString(); ;
                    tbLegalNbr.Text = dataGridView1["legal_id", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                    tbBirthDate.Text = dataGridView1["birth_date", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                    tbProduct.Text = dataGridView1["product", dataGridView1.CurrentCell.RowIndex].Value.ToString();
                    dpDeliveryDate.Value = DateTime.ParseExact(DateTime.Now.ToString("dd/MM/yyyy"), "dd/MM/yyyy", CultureInfo.InvariantCulture); //DateTime.Now.ToString("dd/MM/yyyy");
                    cbNhanVienGiao.SelectedIndex = -1;
                    if (tbStatus.Text.Trim().ToUpper() != "NORMAL")
                    {
                        btSAVE.Enabled = false;
                        tbStatus.BackColor = Color.Yellow;
                    }
                    else
                    {
                        btSAVE.Enabled = true;
                        tbStatus.BackColor = Color.White;
                    }
                }

            }
        }