private void btnUpdate_Click(object sender, EventArgs e) { ClientDetails clientModel = new ClientDetails(); //Client Details int i = ClientDGView.SelectedCells[0].RowIndex; clientModel.ClientId = (int)ClientDGView.CurrentRow.Cells[0].Value; clientModel.Name = ClientDGView.Rows[i].Cells[1].Value.ToString(); ContactDetails contactDetails = new ContactDetails(); //Client Contact contactDetails.CellNumber = ClientDGView.Rows[i].Cells[7].Value.ToString(); contactDetails.WorkTel = ClientDGView.Rows[i].Cells[8].Value.ToString(); //Client Address AddressDetails clientAddress = new AddressDetails(); clientAddress.WorkAddress = ClientDGView.Rows[i].Cells[5].Value.ToString(); clientAddress.ResAddress = ClientDGView.Rows[i].Cells[4].Value.ToString(); clientAddress.PosAddress = ClientDGView.Rows[i].Cells[6].Value.ToString(); clientServiceClient.UpdateClient(clientModel.ClientId, clientModel, clientAddress, contactDetails); MessageBox.Show("Client Updated Succesfully", "Update Status", MessageBoxButtons.OK); HomeForm home = new HomeForm(); Hide(); home.Show(); }
private void btnAdd_Click(object sender, EventArgs e) { ClientDetails clientModel = new ClientDetails(); //Client Details clientModel.Name = txtName.Text; clientModel.Gender = comboBox1.SelectedItem.ToString(); ContactDetails contactDetails = new ContactDetails(); //Client Contact contactDetails.CellNumber = txtCell.Text; contactDetails.WorkTel = txtWorkTel.Text; //Client Address AddressDetails clientAddress = new AddressDetails(); clientAddress.WorkAddress = txtWorkAddress.Text; clientAddress.ResAddress = txtResAddress.Text; clientAddress.PosAddress = txtPosAddress.Text; clientService.InsertClientDetails(clientModel, clientAddress, contactDetails); MessageBox.Show("Client Added Succesfully", "Create Status", MessageBoxButtons.OK); HomeForm home = new HomeForm(); Hide(); home.Show(); }
private void deleteClientToolStripMenuItem_Click(object sender, EventArgs e) { ClientDetails clientModel = new ClientDetails(); //Client Details int i = ClientDGView.SelectedCells[0].RowIndex; clientModel.ClientId = (int)ClientDGView.CurrentRow.Cells[0].Value; clientModel.Status = "NOT ACTIVE"; clientServiceClient.DeleteClient(clientModel.ClientId); MessageBox.Show("Client Deleted Succesfully", "Delete Status", MessageBoxButtons.OK); HomeForm home = new HomeForm(); Hide(); home.Show(); }