Esempio n. 1
0
		private void newCustomerCompanyToolStripMenuItem_Click(
			object sender,
			EventArgs e )
		{
			DBObjects.CustomerCompany company = new DBObjects.CustomerCompany();

			CustomerCompanyEditForm form = new CustomerCompanyEditForm( company );
			form.Show( this );
		}
Esempio n. 2
0
		/// <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 );
			}
		}