/// <summary> /// Emails the report as PDF action. /// </summary> /// <param name="_viewTag">The view tag.</param> /// <param name="action">The action.</param> public override void EmailReportAsPdfAction(int _viewTag, Menu action) { #if PORTING if (!reportFileName && ((UPWebContentMetadataClientReport)this.WebContentMetadata).PdfFileName) { reportFileName = this.CalcReportFileName(); } reportFileName = reportFileName ? reportFileName : "report.pdf"; UPMail mail = UPMail.TheNew(); if (action != null) { ViewReference sendEmailActionViewReference = action.ViewReference(); sendEmailActionViewReference = sendEmailActionViewReference.ViewReferenceWithRecordIdentification(recordIdentification); bool attachReport = "true".CompareOptions(viewReference.ContextValueForKey("SendByEmailAttachReport"), NSCaseInsensitiveSearch) == NSOrderedSame; string fieldGroup = sendEmailActionViewReference.ContextValueForKey("EmailFieldgroup"); string recordId = sendEmailActionViewReference.ContextValueForKey("RecordId"); mail.FillFromEmailTemplateFieldGroupForRecord(fieldGroup, recordId); if (attachReport) { NSData pdfDataOut = this.CreatePdfData(_viewTag); mail.AddAttachment(new UPMailAttachment(pdfDataOut, "application/pdf", reportFileName)); } } else { NSData pdfDataOut = this.CreatePdfData(_viewTag); string title = this.ParentOrganizerModelController.Organizer.TitleText; mail.Subject = NSString.StringWithFormat(upText_OrderReportEmailSubject, title); mail.AddAttachment(new UPMailAttachment(pdfDataOut, "application/pdf", reportFileName)); } this.ModelControllerDelegate.SendMailModal(mail, true); #endif }
/// <summary> /// Sends the report for offline request. /// </summary> /// <param name="request">The request.</param> void SendReportForOfflineRequest(UPOfflineRequest request) { #if PORTING string xmlData = request.Xml(); UPMail mail = new UPMail(); mail.Subject = NSString.StringWithFormat("SyncConflict from %@ at %@ of type %@", ServerSession.CurrentSession().UserName, request.ServerDateTime, request.ProcessType); mail.AddRecipient(((UPMSyncConflictsPage)this.Page).SyncConflictEmail); string filename = NSString.StringWithFormat("SyncConflict_%@_%@_%ld.xml", ServerSession.CurrentSession().UserName, request.ProcessType, request.RequestNr); UPMailAttachment attachment = new UPMailAttachment(xmlData, "application/xml", filename); mail.AddAttachment(attachment); this.ModelControllerDelegate.SendMailModal(mail, false); #endif }
/// <summary> /// Populates Sub menus of Global Menu /// </summary> private void PopulateGlobalMenuSubMenus() { var globalMenu = ConfigurationUnitStore.DefaultStore.MenuByName(MenuGlobalActions); for (var index = 0; index < globalMenu?.NumberOfSubMenus; index++) { var menuItem = globalMenu.SubMenuAtIndex(index); if (menuItem.ViewReference != null) { var key = $"{IdentifierPrefixGlobalAction} {menuItem.UnitName}"; var stringIdentifier = StringIdentifier.IdentifierWithStringId(key); var globalAction = new UPMGlobalAction(stringIdentifier) { IconName = !string.IsNullOrWhiteSpace(menuItem.ImageName) ? menuItem.ImageName : MenuImageIconInnerCircle }; var chunks = menuItem.DisplayName.Split(';'); if (chunks.Length > 0) { globalAction.LabelText = chunks[0]; } if (chunks.Length > 1) { globalAction.AdditionalLabelText = chunks[1]; } globalAction.SetTargetAction(this, PerformGlobalAction); GlobalActions.Add(globalAction); viewReferenceDict[globalAction.Identifier] = menuItem.ViewReference; } } var inboxConfig = ConfigurationUnitStore.DefaultStore.ConfigValue(KeyDocumentInbox); #if PORTING if (inboxConfig.UpInboxEnabled()) { var globalAction = new UPMGlobalAction(StringIdentifier.IdentifierWithStringId("GlobalAction Inbox")); globalAction.IconName = NSString.StringWithFormat("Icon2:%@", UPGlyphFontSet.NameForGlyphicons(UPGlyphiconsInboxIn)); globalAction.LabelText = upText_InboxTitle; globalAction.AdditionalLabelText = upText_InboxAdditionalTitle; globalAction.SetTargetAction(this, @selector(performGlobalAction:)); GlobalActions.Add(globalAction); var inboxViewReference = new ViewReference(null, "DocumentInbox"); viewReferenceDict.SetObjectForKey(inboxViewReference, globalAction.Identifier); } #endif }
UPMEditField CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(UPMIdentifier participantIdentifier, UPCatalog catalog, UPMGroup editGroup) { UPCRMField field; if (catalog == this.ParticipantsControl.RequirementCatalog) { field = this.ParticipantsControl.RequirementField; } else if (catalog == this.ParticipantsControl.AcceptanceCatalog) { field = this.ParticipantsControl.AcceptanceField; } UPMParticipantCatalogEditField editField = new UPMParticipantCatalogEditField(UPMStringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("dependField_%@_%@_%ld", participantIdentifier.Description, field.InfoAreaId, (long)field.FieldId))); editField.GroupModelController = this; editField.Group = editGroup; if (catalog != null) { ArrayList possibleValues = catalog.Values; ArrayList explicitKeyOrder; NSDictionary possibleValuesAsString = catalog ? catalog.TextValuesForFieldValues() : null; UPConfigurationUnitStore configStore = UPConfigurationUnitStore.DefaultStore(); UPConfigCatalogAttributes acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(field.InfoAreaId, field.FieldId); possibleValues.EnumerateObjectsUsingBlock(delegate(object obj, uint idx, bool stop) { UPMCatalogPossibleValue possibleValue = new UPMCatalogPossibleValue(); UPMStringField valueField = new UPMStringField(UPMStringIdentifier.IdentifierWithStringId("x")); UPCatalogValue catalogValue = (UPCatalogValue)obj; valueField.StringValue = catalogValue.Text; possibleValue.TitleLabelField = valueField; UPConfigCatalogValueAttributes configCatalogValueAttributes = acceptanceCatalogAttributes.ValuesByCode().ObjectForKey(NSNumber.NumberWithInt(catalogValue.CodeKey.IntValue)); if (configCatalogValueAttributes) { string colorString = configCatalogValueAttributes.ColorKey(); if (colorString) { possibleValue.IndicatorColor = UPColor.ColorWithString(colorString); } possibleValue.ImageString = configCatalogValueAttributes.ImageName(); } editField.AddPossibleValueForKey(possibleValue, catalogValue.CodeKey); }); if (((string)possibleValuesAsString.ObjectForKey("0")).Length == 0) { editField.NullValueKey = "0"; } if (catalog != null && acceptanceCatalogAttributes != null && !UPConfigurationUnitStore.DefaultStore().ConfigValueIsSet("FixedCatalog.SortByAttributeFilter")) { explicitKeyOrder = this.ExplicitKeyOrderByCatalogAttributeCodeOrder(acceptanceCatalogAttributes, catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false)); } else if (catalog != null && UPConfigurationUnitStore.DefaultStore().ConfigValueIsSet("FixedCatalog.SortByCode")) { explicitKeyOrder = catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false); } else { explicitKeyOrder = catalog.ExplicitKeyOrderEmptyValueIncludeHidden(false, false); } if (explicitKeyOrder != null) { editField.ExplicitKeyOrder = explicitKeyOrder; } editField.ContinuousUpdate = true; } return(editField); }
UPMDependsEditField CreateEditFieldWithParticipantIdentifierEditGroup(UPMIdentifier participantIdentifier, UPMGroup editGroup) { UPMDependsEditField dependsEditField = new UPMDependsEditField(UPMStringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("depenfEditField_%@", participantIdentifier.Description))); dependsEditField.MainField = this.CreateMainEditFieldWithParticipantIdentifierEditGroup(participantIdentifier, editGroup); dependsEditField.DependField = this.CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(participantIdentifier, this.ParticipantsControl.AcceptanceCatalog, editGroup); dependsEditField.DependField2 = this.CreateDependEditFieldWithParticipantIdentifierCatalogEditGroup(participantIdentifier, this.ParticipantsControl.RequirementCatalog, editGroup); dependsEditField.initialSelectableOnly = true; return(dependsEditField); }
/// <summary> /// Makes the system information group. /// </summary> /// <returns></returns> public UPMGroup MakeSystemInfoGroup() { return(null); #if PORTING IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; bool hideEmptyFields = configStore.ConfigValueIsSet("SettingsView.HideEmptyFields"); UPMStandardGroup detailGroup = new UPMStandardGroup(StringIdentifier.IdentifierWithStringId("systeminfo_1")); UPSystemInfo systemInfo = new UPSystemInfo(); NSDictionary infos = this.GetFunctionNameDictionaryForSystemInfo(systemInfo); FieldControl listControl = null; ViewReference systemViewRef = new ViewReference(new List <object> { "fieldgroup", "SYSTEMINFO" }, "SystemInfoView"); string fieldGroup = systemViewRef.ContextValueForKey("fieldgroup"); if (fieldGroup != null) { listControl = configStore.FieldControlByNameFromGroup("List", fieldGroup); int row = 0; foreach (UPConfigFieldControlField field in listControl.Fields) { string functionName = field.Function; string label = field.Label; string functionNameLowerCase = functionName.ToLower(); if (infos.ObjectForKey(functionNameLowerCase) != null) { IIdentifier fieldIdentifier = StringIdentifier.IdentifierWithStringId($"Id_{functionName}"); string fieldValue = infos[functionNameLowerCase]; if (!string.IsNullOrEmpty(fieldValue) || !hideEmptyFields) { UPMStringField stringField = new UPMStringField(fieldIdentifier); stringField.StringValue = fieldValue; stringField.LabelText = label; if (functionName == "webversion" && ServerSession.CurrentSession().IsEnterprise) { stringField.StringValue = $"{fieldValue} Enterprise"; } detailGroup.AddField(stringField); } } row++; } } if (systemInfo.WebconfigParameter()) { foreach (UPConfigWebConfigLayoutField configField in systemInfo.WebconfigParameter().AllValues()) { IIdentifier fieldIdentifier = StringIdentifier.IdentifierWithStringId(NSString.StringWithFormat("Id_%@", configField.ValueName())); string label = configField.ValueName(); if (listControl != null) { UPConfigFieldControlField field = listControl.FieldWithFunction(configField.ValueName()); if (!string.IsNullOrEmpty(field?.Label)) { label = field.Label; } } UPMStringField field = new UPMStringField(fieldIdentifier); field.StringValue = configField.Value(); field.LabelText = label; detailGroup.AddField(field); } } return(detailGroup); #endif }