/// <summary> /// Builds the page. /// </summary> protected virtual void BuildPage() { this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); string linkIdStr = this.ViewReference.ContextValueForKey("LinkId"); if (!string.IsNullOrEmpty(linkIdStr)) { this.LinkId = Convert.ToInt32(linkIdStr); } else { this.LinkId = -1; } this.AppearanceJScriptString = this.ViewReference.ContextValueForKey("AppearanceJScript"); this.DisappearanceJScriptString = this.ViewReference.ContextValueForKey("DisappearanceJScript"); FieldControl copySourceFieldControl = null; string copySourceFieldGroupName = this.ViewReference.ContextValueForKey("CopySourceFieldGroupName"); if (!string.IsNullOrEmpty(copySourceFieldGroupName)) { copySourceFieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", copySourceFieldGroupName); } if (copySourceFieldControl != null) { this.copyFields = new UPCopyFields(copySourceFieldControl); this.copyFields.CopyFieldValuesForRecordIdentification(this.RecordIdentification, false, this); } else { this.ContinueBuildPageWithParameters(null); } }
private void ContinueWithAnalysisLinkRecord(string analysisLinkRecordIdentification) { this.AnalysisLinkRecordIdentification = analysisLinkRecordIdentification; if (this.FilterParameters != null) { this.ContinueWithFilterParameters(this.FilterParameters); } else if (this.SourceCopyFieldGroupName?.Length > 0 && this.SourceCopyRecordIdentification?.Length > 0) { var fieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", this.SourceCopyFieldGroupName); if (fieldControl != null) { this.copyFieldReader = new UPCopyFields(fieldControl); this.copyFieldReader.CopyFieldValuesForRecord(new UPCRMRecord(this.SourceCopyRecordIdentification), false, this); } else { this.ContinueWithFilterParameters(null); } } else { this.ContinueWithFilterParameters(null); } }
/// <inheritdoc/> public override void BuildPage() { string copyFieldGroupName = this.ViewReference.ContextValueForKey("CopyFieldGroup"); string copyFieldRecord = this.ViewReference.ContextValueForKey("CopyFieldRecord"); this.copyFields = null; if (copyFieldRecord.IsRecordIdentification() && !string.IsNullOrEmpty(copyFieldGroupName)) { var listFieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", copyFieldGroupName); if (listFieldControl != null) { this.copyFields = new UPCopyFields(listFieldControl); } } if (this.copyFields != null) { var page = this.CreatePageInstance(); page.Invalid = true; this.TopLevelElement = page; this.copyFields.CopyFieldValuesForRecordIdentification(copyFieldRecord, false, this); } else { this.CopyFieldsLoaded(null); } }
private void ContinueBuildDetailsOrganizerPage() { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Details", this.ExpandConfig.FieldGroupName); this.TilesName = fieldControl.ValueForAttribute("tiles"); bool hasCopyFields = false; foreach (FieldControlTab tab in fieldControl.Tabs) { if (tab.Fields != null) { if (tab.Fields.Any(field => !string.IsNullOrEmpty(field.Function) && field.Function != "=")) { hasCopyFields = true; } } if (hasCopyFields) { break; } } if (!hasCopyFields) { this.ContinueWithCopyFieldsLoaded(null); } else { this.CopyFields = new UPCopyFields(fieldControl); this.CopyFields.CopyFieldValuesForRecordIdentification(this.RecordIdentification, false, this); } }
/// <summary> /// Copies the fields did fail with error. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="error">The error.</param> public void CopyFieldsDidFailWithError(UPCopyFields copyFields, Exception error) { this.CopyFields = null; this.Error = error; this.Logger.LogError(error); this.ModelController.SetOfflineRequest(null, true); this.Finished(); }
/// <summary> /// Builds the page. /// </summary> public override void BuildPage() { this.ConfigName = this.ViewReference.ContextValueForKey("ConfigName"); this.ConfigTabNr = Convert.ToInt32(this.ViewReference.ContextValueForKey("ConfigTabNr")); IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; Form form = configStore.FormByName(this.ConfigName); this.formtab = null; MDashboardPage _page = (MDashboardPage)this.InstantiatePage(); if (this.ConfigTabNr < form.NumberOfTabs) { if (this.ConfigTabNr < 0) { this.ConfigTabNr = 0; } this.formtab = form.TabAtIndex(this.ConfigTabNr); } else { this.Logger.LogError($"Configured ConfigTabNr {this.ConfigTabNr} is larger than the number of available tabs {form.NumberOfTabs}"); // DDLogError("Configured ConfigTabNr (%ld) is larger than the number of available tabs (%lu)", (long)this.ConfigTabNr, (unsigned long)form.NumberOfTabs()); return; } _page.LabelText = !string.IsNullOrWhiteSpace(this.formtab.Label) ? this.formtab.Label : "*** FormTab Label Missing ***"; _page.Invalid = true; this.TopLevelElement = _page; string copyRecordIdentification = this.ViewReference.ContextValueForKey("RecordId"); string copyFieldGroupName = this.ViewReference.ContextValueForKey("CopySourceFieldGroupName"); this.copyFields = null; if (copyRecordIdentification.IsRecordIdentification() && !string.IsNullOrWhiteSpace(copyFieldGroupName)) { FieldControl fieldControl = configStore.FieldControlByNameFromGroup("List", copyFieldGroupName); if (fieldControl != null) { this.copyFields = new UPCopyFields(fieldControl); } } if (this.copyFields != null) { this.copyFields.CopyFieldValuesForRecordIdentification(copyRecordIdentification, false, this); } else { this.ContinueWithCopyFields(null); } }
private void ContinueTemplateFilterGeoChecked() { string copySourceFieldGroupName = this.ViewReference.ContextValueForKey("CopySourceFieldGroupName"); var fieldControl = !string.IsNullOrEmpty(copySourceFieldGroupName) ? ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", copySourceFieldGroupName) : null; if (fieldControl == null || this.TemplateFilter == null) { this.ContinueWithParameters(null); } else { this.CopyFields = new UPCopyFields(fieldControl); this.CopyFields.CopyFieldValuesForRecordIdentification(this.RecordIdentification, this.RequestMode == UPOfflineRequestMode.OnlineOnly, this); } }
private void ParentLinkLoaded() { string sourceCopyFieldGroupName = this.ViewReference.ContextValueForKey("CopySourceFieldGroupName"); if (!string.IsNullOrEmpty(sourceCopyFieldGroupName)) { this.SourceCopyFieldGroup = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", sourceCopyFieldGroupName); if (this.SourceCopyFieldGroup != null) { string recordIdentification = this.ViewReference.ContextValueForKey("LinkRecordId"); this.copyFields = new UPCopyFields(this.SourceCopyFieldGroup); this.copyFields.CopyFieldValuesForRecordIdentification(recordIdentification, false, this); return; } } this.CopyFieldsLoaded(); }
/// <summary> /// Updateds the element. /// </summary> /// <param name="element">The element.</param> /// <returns> /// The <see cref="UPMElement" />. /// </returns> public override UPMElement UpdatedElement(UPMElement element) { if (element is UPMOrganizer) { this.AlternateExpandChecker = null; this.LinkReader = null; this.Tiles = null; this.TilesName = null; this.CopyFields = null; this.PageModelControllers.Clear(); List <UPMElement> newActions = null; foreach (UPMOrganizerAction action in this.LeftNavigationBarItems) { if (action.Identifier.IdentifierAsString == "CloseOrganizerAction") { newActions = new List <UPMElement> { action }; } } if (newActions != null) { this.LeftNavigationBarItems = newActions; } else { this.LeftNavigationBarItems.Clear(); } this.RightNaviagtionBarItems.Clear(); this.OrganizerHeaderQuickActionItems?.Clear(); this.OrganizerHeaderActionItems.Clear(); this.SaveActionItems.Clear(); this.BuildDetailOrganizerPages(); } return(null); }
private void LoadObjectivesForSectionConfiguration(UPObjectivesConfiguration section) { this.currentSectionConfiguration = section; FieldControl sourceFieldControl = section.SourceFieldControl; if (sourceFieldControl != null) { Dictionary <string, object> copyFieldValues = this.copyFieldsDictionary.ValueOrDefault(sourceFieldControl.UnitName); if (copyFieldValues == null) { this.currentCopyFields = new UPCopyFields(sourceFieldControl); this.currentCopyFields.CopyFieldValuesForRecord(this.record, false, this); return; } this.ContinueLoadWithFieldValueDictionary(copyFieldValues); } else { this.ContinueLoadWithFieldValueDictionary(null); } }
private void ContinueBuildPageWithParameters(Dictionary <string, object> parameters) { this.copyFields = null; this.FieldValueDictionary = parameters; Dictionary <string, object> dict = new Dictionary <string, object>(); Dictionary <string, List <string> > sessionParameters = ServerSession.CurrentSession.SessionParameterReplacements; foreach (string key in sessionParameters.Keys) { List <string> val = sessionParameters[key]; if (val.Count > 0) { dict[key] = val[0]; } } if (parameters?.Count > 0) { foreach (string key in parameters.Keys) { dict[$"${key}"] = parameters[key]; } } this.PrefixedFieldValueDictionary = dict; string parentLink = this.ViewReference.ContextValueForKey("ParentLink"); if (!string.IsNullOrEmpty(parentLink)) { this.linkReader = new UPCRMLinkReader(this.RecordIdentification, parentLink, UPRequestOption.FastestAvailable, this); this.linkReader.Start(); } else { this.ContinueBuildPage(); } }
/// <inheritdoc/> public void CopyFieldsDidFinishWithValues(UPCopyFields copyFields, Dictionary <string, object> dictionary) { this.copyFieldReader = null; }
/// <summary> /// Copies the fields did finish with values. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="dictionary">The dictionary.</param> public void CopyFieldsDidFinishWithValues(UPCopyFields copyFields, Dictionary <string, object> dictionary) { this.sourceCopyFields = dictionary; this.CopyFieldsLoaded(); }
private void ContinueLoadWithFieldValueDictionary(Dictionary <string, object> fieldValueDictionary) { IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore; if (fieldValueDictionary != null) { if (this.copyFieldsDictionary == null) { this.copyFieldsDictionary = new Dictionary <string, Dictionary <string, object> >(); } this.copyFieldsDictionary.SetObjectForKey(fieldValueDictionary, this.currentSectionConfiguration.SourceFieldControl.UnitName); } this.currentCopyFields = null; FieldControl destinationFieldControl = this.currentSectionConfiguration.DestinationFieldControl; string destinationFilterName = this.currentSectionConfiguration.DestinationFilterName; UPConfigFilter companyRelatedFilter = null; if (this.companyRelated) { string companyFilterName = $"{destinationFieldControl.InfoAreaId}.CompanyRelated"; companyRelatedFilter = configStore.FilterByName(companyFilterName); } UPContainerMetaInfo container = new UPContainerMetaInfo(destinationFieldControl); container.SetLinkRecordIdentification(this.rootRecordIdentification); List <UPConfigFilter> appliedFilters = new List <UPConfigFilter>(); UPConfigFilter filter = configStore.FilterByName(destinationFilterName); if (filter != null) { filter = filter.FilterByApplyingReplacements(UPConditionValueReplacement.ReplacementsFromValueParameterDictionary(fieldValueDictionary)); container.ApplyFilter(filter); appliedFilters.Add(filter); } if (companyRelatedFilter != null && this.currentSectionConfiguration.SourceFieldControl != null) { companyRelatedFilter = companyRelatedFilter.FilterByApplyingReplacements(new UPConditionValueReplacement(fieldValueDictionary)); container.ApplyFilter(companyRelatedFilter); appliedFilters.Add(companyRelatedFilter); } this.objectivesForRecordOperation = null; this.rightFilterOperation = null; this.filterLoaded = true; if (this.RightsFilter != null && this.filterItemsResult == null) { this.filterLoaded = false; } if (this.currentSectionConfiguration.ExecuteActionFilter != null) { this.currentSectionConfiguration.ExecuteActionFilter = this.currentSectionConfiguration.ExecuteActionFilter.FilterByApplyingValueDictionaryDefaults(fieldValueDictionary, true); if (this.currentSectionConfiguration.ExecuteActionFilter != null) { this.currentSectionConfiguration.FilterBasedDecision = new UPCRMFilterBasedDecision(this.currentSectionConfiguration.ExecuteActionFilter); List <UPCRMField> fields = this.currentSectionConfiguration.FilterBasedDecision.FieldDictionary.Values.ToList(); if (fields.Count > 0) { container.AddCrmFields(fields); } this.currentSectionConfiguration.FilterBasedDecision.UseCrmQuery(container); } } this.objectivesForRecordOperation = container.Find(this.RequestOption, this); if (this.objectivesForRecordOperation == null) { SimpleIoc.Default.GetInstance <ILogger>().LogError("Could not create operation for loading objectives."); this.FailWithError(new Exception("ConnectionOfflineError")); } if (this.RightsFilter != null && this.filterItemsResult == null) { UPContainerMetaInfo clonedContainer = new UPContainerMetaInfo(new List <UPCRMField>(), destinationFieldControl.InfoAreaId); clonedContainer.SetLinkRecordIdentification(this.rootRecordIdentification); clonedContainer.ApplyFilter(this.RightsFilter); foreach (UPConfigFilter filter1 in appliedFilters) { clonedContainer.ApplyFilter(filter1); } this.rightFilterOperation = clonedContainer.Find(this.RequestOption, this); if (this.rightFilterOperation == null) { SimpleIoc.Default.GetInstance <ILogger>().LogError("Could not create operation for filtering objectives."); this.FailWithError(new Exception("ConnectionOfflineError")); } } }
/// <inheritdoc/> public void CopyFieldsDidFailWithError(UPCopyFields copyFields, Exception error) { this.copyFieldReader = null; this.ReportError(error, false); }
/// <summary> /// Copies the fields did fail with error. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="error">The error.</param> public void CopyFieldsDidFailWithError(UPCopyFields copyFields, Exception error) { this.FailWithError(error); }
/// <summary> /// Copies the fields did finish with values. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="dictionary">The dictionary.</param> public void CopyFieldsDidFinishWithValues(UPCopyFields copyFields, Dictionary <string, object> dictionary) { this.CopyFields = null; this.ContinueWithCopyFieldsLoaded(dictionary); }
/// <summary> /// Copies the fields did finish with values. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="dictionary">The dictionary.</param> public void CopyFieldsDidFinishWithValues(UPCopyFields copyFields, Dictionary <string, object> dictionary) { this.ContinueLoadWithFieldValueDictionary(dictionary); }
/// <summary> /// Copies the fields did fail with error. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="error">The error.</param> public void CopyFieldsDidFailWithError(UPCopyFields copyFields, Exception error) { this.ContinueBuildPageWithParameters(null); }
/// <summary> /// Copies the fields did finish with values. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="dictionary">The dictionary.</param> public void CopyFieldsDidFinishWithValues(UPCopyFields copyFields, Dictionary <string, object> dictionary) { this.ContinueBuildPageWithParameters(dictionary); }
/// <summary> /// Copies the fields did fail with error. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="error">The error.</param> public void CopyFieldsDidFailWithError(UPCopyFields copyFields, Exception error) { this.Error = error; this.Finished(); }
/// <summary> /// Copies the fields did fail with error. /// </summary> /// <param name="copyFields">The copy fields.</param> /// <param name="error">The error.</param> public void CopyFieldsDidFailWithError(UPCopyFields copyFields, Exception error) { this.CopyFields = null; this.ContinueWithCopyFieldsLoaded(null); }