Beispiel #1
0
		private void newTicketToolStripMenuItem_Click(
			object sender,
			EventArgs e )
		{
			DBObjects.Ticket ticket = new DBObjects.Ticket();

			if ( customerCompanyTreeView.SelectedNode != null )
			{
				ticket.CustomerCompanyID =
					(customerCompanyTreeView.SelectedNode.Tag as
					DBObjects.CustomerCompany).ID;
			}

			TicketEditForm form = new TicketEditForm( ticket );
			form.Show( this );
		}
Beispiel #2
0
		/// <summary>
		/// Edit the given ticket.
		/// </summary>
		/// <param name="ticket">The ticket to edit.</param>
		public static void EditTicket(
			IWin32Window parent,
			DBObjects.Ticket ticket )
		{
			// Avoid duplicates, try to locate any already open ticket
			// edit form for the given ticket.
			bool isOpen = false;

			foreach ( Form form in Application.OpenForms )
			{
				if ( form is TicketEditForm )
				{
					TicketEditForm ticketForm = form as TicketEditForm;
					if ( ticketForm.Item.ID == ticket.ID )
					{
						isOpen = true;
						ticketForm.BringToFront();
						ticketForm.Select();
						break;
					}
				}
			}

			if ( !isOpen )
			{
				TicketEditForm form = new TicketEditForm( ticket );
				form.Show( parent );
			}
		}