예제 #1
0
        private void InjectServices()
        {
            var service = new TextBoxValidator();

            NewContactPanel.InjectService(service);
            UpdateContactPanel.InjectService(service);
        }
예제 #2
0
 private void AddUpdateContactPanel()
 {
     UpdateContactPanel                  = new UpdateContactPanel();
     UpdateContactPanel.Dock             = DockStyle.Fill;
     UpdateContactPanel.Visible          = false;
     UpdateContactPanel.OnContactAdding += this.UpdateContactPanelOnContactAdding;
     UserViewPanel.Controls.Add(UpdateContactPanel);
 }
예제 #3
0
        private void LoadUpdateInformation()
        {
            int id       = ViewContactPanel.SelectedID;
            var toUpdate = Contacts.Tables["Contact"]
                           .AsEnumerable()
                           .Where(contact => contact.Field <int>("id") == id)
                           .First();

            UpdateContactPanel.LoadContact(toUpdate);
        }
예제 #4
0
        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;
            }
        }