/// <summary>
        /// Initializes a new instance of the <see cref="AnalysisPageModelController"/> class.
        /// </summary>
        /// <param name="viewReference">View reference</param>
        public AnalysisPageModelController(ViewReference viewReference)
            : base(viewReference)
        {
            this.RecordIdentification = this.ViewReference.ContextValueForKey("RecordId");
            if (this.ViewReference.ViewName == "Query")
            {
                this.IsQuery   = true;
                this.QueryName = this.ViewReference.ContextValueForKey("Query");
            }
            else
            {
                this.IsQuery      = false;
                this.AnalysisName = this.ViewReference.ContextValueForKey("Analysis");
            }

            this.RequestOption                  = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("RequestOption"), UPRequestOption.BestAvailable);
            this.SourceCopyFieldGroupName       = this.ViewReference.ContextValueForKey("CopySourceFieldGroupName");
            this.SourceCopyRecordIdentification = this.ViewReference.ContextValueForKey("CopySourceRecordId");
            if (string.IsNullOrEmpty(this.SourceCopyRecordIdentification))
            {
                this.SourceCopyRecordIdentification = this.RecordIdentification;
            }

            if (string.IsNullOrEmpty(this.SourceCopyFieldGroupName))
            {
                this.FilterParameters = this.ViewReference.JsonDictionaryForKey("copyFields");
            }

            this.ParentLink = this.ViewReference.ContextValueForKey("ParentLink");
            this.Options    = this.ViewReference.JsonDictionaryForKey("Options");
            this.BuildPage();
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TimelineCalendarPageModelController"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        public TimelineCalendarPageModelController(ViewReference viewReference)
            : base(viewReference)
        {
            this.RecordIdentification  = viewReference.ContextValueForKey("RecordId");
            this.TimelineConfiguration = ConfigurationUnitStore.DefaultStore.TimelineByName(viewReference.ContextValueForKey("TimelineConfigName"));
            if (string.IsNullOrEmpty(this.RecordIdentification) || this.TimelineConfiguration == null)
            {
                throw new Exception("Something wrong");
            }

            this.RequestOption = UPCRMDataStore.RequestOptionFromString(viewReference.ContextValueForKey("RequestOption"), UPRequestOption.FastestAvailable);
            RecordIdentifier identifier   = new RecordIdentifier(this.RecordIdentification);
            UPMCalendarPage  calendarPage = new UPMCalendarPage(identifier)
            {
                DefaultViewType       = SearchPageViewType.CalendarMonth,
                IncludeSystemCalendar = viewReference.ContextValueForKey("IncludeSystemCalendar").ToBoolWithDefaultValue(true),
                Invalid = true,

                AvailableViewTypes = new List <SearchPageViewType>
                {
                    SearchPageViewType.CalendarDay,
                    SearchPageViewType.CalendarWeek,
                    SearchPageViewType.CalendarMonth,
                    SearchPageViewType.CalendarList
                }
            };

            this.TopLevelElement = calendarPage;
        }
Beispiel #3
0
        /// <summary>
        /// Executes this instance.
        /// </summary>
        public override void Execute()
        {
            UPRequestOption requestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("RequestOption"), UPRequestOption.FastestAvailable);

            this.DecisionHandler?.UseCrmQuery(this.CrmQuery);

            this.CrmQuery.Find(requestOption, this);
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMRecordParticipants"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="rootInfoAreaId">The root information area identifier.</param>
        /// <param name="linkParticipantsSearchAndListName">Name of the link participants search and list.</param>
        /// <param name="linkParticipantsLinkId">The link participants link identifier.</param>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="theDelegate">The delegate.</param>
        public UPCRMRecordParticipants(ViewReference viewReference, string rootInfoAreaId, string linkParticipantsSearchAndListName,
                                       int linkParticipantsLinkId, string recordIdentification, UPCRMParticipantsDelegate theDelegate)
            : base(viewReference, rootInfoAreaId, recordIdentification, null, linkParticipantsLinkId, theDelegate)
        {
            this.LinkParticipantsRequestOption = UPCRMDataStore.RequestOptionFromString(
                this.ViewReference?.ContextValueForKey("LinkParticipantsRequestOption"), UPRequestOption.FastestAvailable);

            this.LinkParticipantsSearchAndListName = linkParticipantsSearchAndListName;
        }
