/// <summary> /// Adds the button action. /// </summary> /// <param name="button">The button.</param> public void AddButtonAction(UPConfigButton button) { if (this.buttonActions == null) { this.buttonActions = new List <UPConfigButton> { button }; } else { this.buttonActions.Add(button); } }
/// <summary> /// Initializes a new instance of the <see cref="SerialEntryWebContentModelController"/> class. /// </summary> /// <param name="viewReference">The view reference.</param> /// <param name="disableSigning">if set to <c>true</c> [disable signing].</param> public SerialEntryWebContentModelController(ViewReference viewReference, bool disableSigning) : base(viewReference) { this.disableSigning = disableSigning; string buttonName = viewReference.ContextValueForKey("ButtonName"); string sendByEmailFilterName = viewReference.ContextValueForKey("SendByEmailFilter"); if (!string.IsNullOrEmpty(sendByEmailFilterName)) { this.sendByEmailFilter = ConfigurationUnitStore.DefaultStore.FilterByName(sendByEmailFilterName); if (this.sendByEmailFilter == null) { this.Logger.LogError($"Filter {this.sendByEmailFilter} not found"); //DDLogError("Filter \"%@\" not found", sendByEmailFilterName); } else { this.SendByEmailButtonIsShown = false; } } UPConfigButton button = null; if (!this.disableSigning && !string.IsNullOrEmpty(buttonName)) { button = ConfigurationUnitStore.DefaultStore.ButtonByName(buttonName); } if (button != null) { this.buttonViewReference = button.ViewReference.ViewReferenceWith(viewReference.ContextValueForKey("RecordId")); if (this.buttonViewReference.ViewName != "Action:modifyRecord") { button = null; } } if (button != null) { UPMAction action = new UPMAction(StringIdentifier.IdentifierWithStringId("Action.Approve")); action.LabelText = button.Label; action.SetTargetAction(this, this.Approve); this.ApproveAction = action; } this.UnknownApprovedStateText = "..."; this.SerialEntryApproved = UPMSerialEntryState.Unknown; this.RecordIdentification = viewReference.ContextValueForKey("RecordId"); }
private bool UpdateReportButtonState() { string filterName = this.ViewReference.ContextValueForKey("ButtonShowFilter"); UPConfigButton button = null; string buttonName = this.ViewReference.ContextValueForKey("ButtonName"); if (!string.IsNullOrEmpty(buttonName)) { button = ConfigurationUnitStore.DefaultStore.ButtonByName(buttonName); } UPConfigFilter buttonFilter = ConfigurationUnitStore.DefaultStore.FilterByName(filterName); if (buttonFilter != null || this.sendByEmailFilter != null) { this.shouldWaitForPendingChanges = true; if (buttonFilter != null) { this.ApprovedText = buttonFilter.DisplayName; if (string.IsNullOrEmpty(button?.Label)) { this.ApprovedText = LocalizedString.TextProcessOrderWasApproved; } this.currentQuery = new UPContainerMetaInfo(new List <UPCRMField>(), buttonFilter.InfoAreaId); this.currentQuery.ApplyFilter(buttonFilter); this.currentQuery.SetLinkRecordIdentification(this.RecordIdentification); } else { this.SerialEntryApproved = UPMSerialEntryState.NotApproved; } if (this.sendByEmailFilter != null) { this.emailFilterQuery = new UPContainerMetaInfo(new List <UPCRMField>(), this.sendByEmailFilter.InfoAreaId); this.emailFilterQuery.ApplyFilter(this.sendByEmailFilter); this.emailFilterQuery.SetLinkRecordIdentification(this.RecordIdentification); } UPContainerMetaInfo queryToExecute = this.currentQuery ?? this.emailFilterQuery; queryToExecute.Find(UPRequestOption.FastestAvailable, this); return(true); } this.SerialEntryApproved = UPMSerialEntryState.NotApproved; return(false); }
private void HandleSaved() { this.disappearingOrganizer = true; var savedActionName = !string.IsNullOrEmpty(this.finishActionName) ? this.finishActionName : this.ViewReference.ContextValueForKey("SavedAction"); if (!string.IsNullOrEmpty(savedActionName)) { if (this.ConflictHandlingMode) { savedActionName = string.Empty; } else { foreach (UPPageModelController pageModelController in this.PageModelControllers) { if (pageModelController is SerialEntryPageModelController && ((SerialEntryPageModelController)pageModelController).RightsFilterRevocation) { savedActionName = string.Empty; } } } } if (!string.IsNullOrEmpty(savedActionName)) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (savedActionName.StartsWith("Button:")) { UPConfigButton button = configStore.ButtonByName(savedActionName.Substring(7)); this.SaveViewReference = button.ViewReference; } else if (savedActionName.StartsWith("Menu:")) { Menu menu = configStore.MenuByName(savedActionName.Substring(5)); this.SaveViewReference = menu.ViewReference; } else if (savedActionName == "Return") { this.PopToPrevious = true; } else { Menu menu = configStore.MenuByName(savedActionName); this.SaveViewReference = menu.ViewReference; } this.ExecuteSavedActionWithRecordIdentification((string)this.PageModelControllerContextValueForKey(null, "RootRecordIdentification"), false); } else { if (this.PopToRootOnSave) { this.ModelControllerDelegate.PopToRootContentViewController(); } else { this.PopToPreviousContentViewController(); } } }
/// <summary> /// Creates the new calendar item for date with button. /// </summary> /// <param name="date">The date.</param> /// <param name="button">The button.</param> public void CreateNewCalendarItemForDate(DateTime date, UPConfigButton button) { }
/// <summary> /// Results the view reference. /// </summary> /// <returns></returns> public ViewReference ResultViewReference() { if (this.DecisionHandler != null && this.Result.RowCount > 0) { UPCRMResultRow resultRow = (UPCRMResultRow)this.Result.ResultRowAtIndex(0); UPConfigQueryTable resultQueryTable = this.DecisionHandler.QueryTableForResultRow(resultRow); if (resultQueryTable != null) { UPConfigQueryCondition propertyCondition = resultQueryTable.PropertyConditions["Action"]; if (!string.IsNullOrEmpty(propertyCondition.FirstValue)) { Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName(propertyCondition.FirstValue); ViewReference returnViewReference = menu.ViewReference.ViewReferenceWith(this.RecordIdentification, resultRow.RootRecordIdentification); if (this.ViewReference.HasBackToPreviousFollowUpAction()) { this.followUpReplaceOrganizer = true; return(returnViewReference.ViewReferenceWithBackToPreviousFollowUpAction()); } return(returnViewReference); } propertyCondition = resultQueryTable.PropertyConditions["ButtonAction"]; if (!string.IsNullOrEmpty(propertyCondition.FirstValue)) { UPConfigButton button = ConfigurationUnitStore.DefaultStore.ButtonByName(propertyCondition.FirstValue); ViewReference returnViewReference = button.ViewReference.ViewReferenceWith(this.RecordIdentification, resultRow.RootRecordIdentification); if (this.ViewReference.HasBackToPreviousFollowUpAction()) { this.followUpReplaceOrganizer = true; return(returnViewReference.ViewReferenceWithBackToPreviousFollowUpAction()); } return(returnViewReference); } propertyCondition = resultQueryTable.PropertyConditions["DefaultAction"]; if (!string.IsNullOrEmpty(propertyCondition.FirstValue)) { Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName(propertyCondition.FirstValue); ViewReference returnViewReference = menu.ViewReference.ViewReferenceWith(this.RecordIdentification, resultRow.RootRecordIdentification); if (this.ViewReference.HasBackToPreviousFollowUpAction()) { this.followUpReplaceOrganizer = true; return(returnViewReference.ViewReferenceWithBackToPreviousFollowUpAction()); } return(returnViewReference); } propertyCondition = resultQueryTable.PropertyConditions["DefaultButtonAction"]; if (!string.IsNullOrEmpty(propertyCondition.FirstValue)) { UPConfigButton button = ConfigurationUnitStore.DefaultStore.ButtonByName(propertyCondition.FirstValue); ViewReference returnViewReference = button.ViewReference.ViewReferenceWith(this.RecordIdentification, resultRow.RootRecordIdentification); if (this.ViewReference.HasBackToPreviousFollowUpAction()) { this.followUpReplaceOrganizer = true; return(returnViewReference.ViewReferenceWithBackToPreviousFollowUpAction()); } return(returnViewReference); } } } if (this.Result.RowCount > 0) { Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName(this.ViewReference.ContextValueForKey("ExistsAction")); if (menu != null) { ViewReference returnViewReference = menu.ViewReference.ViewReferenceWith( ((UPCRMResultRow)this.Result.ResultRowAtIndex(0)).RootRecordIdentification, this.ViewReference.ContextValueForKey("RecordId")); return(this.ViewReference.HasBackToPreviousFollowUpAction() ? returnViewReference.ViewReferenceWithBackToPreviousFollowUpAction() : returnViewReference); } return(null); } else { Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName(this.ViewReference.ContextValueForKey("NotExistsAction")); if (menu != null) { ViewReference returnViewReference = menu.ViewReference.ViewReferenceWith(this.ViewReference.ContextValueForKey("RecordId")); return(this.ViewReference.HasBackToPreviousFollowUpAction() ? returnViewReference.ViewReferenceWithBackToPreviousFollowUpAction() : returnViewReference); } return(null); } }