private void InjectServices() { var service = new TextBoxValidator(); NewContactPanel.InjectService(service); UpdateContactPanel.InjectService(service); }
private void AddUpdateContactPanel() { UpdateContactPanel = new UpdateContactPanel(); UpdateContactPanel.Dock = DockStyle.Fill; UpdateContactPanel.Visible = false; UpdateContactPanel.OnContactAdding += this.UpdateContactPanelOnContactAdding; UserViewPanel.Controls.Add(UpdateContactPanel); }
private void LoadUpdateInformation() { int id = ViewContactPanel.SelectedID; var toUpdate = Contacts.Tables["Contact"] .AsEnumerable() .Where(contact => contact.Field <int>("id") == id) .First(); UpdateContactPanel.LoadContact(toUpdate); }
private void UpdateContactPanelOnContactAdding(object sender, EventArgs e) { var errors = Validator.FindInputErrors(UpdateContactPanel.Inputs); if (errors.Length > 0) { UpdateContactPanel.ShowInvalidFields(errors); } else { UpdateContact(); ViewContactPanel.CollapseEditPanel(); UpdateContactPanel.Reset(); UpdateContactPanel.Visible = false; } }