Beispiel #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMParticipants"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="rootInfoAreaId">The root information area identifier.</param>
        /// <param name="linkParticipantsInfoAreaId">The link participants information area identifier.</param>
        /// <param name="linkParticipantsLinkId">The link participants link identifier.</param>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="theDelegate">The delegate.</param>
        public UPCRMParticipants(ViewReference viewReference, string rootInfoAreaId, string linkParticipantsInfoAreaId, int linkParticipantsLinkId, string recordIdentification, UPCRMParticipantsDelegate theDelegate)
        {
            this.RecordIdentification = recordIdentification;
            this.TheDelegate          = theDelegate;

            this.RootInfoAreaId = rootInfoAreaId ?? recordIdentification.InfoAreaId();

            if (string.IsNullOrEmpty(this.RootInfoAreaId))
            {
                this.RootInfoAreaId = "MA";
            }

            this.linkParticipantsInfoAreaId = linkParticipantsInfoAreaId;
            this.linkParticipantsLinkId     = linkParticipantsLinkId;

            if (viewReference == null)
            {
                Menu menu = ConfigurationUnitStore.DefaultStore.MenuByName($"Configuration:{this.RootInfoAreaId}Participants");
                this.ViewReference = menu?.ViewReference;
            }
            else
            {
                this.ViewReference = viewReference;
            }

            this.RepParticipantsRequestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference?.ContextValueForKey("RepAcceptanceRequestOption"), UPRequestOption.FastestAvailable);
            this.AcceptanceFieldId            = -1;
            string configName = this.ViewReference?.ContextValueForKey("RepAcceptanceConfigName");

            if (!string.IsNullOrEmpty(configName))
            {
                IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
                SearchAndList           searchAndList = configStore.SearchAndListByName(configName);

                if (!string.IsNullOrEmpty(searchAndList.FieldGroupName))
                {
                    configName = searchAndList.FieldGroupName;
                }

                FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Edit", configName) ??
                                            configStore.FieldControlByNameFromGroup("List", configName);

                if (fieldControl != null)
                {
                    UPConfigFieldControlField field = fieldControl.FieldWithFunction(Constants.UPRepAcceptanceFunctionName_Acceptance);
                    if (field != null)
                    {
                        this.AcceptanceFieldId = field.FieldId;
                    }

                    this.RepAcceptanceInfoAreaId = fieldControl.InfoAreaId;
                }
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSEQuotaHandler"/> class.
        /// </summary>
        /// <param name="serialEntry">The serial entry.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="date">The date.</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <exception cref="Exception">
        /// ArticleConfigurationSearchAndList is null
        /// or
        /// QuotaSearchAndList is null
        /// </exception>
        private UPSEQuotaHandler(UPSerialEntry serialEntry, ViewReference configuration, DateTime date, UPSEQuotaHandlerDelegate theDelegate)
        {
            this.SerialEntry   = serialEntry;
            this.Configuration = configuration;
            this.TheDelegate   = theDelegate;
            this.Date          = date;
            var configStore = ConfigurationUnitStore.DefaultStore;

            this.InitializeBaseConfigStore(configStore);
            this.InitializeMax();

            this.ParentLinkString = this.Configuration.ContextValueForKey("ParentLink");
            this.RequestOption    = UPCRMDataStore.RequestOptionFromString(
                this.Configuration.ContextValueForKey("RequestOption"),
                UPRequestOption.FastestAvailable);
            this.ItemNumberFunctionName = this.Configuration.ContextValueForKey("ItemNumberFunctionName");

            if (string.IsNullOrWhiteSpace(this.ItemNumberFunctionName))
            {
                this.ItemNumberFunctionName = "ItemNumber";
            }

            this.RowItemNumberFunctionName = this.Configuration.ContextValueForKey("RowItemNumberFunctionName");
            if (string.IsNullOrWhiteSpace(this.RowItemNumberFunctionName))
            {
                this.RowItemNumberFunctionName = this.ItemNumberFunctionName;
            }

            this.InitializeQuotaFieldNames();

            var configName = this.Configuration.ContextValueForKey("QuotaLinkId");

            if (!string.IsNullOrWhiteSpace(configName))
            {
                int qLinkId = -1;
                int.TryParse(configName, out qLinkId);
                this.QuotaLinkId = qLinkId;
            }
            else
            {
                this.QuotaLinkId = -1;
            }

            this.InitializeConfigOptions();

            configName = this.Configuration.ContextValueForKey("NewQuotaTemplateFilter");
            if (!string.IsNullOrWhiteSpace(configName))
            {
                this.QuotaTemplateFilter = configStore.FilterByName(configName);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Switches to detail.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        public override void SwitchToDetail(IIdentifier identifier)
        {
            bool switchToCoi = this.ViewReference.ContextValueForKey("SwitchToCoi") == "true";

            if (identifier is RecordIdentifier)
            {
                string recordIdentification          = ((RecordIdentifier)identifier).RecordIdentification;
                CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[recordIdentification];
                string editAction = infoAreaConfig.Definition.ValueOrDefault("NodeDetailAction") as string;
                editAction = !string.IsNullOrEmpty(editAction) ? editAction : "SHOWRECORD";
                this.SwitchToRecord(recordIdentification, editAction, true, false, switchToCoi ? new SwitchToFirstCoiIndex() : null);
            }
            else
            {
                // Switch to SearchAndList
                string searchAndListName = this.nodeIdConfigDict[identifier].SearchAndListName;
                if (!string.IsNullOrEmpty(searchAndListName))
                {
                    IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
                    SearchAndList           searchAndList = configStore.SearchAndListByName(searchAndListName);
                    if (searchAndList != null)
                    {
                        Dictionary <string, object> dictionary = new Dictionary <string, object>();
                        dictionary["ConfigName"] = searchAndListName;
                        dictionary["InfoArea"]   = searchAndList.InfoAreaId;
                        UPMCoINode            node = this.vistedNodes[identifier];
                        UPConfigTreeViewTable parentConfigTable = this.nodeIdConfigDict[node.Parent.Identifier];
                        if (!string.IsNullOrEmpty(node.Parent.RecordIdentification))
                        {
                            dictionary["LinkRecord"] = node.Parent.RecordIdentification;
                        }

                        if (parentConfigTable.LinkId > 0)
                        {
                            dictionary["LinkId"] = $"{parentConfigTable.LinkId}";
                        }

                        dictionary[Search.Constants.SwipeDetailRecordsConfigName] = "true";
                        string initialRquestOptionString = UPCRMDataStore.StringFromRequestOption(this.RequestOption);
                        if (!string.IsNullOrEmpty(initialRquestOptionString))
                        {
                            dictionary["InitialRequestOption"] = initialRquestOptionString;
                        }

                        UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromViewReference(new ViewReference(dictionary, "RecordListView"));
                        this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
                    }
                }
            }
        }
Beispiel #8
0
        private void ContinueTemplateFilterGeoChecked()
        {
            bool checkExisting = this.ViewReference.ContextValueIsSet("CheckExisting") || this.ViewReference.ContextValueIsSet("ExistsAction");

            if (!checkExisting)
            {
                this.ContinueRecordDoesNotExist();
                return;
            }

            string          requestModeString = this.ViewReference.ContextValueForKey("RequestMode");
            UPRequestOption requestOption     = UPCRMDataStore.RequestOptionFromString(requestModeString, UPRequestOption.Online);
            string          filterName        = this.ViewReference.ContextValueForKey("TemplateFilter");
            string          infoAreaId        = this.ViewReference.ContextValueForKey("InfoAreaId");
            string          linkIdString      = this.ViewReference.ContextValueForKey("LinkId");

            if (string.IsNullOrEmpty(infoAreaId))
            {
                this.ModelController.HandleOrganizerActionError(LocalizedString.TextErrorConfiguration, string.Format(LocalizedString.TextErrorParameterEmpty, "InfoAreaId"), true);
                return;
            }

            UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(filterName);

            filter        = filter.FilterByApplyingValueDictionaryDefaults(this.sourceCopyFields, true);
            this.CrmQuery = new UPContainerMetaInfo(null, infoAreaId);
            if (this.CrmQuery == null)
            {
                this.ModelController.HandleOrganizerActionError(LocalizedString.TextErrorConfiguration, string.Format(LocalizedString.TextErrorParameterEmpty, "crmQuery"), true);
                return;
            }

            this.CrmQuery.ApplyFilter(filter);
            if (!string.IsNullOrEmpty(this.LinkRecordIdentification))
            {
                int linkId = -1;
                if (!string.IsNullOrEmpty(linkIdString))
                {
                    linkId = Convert.ToInt32(linkIdString);
                }

                this.CrmQuery.SetLinkRecordIdentification(this.LinkRecordIdentification, linkId);
            }

            this.CrmQuery.Find(requestOption, this);
        }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CoIBaseNodeLoader"/> class.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="depth">The depth.</param>
        /// <param name="maxDepth">The maximum depth.</param>
        /// <param name="vistedNodes">The visted nodes.</param>
        public CoIBaseNodeLoader(UPMCoINode node, ViewReference viewReference, int depth, int maxDepth, Dictionary <IIdentifier, UPMCoINode> vistedNodes)
        {
            this.RootNode      = node;
            this.viewReference = viewReference;
            string requestOptionString = this.viewReference.ContextValueForKey("RequestOption");

            this.requestOption      = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline);
            this.depth              = depth;
            this.maxDepth           = maxDepth;
            this.vistedNodes        = vistedNodes;
            this.subNodeLoader      = new List <CoIBaseNodeLoader>();
            this.ChangedIdentifiers = new List <IIdentifier>();
            this.pendingCount       = 0;
            this.configName         = this.viewReference.ContextValueForKey("ConfigName");
            this.ChangedIdentifiers.Add(this.RootNode.Identifier);
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.expandSettings = configStore.ExpandByName(this.configName);
        }
Beispiel #10
0
        /// <summary>
        /// Builds the page.
        /// </summary>
        protected virtual void BuildPage()
        {
            string recordId = this.ViewReference.ContextValueForKey("recordId");

            if (string.IsNullOrEmpty(recordId))
            {
                recordId = this.ViewReference.ContextValueForKey("RecordId");
            }

            this.RootRecordIdentification = UPCRMDataStore.DefaultStore.ReplaceRecordIdentification(recordId);
            this.InfoAreaId = this.RootRecordIdentification.InfoAreaId();
            string requestOptionString = this.ViewReference.ContextValueForKey("RequestOption");

            this.RequestOption = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline);
            this.MaxDepth      = Convert.ToInt32(this.ViewReference.ContextValueForKey("TreeMaxDepth"));
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.ExpandSettings = configStore.ExpandByName(this.ConfigName) ?? configStore.ExpandByName(this.InfoAreaId);
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSurvey"/> class.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="theDelegate">The delegate.</param>
        public UPSurvey(ViewReference viewReference, string recordIdentification, ISurveyDelegate theDelegate)
        {
            this.ViewReference        = viewReference;
            this.RecordIdentification = recordIdentification;
            this.TheDelegate          = theDelegate;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.SurveySearchAndList        = configStore.SearchAndListByName(this.ViewReference.ContextValueForKey("SurveySearchAndListName"));
            this.SurveyTemplateFilter       = configStore.FilterByName(this.ViewReference.ContextValueForKey("SurveyTemplateFilter"));
            this.SurveyAnswerSearchAndList  = configStore.SearchAndListByName(this.ViewReference.ContextValueForKey("SurveyAnswerSearchAndListName"));
            this.SurveyAnswerTemplateFilter = configStore.FilterByName(this.ViewReference.ContextValueForKey("SurveyAnswerTemplateFilter"));
            this.ParentLink           = this.ViewReference.ContextValueForKey("ParentLink");
            this.SourceCopyFieldGroup = configStore.FieldControlByNameFromGroup("List", this.ViewReference.ContextValueForKey("SourceCopyFieldGroupName"));
            FieldControl fieldControl = configStore.FieldControlByNameFromGroup("Edit", this.SurveyAnswerSearchAndList.FieldGroupName) ??
                                        configStore.FieldControlByNameFromGroup("List", this.SurveyAnswerSearchAndList.FieldGroupName);

            foreach (FieldControlTab tab in fieldControl.Tabs)
            {
                foreach (UPConfigFieldControlField field in tab.Fields)
                {
                    if (field.Function == Constants.QuestionnaireAnswer)
                    {
                        this.AnswerAnswerTextField = field;
                    }
                    else if (field.Function == Constants.QuestionnaireAnswerNumber)
                    {
                        this.AnswerAnswerNumberField = field;
                    }
                    else if (field.Function == Constants.QuestionnaireQuestionNumber)
                    {
                        this.AnswerQuestionNumberField = field;
                    }
                }
            }

            this.QuestionnaireLinkName    = this.ViewReference.ContextValueForKey("QuestionnaireLinkName");
            this.SourceRequestOption      = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("SourceRequestOption"), UPRequestOption.FastestAvailable);
            this.DestinationRequestOption = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("DestinationRequestOption"), UPRequestOption.BestAvailable);
            this.surveyAnswers            = new Dictionary <string, UPSurveyAnswer>();
        }
