private void button1_Click(object sender, EventArgs e) { HanhKhach_Form HK = _service.GetRequiredService <HanhKhach_Form>(); HK.Show(); DoanKhach_Form DK = _service.GetRequiredService <DoanKhach_Form>(); DK.Show(); }
private void tabHanhKhach_AddBtn_Click(object sender, EventArgs e) { HanhKhach_Form form = _serviceProvider.GetRequiredService <HanhKhach_Form>(); form.editState = EditState.Create; var main = this.Location; form.Location = new Point((main.X + 10), (main.Y + 10)); form.Show(); }
private void HanhKhachGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } var grid = (DataGridView)sender; var name = grid.Columns[e.ColumnIndex].Name; var value = grid.Rows[e.RowIndex].Cells["tabHanhKhach_IDCol"].Value.ToString(); switch (name) { case "tabHanhKhach_ViewCol": { HanhKhach_Form form = _serviceProvider.GetRequiredService <HanhKhach_Form>(); form.editState = EditState.View; form.setId(int.Parse(value)); var main = this.Location; form.Location = new Point((main.X + 10), (main.Y + 10)); form.Show(); break; } case "tabHanhKhach_EditCol": { HanhKhach_Form form = _serviceProvider.GetRequiredService <HanhKhach_Form>(); form.editState = EditState.Edit; form.setId(int.Parse(value)); var main = this.Location; form.Location = new Point((main.X + 10), (main.Y + 10)); form.Show(); break; } case "tabHanhKhach_DeleteCol": { var khach = _hanhkhachRepo.getById(int.Parse(value)); var messageResult = MessageBox.Show("Bạn có chắc muốn xóa " + khach.Ten, "Warning", MessageBoxButtons.YesNo); if (messageResult != DialogResult.Yes) { return; } _hanhkhachRepo.Delete(khach); tabHanhKhach_Search(); break; } } }
private void HanhKhachGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } var grid = (DataGridView)sender; var name = grid.Columns[e.ColumnIndex].Name; if (name == "tabHanhKhach_EditCol" || name == "tabHanhKhach_ViewCol" || name == "tabHanhKhach_DeleteCol") { return; } var value = grid.Rows[e.RowIndex].Cells["tabHanhKhach_IDCol"].Value.ToString(); HanhKhach_Form form = _serviceProvider.GetRequiredService <HanhKhach_Form>(); form.editState = EditState.View; form.setId(int.Parse(value)); var main = this.Location; form.Location = new Point((main.X + 10), (main.Y + 10)); form.Show(); }