private void buttonEdit_Click(object sender, EventArgs e) { var client = _clientService.GetByName(treeViewClients.SelectedNode.Text); var editClientForm = new EditClientForm(client); editClientForm.ShowDialog(); MainFormUtils.SetRoot(treeViewClients, _clientService.GetRootClients()); }
private static void ClientsForm_OnEditClientButtonClick(object sender, EditClientArgs e) { EditForm = new EditClientForm(); EditForm.SaveButtonClick += UpdateClient; int clientId = int.Parse(e.SelectedItem.Text); using (var db = DBHelper.GetConnection()) { EditForm.FillForm(db.Find <Client>(clientId)); } EditForm.ShowDialog(); }
private void EditMainClientbutton_Click(object sender, EventArgs e) { if (MainClientsdataGridView.SelectedRows.Count > 0 && MainClientsdataGridView.SelectedRows.Count < 2) { int clientid = int.Parse(MainClientsdataGridView.SelectedRows[0].Cells[0].Value.ToString()); EditClientForm editClientForm = new EditClientForm(clientid); editClientForm.FormClosed += closed; editClientForm.ShowDialog(); } else { MessageBox.Show(" اختر العميل المراد تعديله فقط", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
/// <summary> /// Открытие формы с передачей объекта типа Client /// </summary> private void butEditClient_Click() { Client client = _mainView.SelectedClient; var main = Application.OpenForms.OfType <XtraForm>().First(f => f.Name.Equals("MainForm")); var clientEdit = new EditClientForm(); clientEdit.Owner = main; clientEdit.StartPosition = FormStartPosition.CenterParent; clientEdit.Client = client; clientEdit.txtClientEditCode.Text = client.Client_Code.ToString(); clientEdit.txtClientEditName.Text = client.Client_Name; cities._cities.ForEach(c => clientEdit.cmbEditCities.Items.Add(c)); clientEdit.cmbEditCities.SelectedItem = client.Client_City; var clientEditPresenter = new EditClientFormPresenter(clientEdit); clientEdit.ShowDialog(); }