Beispiel #12
0
        private void Initialize(string recordIdentification, Dictionary <string, object> parameters, bool editMode)
        {
            this.RecordIdentification          = recordIdentification;
            this.ViewReference                 = (ViewReference)parameters["viewReference"];
            this.DestinationFieldControlName   = this.ViewReference.ContextValueForKey("DestinationFieldGroup");
            this.GroupSearchAndListControlName = this.ViewReference.ContextValueForKey("GroupSearchAndList");
            this.ItemSearchAndListControlName  = this.ViewReference.ContextValueForKey("ItemSearchAndList");
            this.SourceFieldControlName        = this.ViewReference.ContextValueForKey("SourceFieldControl");
            this.DestinationFilterName         = this.ViewReference.ContextValueForKey("DestinationReadFilter");
            this.SourceRecordIdentification    = this.ViewReference.ContextValueForKey("RecordId");
            this.SourceRequestOption           = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("SourceRequestOption"), UPRequestOption.FastestAvailable);
            this.DestinationRequestOption      = UPCRMDataStore.RequestOptionFromString(this.ViewReference.ContextValueForKey("DestinationRequestOption"), UPRequestOption.BestAvailable);

            if (string.IsNullOrEmpty(this.SourceRecordIdentification))
            {
                this.SourceRecordIdentification = this.RecordIdentification;
            }

            this.EditMode = editMode;
            if (!this.SetControlsFromParameters())
            {
                throw new InvalidOperationException("Failed: SetControlsFromParameters");
            }
        }
