private ClientForm ShowClientForm(int clientREF, bool editMode = false) { try { ClientForm clientForm; if (!(cf is ClientForm)) { clientForm = new ClientForm(); cf = clientForm; cf.Dock = DockStyle.Fill; clientFormFrame.Controls.Clear(); clientFormFrame.Controls.Add(cf); } else { clientForm = (ClientForm)cf; } if (editMode) clientForm.ShowAndEdit(clientREF); else clientForm.Show(clientREF); return clientForm; } catch (Exception exc) { Msg.ReferToTechSupport(exc); return null; } }
void kmEdit_Click(object sender, EventArgs e) { try { if (toc.SelectedNode == null) return; if (toc.SelectedNode is TnClient) { ClientForm cf = ShowClientForm(((TnClient)toc.SelectedNode).Client.Id, editMode: true); if (cf != null) cf.Focus(); } else { cf = null; clientFormFrame.Controls.Clear(); } } catch (Exception exc) { Msg.ReferToTechSupport(exc); } }
void tsStaff_Click(object sender, EventArgs e) { try { PersonForm personForm = new PersonForm(); cf = personForm; cf.Dock = DockStyle.Fill; clientFormFrame.Controls.Clear(); clientFormFrame.Controls.Add(cf); } catch (Exception exc) { Msg.ReferToTechSupport(exc); } }
void toc_AfterSelect(object sender, TreeViewEventArgs e) { try { if (e.Node is TnClient) { ShowClientForm(((TnClient)e.Node).Client.Id, editMode: false); } else { cf = null; clientFormFrame.Controls.Clear(); //Msg.ReferToTechSupport("Unrecognized node in tree: {0}", e.Node.Text); } } catch (Exception exc) { Msg.ReferToTechSupport(exc); } }