public static string GetOrganizationShortNameIfAvailable(this Organization organization) { if (organization.IsUnknown()) { return("Unknown or Unassigned"); } return(organization.OrganizationShortName ?? organization.OrganizationName); }
public static string GetOrganizationNamePossessive(this Organization organization) { if (organization.IsUnknown()) { return(organization.OrganizationName); } var postFix = organization.OrganizationName.EndsWith("s") ? "'" : "'s"; return($"{organization.OrganizationName}{postFix}"); }
private PartialViewResult ViewDeleteOrganization(Organization organization, ConfirmDialogFormViewModel viewModel) { var canDelete = !organization.HasDependentObjects() && !organization.IsUnknown(); var confirmMessage = canDelete ? $"Are you sure you want to delete this {FieldDefinitionType.Organization.GetFieldDefinitionLabel()} '{organization.OrganizationName}'?" : ConfirmDialogFormViewData.GetStandardCannotDeleteMessage($"{FieldDefinitionType.Organization.GetFieldDefinitionLabel()}", SitkaRoute <OrganizationController> .BuildLinkFromExpression(x => x.Detail(organization), "here")); var viewData = new ConfirmDialogFormViewData(confirmMessage, canDelete); return(RazorPartialView <ConfirmDialogForm, ConfirmDialogFormViewData, ConfirmDialogFormViewModel>(viewData, viewModel)); }
public static string GetDisplayName(this Organization organization) => organization.IsUnknown() ? "Unknown or unspecified" : $"{organization.OrganizationName}{(!organization.IsActive ? " (Inactive)" : String.Empty)}";