private void newCustomerCompanyButton_Click( object sender, EventArgs e ) { DBObjects.CustomerCompany company = new DBObjects.CustomerCompany(); CustomerCompanyEditForm form = new CustomerCompanyEditForm( company ); if ( form.ShowDialog( this ) == DialogResult.OK ) { FillCustomerCompanyList(); SelectCustomerCompany( company ); } }
private void newCustomerCompanyToolStripMenuItem_Click( object sender, EventArgs e ) { DBObjects.CustomerCompany company = new DBObjects.CustomerCompany(); CustomerCompanyEditForm form = new CustomerCompanyEditForm( company ); form.Show( this ); }
private void editCustomerCompanyButton_Click( object sender, EventArgs e ) { DBObjects.CustomerCompany item = customerCompanyComboBox.SelectedItem as DBObjects.CustomerCompany; CustomerCompanyEditForm form = new CustomerCompanyEditForm( item ); if ( form.ShowDialog( this ) == DialogResult.OK ) { int index = customerCompanyComboBox.SelectedIndex; FillCustomerCompanyList(); customerCompanyComboBox.SelectedIndex = index; UpdateUI(); } }
/// <summary> /// Edit the given company. /// </summary> /// <param name="company">The company to edit.</param> private void EditCustomerCompany( DBObjects.CustomerCompany company ) { // Avoid duplicates, try to locate any already open customer // edit form for the given ticket. bool isOpen = false; foreach ( Form form in Application.OpenForms ) { if ( form is CustomerCompanyEditForm ) { CustomerCompanyEditForm customerCompanyForm = form as CustomerCompanyEditForm; if ( customerCompanyForm.Item.ID == company.ID ) { isOpen = true; customerCompanyForm.BringToFront(); customerCompanyForm.Select(); break; } } } if ( !isOpen ) { CustomerCompanyEditForm form = new CustomerCompanyEditForm( company ); form.Show( this ); } }