Beispiel #13
0
        private bool SetControlsFromParameters()
        {
            ViewReference viewReference = null;

            if (this.Parameters.ContainsKey("viewReference"))
            {
                viewReference = (ViewReference)this.Parameters["viewReference"];
            }

            // create rightsfilter
            string rightsFilterName = viewReference?.ContextValueForKey(Constants.RightsFilterConfigurationName);

            if (!string.IsNullOrEmpty(rightsFilterName))
            {
                IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                this.RightsFilter = configStore.FilterByName(rightsFilterName);
            }

            if (this.RightsFilter != null)
            {
#if PORTING
                NSDictionary filterParameters = (NSDictionary)viewReference.ContextValueForKey(Constants.RightsFilterCopyFieldConfigurationName);
                if (filterParameters != null)
                {
                    UPConditionValueReplacement replacement = new UPConditionValueReplacement(filterParameters);
                    this.RightsFilter = this.RightsFilter.FilterByApplyingReplacements(replacement);
                }
                else
#endif
                {
                    this.RightsFilter = this.RightsFilter.FilterByApplyingDefaultReplacements();
                }
            }

            this.RequestOption       = UPCRMDataStore.RequestOptionFromString(viewReference?.ContextValueForKey(Constants.RequestOptionConfigurationName), UPRequestOption.Offline);
            this.groupConfigurations = new List <UPObjectivesConfiguration>();
            UPObjectivesConfiguration individualConfiguration = UPObjectivesConfiguration.Create(viewReference, Constants.IndividualSectionPostFix, this.Parameters, this.EditMode);
            if (individualConfiguration != null)
            {
                this.groupConfigurations.Add(individualConfiguration);
            }

            UPObjectivesConfiguration salesConfiguration = UPObjectivesConfiguration.Create(viewReference, Constants.SalesSectionPostFix, this.Parameters, this.EditMode);
            if (salesConfiguration != null)
            {
                this.groupConfigurations.Add(salesConfiguration);
            }

            List <string> additionalFieldGroups = this.StringsFromCommaSeparatedString(viewReference?.ContextValueForKey(Constants.AdditionalFieldgroupsConfigurationName));

            // load additional sections
            if (additionalFieldGroups?.Count > 0)
            {
                List <string> additionalDestinationFilter  = this.StringsFromCommaSeparatedString(viewReference?.ContextValueForKey(Constants.AdditionalFilterConfigurationName));
                List <string> additionalSourceFieldControl = this.StringsFromCommaSeparatedString(viewReference?.ContextValueForKey(Constants.AdditionalSourceFieldControlConfigurationName));
                if ((additionalDestinationFilter != null && additionalSourceFieldControl != null) && (additionalFieldGroups.Count == additionalDestinationFilter.Count) && (additionalDestinationFilter.Count == additionalSourceFieldControl.Count))
                {
                    Dictionary <string, object> additionalParameterDictionary = new Dictionary <string, object>(this.Parameters);
                    for (int additionalSectionIndex = 0; additionalSectionIndex < additionalDestinationFilter.Count; additionalSectionIndex++)
                    {
                        string sectionName = $"AdditionalSection_{additionalSectionIndex}";
                        string destinationFieldGroupName = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterDestinationFieldGroupConfigurationName, sectionName);
                        string destinationFilterName     = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterDestinationFilterConfigurationName, sectionName);
                        string sourceFieldControlName    = UPObjectivesConfiguration.CombineConfigurationNameWithSection(Constants.ParameterSourceFieldControlConfigurationName, sectionName);
                        additionalParameterDictionary[destinationFieldGroupName] = additionalFieldGroups[additionalSectionIndex];
                        additionalParameterDictionary[destinationFilterName]     = additionalDestinationFilter[additionalSectionIndex];
                        additionalParameterDictionary.SetObjectForKey(additionalSourceFieldControl[additionalSectionIndex], sourceFieldControlName);
                        UPObjectivesConfiguration additionalConfiguration = UPObjectivesConfiguration.Create(viewReference, sectionName, additionalParameterDictionary, this.EditMode);
                        if (additionalConfiguration != null)
                        {
                            this.groupConfigurations.Add(additionalConfiguration);
                        }
                    }
                }
            }

            this.record     = new UPCRMRecord(this.RecordIdentification);
            this.ParentLink = viewReference?.ContextValueForKey("ParentLink");
            return(true);
        }
        /// <summary>
        /// Updates the metadata with view reference.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        public override void UpdateMetadataWithViewReference(ViewReference viewReference)
        {
            base.UpdateMetadataWithViewReference(viewReference);
            string jsonString = viewReference.ContextValueForKey("SigningConfig");

            if (!string.IsNullOrEmpty(jsonString))
            {
                Dictionary <string, object> defaultConfigDict = "{\"sign\": true, \"upload\": true, \"emptySignatureName\": \"Button:PleaseSign\", \"signatureImageTagName\": \"SignatureImage\", \"signatureImageId\": \"img-signature\", \"signedReportFileName\": \"SampleReport.pdf\", \"signedReportFileNameDateFormat\": \"yyyy-MM-dd\"}".JsonDictionaryFromString();
                Dictionary <string, object> tempDict          = new Dictionary <string, object>(defaultConfigDict);

                foreach (var entry in jsonString.JsonDictionaryFromString())
                {
                    tempDict[entry.Key] = entry.Value;
                }

                this.SigningConfig = new Dictionary <string, object>(tempDict);
            }
            else
            {
                this.SigningConfig = null;
            }

            if (this.SigningConfig != null)
            {
                this.PdfFileName            = this.SigningConfig.ValueOrDefault("signedReportFileName") as string;
                this.PdfFileNameDateFormat  = this.SigningConfig.ValueOrDefault("signedReportFileNameDateFormat") as string;
                this.SignatureImageId       = this.SigningConfig.ValueOrDefault("signatureImageId") as string;
                this.SignatureTitle         = this.SigningConfig.ValueOrDefault("signatureTitle") as string;
                this.signatureImageTagNames = ((string)this.SigningConfig["signatureImageTagName"]).Split(';').ToList();
                //this.WithSignature = this.SigningConfig.BoolValueForKeyTheDefault("sign", true);
                //this.UploadReport = this.SigningConfig.BoolValueForKeyTheDefault("upload", true);

                this.signaturePathNames = new List <string>();
                IFileStorage fileStore           = ServerSession.CurrentSession.FileStore;
                var          emptySignatureNames = ((string)this.SigningConfig["emptySignatureName"]).Split(';');
                for (int i = 0; i < emptySignatureNames.Length; i++)
                {
                    string emptySignatureName         = emptySignatureNames[i];
                    string languageEmptySignatureName = $"{emptySignatureName}_{ServerSession.CurrentSession.LanguageKey}";
                    //string languageEmptySignaturePathName = fileStore.ImagePathForName(languageEmptySignatureName);
                    //string emptySignaturePathName = languageEmptySignaturePathName ?? fileStore.ImagePathForName(emptySignatureName);
                    //string signatureFileName = NSString.StringWithFormat("signature-%lu.%@", i, emptySignaturePathName.PathExtension());
                    //string signaturePathName = fileStore.BaseDirectoryPath().StringByAppendingPathComponent(signatureFileName);
                    //if (!string.IsNullOrEmpty(emptySignaturePathName))
                    //{
                    //    NSFileManager.DefaultManager().RemoveItemAtPathError(signaturePathName, null);
                    //    NSFileManager.DefaultManager().CopyItemAtPathToPathError(emptySignaturePathName, signaturePathName, null);
                    //}

                    //signaturePathNames.AddObject(signaturePathName);
                }
            }

            string configParentLink = viewReference.ContextValueForKey("ConfigParentLink");
            UPWebContentClientReport clientReport = new UPWebContentClientReport(viewReference.ContextValueForKey("ConfigName"), viewReference.ContextValueForKey("RootName"), configParentLink);
            string additionalConfigNames          = viewReference.ContextValueForKey("AdditionalConfigNames");
            string additionalRootNames            = viewReference.ContextValueForKey("AdditionalRootNames");

            if (!string.IsNullOrEmpty(additionalConfigNames))
            {
                string   additionalConfigParentLinkString = viewReference.ContextValueForKey("AdditionalConfigParentLinks");
                string[] additionalConfigParentLinks      = null;
                var      configNameParts = additionalConfigNames.Split(';');
                if (!string.IsNullOrEmpty(additionalConfigParentLinkString))
                {
                    additionalConfigParentLinks = additionalConfigParentLinkString.Split(';');
                }

                string[] rootNameParts = null;
                if (!string.IsNullOrEmpty(additionalRootNames))
                {
                    rootNameParts = additionalRootNames.Split(';');
                }

                int count = configNameParts.Length;
                List <UPWebContentClientReport> clientReportArray = new List <UPWebContentClientReport>(count + 1);
                clientReportArray.Add(clientReport);
                for (int i = 0; i < count; i++)
                {
                    string parentLinkConfig = null;
                    if (additionalConfigParentLinks?.Length > i)
                    {
                        parentLinkConfig = additionalConfigParentLinks[i];
                    }

                    clientReport = new UPWebContentClientReport(configNameParts[i], rootNameParts?.Length > i ? rootNameParts[i] : null, parentLinkConfig);
                    clientReportArray.Add(clientReport);
                }

                this.ClientReports = clientReportArray;
            }
            else
            {
                this.ClientReports = new List <UPWebContentClientReport> {
                    clientReport
                };
            }

            this.RootXmlName   = viewReference.ContextValueForKey("XmlRootElementName");
            this.XslName       = viewReference.ContextValueForKey("Xsl");
            this.RequestOption = UPCRMDataStore.RequestOptionFromString(viewReference.ContextValueForKey("RequestOption"), UPRequestOption.FastestAvailable);
            this.RequestOptionDependentOnRoot = viewReference.ContextValueIsSet("RequestOptionDependentOnRoot");
            if (this.RequestOptionDependentOnRoot && this.TheDelegate.IsOnline)
            {
                this.RequestOption = UPRequestOption.Online;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPInsightBoardItemGroupModelController"/> class.
        /// </summary>
        /// <param name="menu">The menu.</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <param name="sortIndex">Index of the sort.</param>
        /// <param name="insightBoardItemViewReference">The insight board item view reference.</param>
        /// <param name="recordIdentification">The record identification.</param>
        public UPInsightBoardItemGroupModelController(Menu menu, IGroupModelControllerDelegate theDelegate, int sortIndex,
                                                      ViewReference insightBoardItemViewReference, string recordIdentification)
            : base(theDelegate)
        {
            this.Menu      = menu;
            this.SortIndex = sortIndex;
            this.InsightBoardItemViewReference = insightBoardItemViewReference;
            this.recordIdentification          = recordIdentification;
            bool showImage = false;
            UPMInsightBoardItemType insightBoardType;

            if (menu?.ViewReference?.ViewName == "InsightBoardItem")
            {
                string contextMenuName = this.Menu.ViewReference.ContextValueForKey("ContextMenu");
                this.isAlternativeContextMenu = false;
                if (!string.IsNullOrEmpty(contextMenuName))
                {
                    IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
                    Menu configMenu = configStore.MenuByName(contextMenuName);
                    if (configMenu != null)
                    {
                        this.relevantViewReference = configMenu.ViewReference;
                        this.countable             = this.relevantViewReference.ViewName == "RecordListView";
                        if (this.relevantViewReference.ContextValueForKey("Modus") == "GeoSearch")
                        {
                            this.countable = false;
                        }

                        if (menu.ViewReference.ContextValueIsSet("ForceActionStyle"))
                        {
                            this.forcedRecordListView = this.countable;
                            this.countable            = false;
                        }
                        else
                        {
                            this.forcedRecordListView = false;
                        }

                        this.isAlternativeContextMenu = true;
                        if (this.countable)
                        {
                            this.searchAndListConfigurationName = this.relevantViewReference.ContextValueForKey("ConfigName");
                            this.infoAreaid = this.relevantViewReference.ContextValueForKey("InfoArea");
                            if (string.IsNullOrEmpty(this.searchAndListConfigurationName))
                            {
                                this.searchAndListConfigurationName = this.infoAreaid;
                            }
                        }
                    }
                }

                if (!this.isAlternativeContextMenu)
                {
                    this.relevantViewReference = this.Menu.ViewReference;
                    this.countable             = true;
                    if (menu.ViewReference.ContextValueIsSet("ForceActionStyle"))
                    {
                        this.forcedRecordListView = true;
                        this.countable            = false;
                    }

                    this.searchAndListConfigurationName = this.relevantViewReference.ContextValueForKey("ConfigName");
                    if (this.forcedRecordListView)
                    {
                        IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
                        SearchAndList           searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName);
                        this.infoAreaid = searchAndList.InfoAreaId;
                    }
                }

                string requestOptionString = this.Menu.ViewReference.ContextValueForKey("RequestOption");
                this.relevantViewReference = new ViewReference(this.relevantViewReference, requestOptionString, "InitialRequestOption", null);
                this.requestOption         = UPCRMDataStore.RequestOptionFromString(requestOptionString, UPRequestOption.Offline);
                insightBoardType           = this.countable ? UPMInsightBoardItemType.Count : UPMInsightBoardItemType.Action;
            }
            else
            {
                this.relevantViewReference = this.Menu.ViewReference;
                showImage        = true;
                insightBoardType = UPMInsightBoardItemType.ExMenu;
            }

            UPMInsightBoardGroup insightBoardGroup = new UPMInsightBoardGroup(StringIdentifier.IdentifierWithStringId("temp"));

            insightBoardGroup.LabelText = "InsightBoard";
            this.Group           = insightBoardGroup;
            this.ControllerState = GroupModelControllerState.Pending;
            IIdentifier identifier;

            if (!string.IsNullOrEmpty(this.infoAreaid))
            {
                identifier = new RecordIdentifier(this.infoAreaid, null);
            }
            else
            {
                identifier = StringIdentifier.IdentifierWithStringId("InsightBoardItem");
            }

            UPMInsightBoardItem item = new UPMInsightBoardItem(identifier)
            {
                ShowImage = showImage,
                Type      = insightBoardType
            };

            this.Group.AddChild(item);
        }
Beispiel #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPCRMLinkInfo"/> class.
 /// </summary>
 /// <param name="infoAreaId">
 /// The information area identifier.
 /// </param>
 /// <param name="targetInfoAreaId">
 /// The _target information area identifier.
 /// </param>
 /// <param name="linkId">
 /// The _link identifier.
 /// </param>
 /// <param name="dataStore">
 /// The data store.
 /// </param>
 public UPCRMLinkInfo(string infoAreaId, string targetInfoAreaId, int linkId, UPCRMDataStore dataStore)
     : this(infoAreaId, dataStore?.DatabaseInstance?.GetTableInfoByInfoArea(infoAreaId)?.GetLink(targetInfoAreaId, linkId))
 {
 }