private void editbranchbtn_Click(object sender, EventArgs e) { if (editlocationtxt.Text == String.Empty) { MessageBox.Show("Fill all Fields", "Required", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (editcomboadmin.SelectedIndex > 0) { B.Br_Admin_ID = itemid[editcomboadmin.SelectedIndex]; } B.Location = editlocationtxt.Text; ServiceBranch.BranchServiceClient s = new ServiceBranch.BranchServiceClient(); ServiceBranch.Branchdata data = new ServiceBranch.Branchdata(); data = s.updateBranch(B); if (data != null) { MessageBox.Show("Edit Successfully", "Edit", MessageBoxButtons.OK, MessageBoxIcon.Information); Load_data(); AddPanel.Hide(); EditPanel.Hide(); List.Show(); } else { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void editbranchbtn_Click(object sender, EventArgs e) { B.Br_Admin_ID = UserInfo.id; B.Location = editlocationtxt.Text; ServiceBranch.BranchServiceClient s = new ServiceBranch.BranchServiceClient(); ServiceBranch.Branchdata data = new ServiceBranch.Branchdata(); data = s.updateBranch(B); if (data != null) { MessageBox.Show("Edit Successfully", "Edit", MessageBoxButtons.OK, MessageBoxIcon.Information); Load_data(); List.Show(); EditPanel.Hide(); } else { MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { DialogResult r = CustomMessage.Show("Operation", "Select Edit or Delete", "Edit", "Delete", "Cancel"); if (r == DialogResult.Yes) { DataGridViewRow row = branchdata.Rows[e.RowIndex]; B.Id = Int32.Parse(row.Cells["Id"].Value.ToString()); B.Br_Admin_ID = Int32.Parse(row.Cells["Br_Admin_ID"].Value.ToString()); B.Location = row.Cells["Location"].Value.ToString(); editlocationtxt.Text = B.Location; EditPanel.Show(); List.Hide(); AddPanel.Hide(); } else if (r == DialogResult.No) { DataGridViewRow row = branchdata.Rows[e.RowIndex]; ServiceBranch.BranchServiceClient sb = new ServiceBranch.BranchServiceClient(); ServiceBranch.Branchdata data = new ServiceBranch.Branchdata(); data = sb.deleteBranch(Int32.Parse(row.Cells["Id"].Value.ToString())); if (data != null) { MessageBox.Show("Deleted successfully", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); Load_data(); } } else { } }