private void btn_ClientAdd_Click(object sender, EventArgs e) { Form_Detail_Client f = new Form_Detail_Client(0, true); f.myDel = LoadData; this.Hide(); f.ShowDialog(); this.Show(); //Reload Data }
//--- fllaypn_ClientButtons ---// private void btn_ClientView_Click(object sender, EventArgs e) { if (dgv.SelectedRows.Count == 1) { //truyền ID_CLient Form_Detail_Client f = new Form_Detail_Client(int.Parse(dgv.SelectedRows[0].Cells["IdClient"].Value.ToString()), false); f.myDel = LoadData; this.Hide(); f.ShowDialog(); this.Show(); } else { MessageBox.Show("Please choose only one row to view!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_ClientEdit_Click(object sender, EventArgs e) { if (dgv.SelectedRows.Count == 1) { if ((bool)dgv.SelectedRows[0].Cells["CliActiveflag"].Value == true) { Form_Detail_Client f = new Form_Detail_Client(int.Parse(dgv.SelectedRows[0].Cells["IdClient"].Value.ToString()), true); f.myDel = LoadData; this.Hide(); f.ShowDialog(); this.Show(); } else { MessageBox.Show("Can't update inactive clients!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Please choose only one row to update!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }