public UserEditForm( DBObjects.User item ) { this.item = item; InitializeComponent(); }
public void SetTicketEvent( DBObjects.TicketEvent ticketEvent ) { this.ticketEvent = ticketEvent; if ( ticketEvent == null || ticketEvent.IsEmpty ) { infoPanel.Visible = false; } else { infoPanel.Visible = true; dateInfoLabel.Text = ticketEvent.EventDate.ToString(); durationInfoLabel.Text = ticketEvent.DurationTimeSpan.ToString(); contactTypeInfoLabel.Text = Code.MiscHelper.GetEnumDescription( ticketEvent.ContactType ); customerPersonInfoLabel.Text = ticketEvent.CustomerPerson == null ? string.Empty : ticketEvent.CustomerPerson.ToString(); descriptionInfoTextBox.Text = ticketEvent.Description; if ( ticketEvent.HasAttachment ) { attachmentLinkLabel.Visible = true; toolTip1.SetToolTip( attachmentLinkLabel, ticketEvent.AttachmentUserReadableFileName ); } else { attachmentLinkLabel.Visible = false; } } }
public CustomerCompanyEditForm( DBObjects.CustomerCompany item ) { this.item = item; InitializeComponent(); }
public ProjectEditForm( DBObjects.Project item ) { this.item = item; InitializeComponent(); }
public void SetCustomerPerson( DBObjects.CustomerPerson person ) { this.person = person; if ( person == null || person.IsEmpty ) { infoPanel.Visible = false; } else { infoPanel.Visible = true; nameInfoLabel.Text = string.Format( "{0}, {1}", person.LastName, person.FirstName ); phoneInfoLabel.Text = person.Phone; faxInfoLabel.Text = person.Fax; mobileInfoLabel.Text = person.Mobile; if ( string.IsNullOrEmpty( person.EMail ) ) { emailInfoLinkLabel.Visible = false; } else { emailInfoLinkLabel.Visible = true; emailInfoLinkLabel.Text = person.EMail; } } }
public TicketQuickEditForm( DBObjects.Ticket item ) { this.item = item; InitializeComponent(); }
public TicketEventEditForm( DBObjects.Ticket parentItem, DBObjects.TicketEvent item ) { this.parentItem = parentItem; this.item = item; InitializeComponent(); }
public ProjectTaskEditForm( DBObjects.Project parentItem, DBObjects.ProjectTask item ) { this.parentItem = parentItem; this.item = item; InitializeComponent(); }
public void SetCustomerCompany( DBObjects.CustomerCompany company ) { this.company = company; DBObjects.CustomerCompanySupportContract contract = null; if ( company != null ) { contract = company.SupportContract; } if ( contract == null ) { descriptionLabel.Text = string.Empty; validFromLabel.Text = string.Empty; validToLabel.Text = string.Empty; statusLabel.Text = "The customer company has no support contract."; statusPictureBox.Image = statusImageList.Images["SupportContractGray.gif"]; } else { descriptionLabel.Text = contract.Description; validFromLabel.Text = contract.StartDate == DateTime.MinValue ? string.Empty : contract.StartDate.ToShortDateString(); validToLabel.Text = contract.EndDate == DateTime.MinValue ? string.Empty : contract.EndDate.ToShortDateString(); if ( contract.StartDate > DateTime.Now ) { statusLabel.Text = "The support contract is not yet valid."; statusPictureBox.Image = statusImageList.Images["SupportContractYellow.gif"]; } else if ( contract.EndDate == DateTime.MinValue || contract.EndDate >= DateTime.Now ) { statusLabel.Text = "The support contract is valid."; statusPictureBox.Image = statusImageList.Images["SupportContractGreen.gif"]; } else if ( contract.EndDate < DateTime.Now ) { statusLabel.Text = string.Format( "The support contract has expired since {0} days.", ( DateTime.Now - contract.EndDate ).TotalDays ); statusPictureBox.Image = statusImageList.Images["SupportContractRed.gif"]; } else { statusLabel.Text = "The state of the support contract is undefined."; statusPictureBox.Image = statusImageList.Images["SupportContractYellow.gif"]; } } }
// ------------------------------------------------------------------ public CustomerPersonEditForm( DBObjects.CustomerCompany parentItem, DBObjects.CustomerPerson item ) { this.parentItem = parentItem; this.item = item; InitializeComponent(); }
public TicketEditForm( DBObjects.Ticket item ) { this.item = item; // Create auto-event if required. if ( item.IsEmpty ) { autoEventItem = new DBObjects.TicketEvent(); autoEventItem.Description = autoEventItemEmptyDescription; } InitializeComponent(); }
public void SetCustomerCompany( DBObjects.CustomerCompany company ) { this.company = company; customerCompanySupportContractInfoControl.SetCustomerCompany( company ); if ( company == null || company.IsEmpty ) { infoPanel.Visible = false; } else { infoPanel.Visible = true; name1InfoLabel.Text = company.Name1; name2InfoLabel.Text = company.Name2; address1InfoLabel.Text = company.Address1; address2InfoLabel.Text = company.Address2; cityInfoLabel.Text = string.Format( "{0} {1}", company.Zip, company.City ); phoneInfoLabel.Text = company.Phone; faxInfoLabel.Text = company.Fax; mobileInfoLabel.Text = company.Mobile; if ( string.IsNullOrEmpty( company.EMail ) ) { emailInfoLinkLabel.Visible = false; } else { emailInfoLinkLabel.Visible = true; emailInfoLinkLabel.Text = company.EMail; } if ( string.IsNullOrEmpty( company.Www ) ) { wwwInfoLabel.Visible = false; } else { wwwInfoLabel.Visible = true; wwwInfoLabel.Text = company.Www; } } }
public void SetProject( DBObjects.Project project ) { this.project = project; if ( project == null || project.IsEmpty ) { infoPanel.Visible = false; } else { infoPanel.Visible = true; dateCreatedInfoLabel.Text = project.DateCreated.ToShortDateString(); dueDateInfoLabel.Text = project.DueDate == DateTime.MinValue ? string.Empty : project.DueDate.ToShortDateString(); customerCompanyInfoLabel.Text = project.Company == null ? string.Empty : project.Company.ToString(); taskCountInfoLabel.Text = project.TaskCount.ToString(); assignedToInfoLabel.Text = project.AssignedToUser.ToString(); isCompletedInfoLabel.Text = project.IsCompleted ? "Yes" : "No"; titleInfoTextBox.Text = project.Name; descriptionInfoBox.Text = project.Description; // -- DBObjects.Project.TimeSpans spans = project.CalculatedTimeSpans; billableDurationInfoLabel.Text = spans.BillableDuration.ToString(); completedBillableDurationInfoLabel.Text = spans.CompletedBilledDuration.ToString(); completedDurationInfoLabel.Text = spans.CompletedDuration.ToString(); completedUnbillableDurationInfoLabel.Text = spans.CompletedUnbilledDuration.ToString(); totalDurationInfoLabel.Text = spans.TotalDuration.ToString(); } }
public void SetTicket( DBObjects.Ticket ticket ) { this.ticket = ticket; if ( ticket == null || ticket.IsEmpty ) { infoPanel.Visible = false; } else { infoPanel.Visible = true; dateCreatedInfoLabel.Text = ticket.DateCreated.ToString(); groupInfoLabel.Text = ticket.GroupName; stateInfoLabel.Text = Code.MiscHelper.GetEnumDescription( ticket.State ); durationInfoLabel.Text = ticket.EventDurationTimeSpan.ToString(); eventCountInfoLabel.Text = ticket.EventCount.ToString(); assignedToInfoLabel.Text = ticket.AssignedToUser.ToString(); openDurationInfoLabel.Text = ticket.OpenDurationTimeSpan.ToString(); ticketTitleInfoTextBox.Text = ticket.Title; ticketDescriptionInfoBox.Text = ticket.Description; customerPersonInfoLabel.Text = ticket.CustomerPerson == null ? string.Empty : ticket.CustomerPerson.ToString(); customerCompanyInfoLabel.Text = ticket.CustomerCompany == null ? string.Empty : ticket.CustomerCompany.ToString(); if ( ticket.TicketClosedDate == DateTime.MinValue ) { dateClosedInfoLabel.Text = string.Empty; } else { dateClosedInfoLabel.Text = ticket.TicketClosedDate.ToString(); } } }
public void SetProjectTask( DBObjects.ProjectTask projectTask ) { this.projectTask = projectTask; if ( projectTask == null || projectTask.IsEmpty ) { infoPanel.Visible = false; } else { infoPanel.Visible = true; dateCreatedInfoLabel.Text = projectTask.DateCreated.ToShortDateString(); isCompletedInfoLabel.Text = projectTask.IsCompleted ? "Yes" : "No"; wasBilledInfoLabel.Text = projectTask.WasBilled ? "Yes" : "No"; isBillableInfoLabel.Text = projectTask.IsBillable ? "Yes" : "No"; durationInfoLabel.Text = projectTask.DurationTimeSpan.ToString(); titleInfoTextBox.Text = projectTask.Name; descriptionInfoBox.Text = projectTask.Description; if ( projectTask.HasAttachment ) { attachmentLinkLabel.Visible = true; toolTip1.SetToolTip( attachmentLinkLabel, projectTask.AttachmentUserReadableFileName ); } else { attachmentLinkLabel.Visible = false; } } }
/// <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 ); } }
private void UpdateTicketEventInList( DBObjects.TicketEvent ticketEvent ) { // -- // Search. ListViewItem listViewItem = null; foreach ( ListViewItem item in ticketEventListView.Items ) { // Search by reference instead of ID, since the item can be unsafed // and has an ID of zero. if ( item.Tag == ticketEvent ) { listViewItem = item; break; } } // -- string description = ticketEvent.Description; if ( !string.IsNullOrEmpty( description ) ) { if ( description.Length > 100 ) { description = description.Substring( 0, 100 ) + "..."; } description = description.Replace( "\r", " " ); description = description.Replace( "\n", " " ); description = description.Replace( "\t", " " ); description = description.Replace( " ", " " ); description = description.Replace( " ", " " ); } // -- listViewItem.Text = ticketEvent.EventDate.ToString(); listViewItem.SubItems[1].Text = description; listViewItem.ImageKey = ticketEvent.SmallImageKey; }
private void AddTicketEventToList( DBObjects.TicketEvent ticketEvent ) { ListViewItem listViewItem = new ListViewItem( new string[] { string.Empty, string.Empty } ); listViewItem.Tag = ticketEvent; ticketEventListView.Items.Add( listViewItem ); UpdateTicketEventInList( ticketEvent ); }
private void SelectCustomerPerson( DBObjects.CustomerPerson person ) { foreach ( object item in customerPersonComboBox.Items ) { if ( item is DBObjects.CustomerPerson ) { DBObjects.CustomerPerson personItem = item as DBObjects.CustomerPerson; if ( person.ID == personItem.ID ) { customerPersonComboBox.SelectedItem = item; break; } } } }
private void FillCustomerPersonList( DBObjects.CustomerCompany company ) { customerPersonComboBox.Items.Clear(); customerPersonComboBox.Items.Add( "(No person)" ); if ( company != null ) { DBObjects.CustomerPerson[] persons = company.Persons; if ( persons != null ) { foreach ( DBObjects.CustomerPerson person in persons ) { customerPersonComboBox.Items.Add( person ); } } } customerPersonComboBox.SelectedIndex = 0; }
private void AddProjectTaskToList( DBObjects.ProjectTask projectTask ) { ListViewItem listViewItem = new ListViewItem( new string[] { string.Empty, string.Empty, string.Empty } ); listViewItem.Tag = projectTask; projectTaskListView.Items.Add( listViewItem ); UpdateProjectTaskInList( projectTask ); }
private void SelectCustomerCompany( DBObjects.CustomerCompany company ) { foreach ( object item in customerCompanyComboBox.Items ) { if ( item is DBObjects.CustomerCompany ) { DBObjects.CustomerCompany companyItem = item as DBObjects.CustomerCompany; if ( company.ID == companyItem.ID ) { customerCompanyComboBox.SelectedItem = item; break; } } } }
private void FillGroupList( DBObjects.CustomerCompany company ) { groupComboBox.Items.Clear(); string[] groupNames = DBObjects.Ticket.GetDistinctGroupNamesForCustomerCompany( company ); if ( groupNames != null ) { foreach ( string groupName in groupNames ) { groupComboBox.Items.Add( groupName ); } } }
private void UpdateProjectTaskInList( DBObjects.ProjectTask projectTask ) { // -- // Search. ListViewItem listViewItem = null; foreach ( ListViewItem item in projectTaskListView.Items ) { // Search by reference instead of ID, since the item can be unsafed // and has an ID of zero. if ( item.Tag == projectTask ) { listViewItem = item; break; } } // -- listViewItem.Text = projectTask.Date.ToShortDateString(); listViewItem.SubItems[1].Text = projectTask.Name; listViewItem.SubItems[2].Text = projectTask.DurationTimeSpan.ToString(); listViewItem.ImageKey = projectTask.SmallImageKey; }
private void DeleteTicket( DBObjects.Ticket ticket ) { if ( ticket.UserSamNameCreated == DBObjects.User.CurrentUser.SamName ) { if ( MessageBox.Show( this, "Do you really want to delete this ticket and all of its events permanently?", "zeta HelpDesk", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2 ) == DialogResult.Yes ) { ticket.Delete(); RefillTicketList(); } } else { MessageBox.Show( this, "You cannot delete the ticket, because you are not the creator of the ticket.", "zeta HelpDesk", MessageBoxButtons.OK, MessageBoxIcon.Exclamation ); } }
private void AddPersonsToMenuChild( DBObjects.CustomerCompany company, ToolStripMenuItem parentItem ) { ToolStripItemCollection items = parentItem.DropDownItems; // Remove any old. while ( items.Count > 2 ) { items.RemoveAt( items.Count - 1 ); } // Refill. DBObjects.CustomerPerson[] persons = company.Persons; if ( persons == null ) { ToolStripMenuItem newItem = new ToolStripMenuItem(); newItem.Enabled = false; newItem.Text = "(No persons)"; items.Add( newItem ); } else { foreach ( DBObjects.CustomerPerson person in persons ) { ToolStripMenuItem newItem = new ToolStripMenuItem(); newItem.Text = string.Format( "{0}, {1}...", person.LastName, person.FirstName ); newItem.Image = ZetaHelpDesk.Main.Properties.Resources.PersonCard; newItem.Click += new EventHandler( newItem_Click ); newItem.Tag = person; items.Add( newItem ); } } }
private string GenerateHtmlReport( DateTime forMonth, DBObjects.CustomerCompany[] companies ) { StringBuilder sb = new StringBuilder(); sb.AppendFormat( "<h1>Billable tickets</h1>" ); foreach ( DBObjects.CustomerCompany company in companies ) { DBObjects.Ticket[] tickets = DBObjects.Ticket.GetUnbilledBillableForCustomerCompany( company, forMonth ); sb.AppendFormat( "<h2>Company {0}</h2>", company.Name1 ); if ( tickets != null ) { sb.AppendFormat( "<ul>" ); foreach ( DBObjects.Ticket ticket in tickets ) { sb.AppendFormat( "<li>{0} ({1}): {2}, {3}</li>", ticket.DateCreated.ToShortDateString(), ticket.AssignedToUser, ticket.Title, ticket.EventDurationTimeSpan.ToString() ); } sb.AppendFormat( "</ul>" ); } } return sb.ToString(); }
/// <summary> /// Edit the given project. /// </summary> /// <param name="project">The project to edit.</param> private void EditProject( DBObjects.Project project ) { // Avoid duplicates, try to locate any already open project // edit form for the given project. bool isOpen = false; foreach ( Form form in Application.OpenForms ) { if ( form is ProjectEditForm ) { ProjectEditForm projectForm = form as ProjectEditForm; if ( projectForm.Item.ID == project.ID ) { isOpen = true; projectForm.BringToFront(); projectForm.Select(); break; } } } if ( !isOpen ) { ProjectEditForm form = new ProjectEditForm( project ); form.Show( this ); } }
/// <summary> /// Edit the given ticket. /// </summary> /// <param name="ticket">The ticket to edit.</param> public void EditTicket( DBObjects.Ticket ticket ) { EditTicket( this, ticket ); }
/// <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 ); } }