private void initForm() { this.txtCustomerName.Text = ""; this.txtPhoneNumber.Text = ""; this.customerEditForm = null; this.customerManagementDtos = new List <CustomerManagementDto>(); this.customerManagementDtos = this.customerManagementBus.GetAllCustomer(); if (this.customerManagementDtos.Count <= 0) { MessageBox.Show(MessageContent.GET_CUSTOMER_ERROR, MessageTitle.GET_CUSTOMER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } this.reloadDataGridView(); }
// Xử lý khi double click trường [Dánh sách khách hàng] private void doubleClickRow(object sender, EventArgs e) { if (this.customerManagementDtos.Count <= 0) { return; } if (this.dgvListCustomer.SelectedRows.Count == 0) { return; } string index = this.dgvListCustomer.SelectedRows[0].Cells[0].Value.ToString(); CustomerManagementDto tempDto = this.customerManagementDtos[Convert.ToInt32(index) - 1]; this.customerEditForm = new frm_CustomerEdit(tempDto); this.customerEditForm.FormClosing += new FormClosingEventHandler(formClosing); this.customerEditForm.Show(); }