/// <summary>
        /// Builds Tabs for Forms
        /// </summary>
        /// <param name="dashboardOrganizer">
        /// UPMOrganizer
        /// </param>
        /// <param name="form">
        /// Form
        /// </param>
        private void BuildFormTabs(UPMOrganizer dashboardOrganizer, Form form)
        {
            var count = form.NumberOfTabs;

            for (int i = 0; i < count; i++)
            {
                var parameterDictionary = new Dictionary <string, object> {
                    { "ConfigTabNr", i.ToString() }
                };
                var pageViewReference = ViewReference.ViewReferenceWith(parameterDictionary);
                pageViewReference = pageViewReference.ViewReferenceWith(RecordIdentification);
                var pageModelController = PageForViewReference(pageViewReference);
                if (pageModelController != null)
                {
                    FormTab tab = form.TabAtIndex(i);
                    if (i == 0 && tab.AttributeForKey("Color") != null)
                    {
                        Organizer.OrganizerColor = AureaColor.ColorWithString(tab.AttributeForKey("Color"));
                    }

                    pageModelController.Page.Parent    = dashboardOrganizer;
                    pageModelController.Page.LabelText = tab.Label;
                    AddPageModelController(pageModelController);
                    dashboardOrganizer.AddPage(pageModelController.Page);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Builds the pages from view reference.
        /// </summary>
        public override void BuildPagesFromViewReference()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("History"));

            this.TopLevelElement        = detailOrganizer;
            detailOrganizer.ExpandFound = true;
            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string headerName              = this.ViewReference.ContextValueForKey("HeaderName");
            IConfigurationUnitStore store  = ConfigurationUnitStore.DefaultStore;
            UPConfigHeader          header = store.HeaderByName(headerName);

            if (!string.IsNullOrEmpty(header.Label))
            {
                detailOrganizer.TitleText = header.Label;
            }

            this.ShouldShowTabsForSingleTab = false;
            UPHistorySearchPageModelController docPageModelController = new UPHistorySearchPageModelController(this.ViewReference);

            this.AddPageModelController(docPageModelController);
        }
        /// <summary>
        /// Builds the detail organizer pages.
        /// </summary>
        protected override void BuildDetailOrganizerPages()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Documemnts"));

            detailOrganizer.ExpandFound = true;
            this.TopLevelElement        = detailOrganizer;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string organizerColorKey            = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            detailOrganizer.SubtitleText = header != null ? header.Label : LocalizedString.TextProcessDocuments;

            this.ShouldShowTabsForSingleTab = false;
            DocumentPageModelController docPageModelController = new DocumentPageModelController(this.ViewReference);

            this.AddPageModelController(docPageModelController);
        }
        /// <summary>
        /// Builds the detail organizer pages.
        /// </summary>
        public void BuildDetailOrganizerPages()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Details"));

            this.TopLevelElement        = detailOrganizer;
            detailOrganizer.ExpandFound = true;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string          configName          = this.ViewReference.ContextValueForKey("LayoutName");
            WebConfigLayout layout = configStore.WebConfigLayoutByName(configName);

            if (layout == null)
            {
                return;
            }

            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            if (header == null)
            {
                headerName = "SYSTEMINFO.Expand";
                header     = configStore.HeaderByName(headerName);
            }

            if (header != null)
            {
                detailOrganizer.SubtitleText = header.Label;
                this.AddActionButtonsFromHeaderRecordIdentification(header, null);
            }
            else
            {
                detailOrganizer.SubtitleText = LocalizedString.TextSettings;
                UPMOrganizerAction action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.edit"));
                action.SetTargetAction(this, this.SwitchToEdit);
                action.LabelText = LocalizedString.TextEdit;
                action.IconName  = "Button:Edit";
                this.AddOrganizerHeaderActionItem(action);
            }

            SettingsViewPageModelController detailPageModelController = new SettingsViewPageModelController(this.ViewReference);
            Page overviewPage = detailPageModelController.Page;

            this.AddPageModelController(detailPageModelController);
            detailOrganizer.AddPage(overviewPage);
        }
コード例 #5
0
        /// <summary>
        /// Applies the json dictionary.
        /// </summary>
        /// <param name="dict">The dictionary.</param>
        public void ApplyJsonDictionary(Dictionary <string, object> dict)
        {
#if PORTING
            foreach (string key in dict.Keys)
            {
                //SEL sel = NSSelectorFromString(key);
                if (key.StartsWith("field") || key.StartsWith("selectedfield"))
                {
                    this.SetValueForKey(dict[key], key);
                }

                const char type = this.TypeOfPropertyNamed(key);
                if (type)
                {
                    string typeInfo = NSString.StringWithCStringEncoding(type, NSUTF8StringEncoding);
                    object value;
                    if (typeInfo.HasPrefix("T@\"UPColor\""))
                    {
                        // UPColor conversion
                        AureaColor upcolor = AureaColor.ColorWithString((string)dict[key]);
                        value = upcolor;
                    }
                    else if (typeInfo.HasPrefix("T{CGSize=ff}"))
                    {
                        ArrayList array  = (ArrayList)dict[key];
                        NSNumber  width  = array[0];
                        NSNumber  height = array[1];
                        value = NSValue.ValueWithCGSize(CGSizeMake(width.FloatValue(), height.FloatValue()));
                    }
                    else if (typeInfo.HasPrefix("T@\"UIFont\""))
                    {
                        ArrayList array      = (ArrayList)dict.ObjectForKey(key);
                        string    familyName = array[0];
                        NSNumber  size       = array[1];
                        value = UIFont.FontWithNameSize(familyName, size.FloatValue());
                    }
                    else if (typeInfo.HasPrefix("T@\"UPMCoIEdgeViewConfig\"") || typeInfo.HasPrefix("T@\"UPMCoINodeViewConfig\""))
                    {
                        UPMCoIConfigBase base = this.ValueForKey(key);
                        value = dict.ObjectForKey(key);
                        if (value.IsKindOfClass(NSDictionary.TheClass))
                        {
                            base.ApplyJsonDictionary(value);
                        }

                        continue;
                    }
                    else
                    {
                        value = dict[key];
                    }

                    this.SetValueForKey(value, key);
                }
            }
#endif
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPMResultSection"/> class.
        /// </summary>
        /// <param name="identifier">
        /// The identifier.
        /// </param>
        public UPMResultSection(IIdentifier identifier)
            : base(identifier)
        {
            // Default Style Initialization
            // this.SectionField.valueFontStyle = UPMFontStylePlain;
            // this.SectionField.ValueFontColor = AureaColor.ColorWithString(@"0.33;0.33;0.33;1.0"); // dark Grey
            this.BarColor = AureaColor.ColorWithString(@"1.0;0.0;0.0;1.0");

            // this.SectionField.valueFontSize = 19.0f;
        }
        /// <summary>
        /// Results the section for search result.
        /// </summary>
        /// <param name="preparedSearch">The prepared search.</param>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        public virtual UPMResultSection ResultSectionForSearchResult(UPSearchPageModelControllerPreparedSearch preparedSearch, UPCRMResult result)
        {
            var configStore   = ConfigurationUnitStore.DefaultStore;
            var resultContext = new UPCoreMappingResultContext(result, preparedSearch.CombinedControl, preparedSearch.ListFieldControl.NumberOfFields);

            this.SectionContexts.SetObjectForKey(resultContext, preparedSearch.InfoAreaId);
            var resultSection  = new UPMResultSection(StringIdentifier.IdentifierWithStringId($"Search_{preparedSearch.InfoAreaId}"));
            var infoAreaConfig = configStore.InfoAreaConfigById(preparedSearch.InfoAreaId);

            if (infoAreaConfig != null)
            {
                var colorKey = infoAreaConfig.ColorKey;
                if (!string.IsNullOrEmpty(colorKey))
                {
                    resultSection.BarColor = AureaColor.ColorWithString(colorKey);
                }

                var imageName = infoAreaConfig.ImageName;
                if (!string.IsNullOrEmpty(imageName))
                {
                    var fileResource = configStore.ResourceByName(imageName);
                    if (fileResource != null)
                    {
                        resultSection.GlobalSearchIconName = fileResource.FileName;
                    }
                }
            }

            resultSection.SectionField = new UPMField(StringIdentifier.IdentifierWithStringId("SectionLabel"));
            var sectionName = infoAreaConfig?.PluralName;

            if (string.IsNullOrEmpty(sectionName))
            {
                var tableInfo = UPCRMDataStore.DefaultStore.TableInfoForInfoArea(preparedSearch.InfoAreaId);
                sectionName = tableInfo != null ? tableInfo.Label : preparedSearch.InfoAreaId;
            }

            resultSection.SectionField.FieldValue = sectionName;
            var count = result.RowCount;

            for (var j = 0; j < count; j++)
            {
                var dataRow    = result.ResultRowAtIndex(j) as UPCRMResultRow;
                var identifier = new RecordIdentifier(preparedSearch.InfoAreaId, dataRow.RecordIdAtIndex(0));
                var resultRow  = new UPMResultRow(identifier);
                resultContext.RowDictionary.Add(resultRow.Key, new UPCoreMappingResultRowContext(dataRow, resultContext));
                resultContext.ExpandMapper = preparedSearch.ExpandSettings;
                resultRow.Invalid          = true;
                resultRow.DataValid        = true;
                resultSection.AddResultRow(resultRow);
            }

            return(resultSection);
        }
        /// <summary>
        /// Searches the operation did finish with count.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="count">The count.</param>
        public void SearchOperationDidFinishWithCount(Operation operation, int count)
        {
            this.ControllerState = GroupModelControllerState.Finished;
            UPMInsightBoardItem item = (UPMInsightBoardItem)this.Group.Children[0];

            item.Countable = true;
            item.Count     = count;
            item.SortIndex = this.SortIndex;
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(this.searchAndListConfigurationName);

            this.infoAreaid = searchAndList.InfoAreaId;
            InfoArea infoAreaConfig = configStore.InfoAreaConfigById(this.infoAreaid);

            if (!string.IsNullOrEmpty(infoAreaConfig.ColorKey))
            {
                item.Color = AureaColor.ColorWithString(infoAreaConfig.ColorKey);
            }

            if (!string.IsNullOrEmpty(this.Menu.DisplayName))
            {
                item.Title = this.Menu.DisplayName;
            }
            else
            {
                item.Title = item.Count > 1 ? infoAreaConfig.PluralName : infoAreaConfig.SingularName;
            }

            item.ImageName = this.Menu.ImageName ?? infoAreaConfig.ImageName;
            UPMAction action = new UPMAction(null);

            if (count == 1)
            {
                this.crmQuery.Find(this.requestOption, this);
                action.SetTargetAction(this, this.SwitchToDetailOrganizer);
            }
            else
            {
                action.SetTargetAction(this, this.SwitchToListOrganizer);
            }

            item.Action = action;
            if (count != 1)
            {
                this.Delegate.GroupModelControllerFinished(this);
            }
        }
コード例 #9
0
        /// <summary>
        /// Builds the pages from view reference.
        /// </summary>
        public override void BuildPagesFromViewReference()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Details"));

            this.TopLevelElement = detailOrganizer;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;

            this.ConfigName = this.ViewReference.ContextValueForKey("LayoutName");
            WebConfigLayout layout = configStore.WebConfigLayoutByName(this.ConfigName);

            if (layout == null)
            {
                return;
            }

            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            detailOrganizer.TitleText = header != null ? header.Label : LocalizedString.TextSettings;

            EditSettingsPageModelController detailPageModelController = new EditSettingsPageModelController(this.ViewReference);
            Page overviewPage = detailPageModelController.Page;

            this.AddPageModelController(detailPageModelController);
            detailOrganizer.AddPage(overviewPage);
            this.AddOrganizerActions();
            detailOrganizer.ExpandFound = true;
        }
        private UPMGroup BuildGroup(UPMGroup group)
        {
            Dictionary <string, string> infoAreaImageFileNames = new Dictionary <string, string>();
            IConfigurationUnitStore     configStore            = ConfigurationUnitStore.DefaultStore;
            UPConfigExpand repExpand = configStore.ExpandByName("ID");

            this.linkParticipantsViewReference = null;

            if (!string.IsNullOrEmpty(this.linkParticipantsName))
            {
                SearchAndList searchAndList = configStore.SearchAndListByName(this.linkParticipantsName);
                Menu          menu          = searchAndList != null?configStore.MenuByName(searchAndList.DefaultAction) : null;

                this.linkParticipantsViewReference = menu?.ViewReference;
            }

            if (this.acceptanceCatalogAttributes == null && this.recordParticipants.AcceptanceField != null)
            {
                this.acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(this.recordParticipants.AcceptanceField.InfoAreaId, this.recordParticipants.AcceptanceField.FieldId);
            }

            foreach (UPCRMParticipant participant in this.recordParticipants.Participants)
            {
                bool           isRepParticipant = participant is UPCRMRepParticipant;
                IIdentifier    identifier       = StringIdentifier.IdentifierWithStringId(participant.Key);
                UPMListRow     listRow          = new UPMListRow(identifier);
                UPMStringField nameField        = new UPMStringField(StringIdentifier.IdentifierWithStringId("name"));
                nameField.StringValue = participant.Name;
                listRow.AddField(nameField);
                UPMStringField acceptanceField = new UPMStringField(StringIdentifier.IdentifierWithStringId("acceptance"));
                if (!isRepParticipant || this.recordParticipants.HasRepAcceptance)
                {
                    acceptanceField.StringValue = participant.AcceptanceDisplayText;
                    UPConfigCatalogValueAttributes configCatalogValueAttributes = this.acceptanceCatalogAttributes?.ValuesByCode[Convert.ToInt32(participant.AcceptanceText)];
                    string colorString = configCatalogValueAttributes?.ColorKey;
                    if (!string.IsNullOrEmpty(colorString))
                    {
                        listRow.RowColor = AureaColor.ColorWithString(colorString);
                    }
                }
                else
                {
                    acceptanceField.StringValue = string.Empty;
                }

                listRow.AddField(acceptanceField);
                UPMStringField requirementField = new UPMStringField(StringIdentifier.IdentifierWithStringId("requirement"));
                requirementField.StringValue = participant.RequirementDisplayText;
                listRow.AddField(requirementField);
                if (isRepParticipant)
                {
                    // listRow.Icon = UIImage.UpImageWithFileName(repExpand.ImageName);     // CRM-5007
                    listRow.RowAction = null;
                }
                else
                {
                    UPCRMLinkParticipant linkParticipant = (UPCRMLinkParticipant)participant;
                    string _infoAreaId = linkParticipant.LinkRecordIdentification.InfoAreaId();
                    string imageName   = infoAreaImageFileNames.ValueOrDefault(_infoAreaId);
                    if (imageName == null)
                    {
                        UPConfigExpand expand = configStore.ExpandByName(_infoAreaId);
                        imageName = expand.ImageName ?? string.Empty;

                        infoAreaImageFileNames.SetObjectForKey(imageName, _infoAreaId);
                    }

                    // listRow.Icon = UIImage.UpImageWithFileName(imageName);       // CRM-5007
                    listRow.OnlineData = !UPCRMDataStore.DefaultStore.RecordExistsOffline(linkParticipant.LinkRecordIdentification);

                    if (this.linkParticipantsViewReference != null)
                    {
                        UPMAction switchToOrganizerAction = new UPMAction(null);
                        switchToOrganizerAction.IconName = "arrow.png";
                        switchToOrganizerAction.SetTargetAction(this, this.SwitchToOrganizerForLinkParticipant);
                        listRow.RowAction = switchToOrganizerAction;
                    }
                }

                group.AddChild(listRow);
            }

            return(group);
        }
コード例 #11
0
        /// <summary>
        /// Search operation did finish with result
        /// </summary>
        /// <param name="operation">Operation</param>
        /// <param name="result">Result</param>
        public override void SearchOperationDidFinishWithResult(Operation operation, UPCRMResult result)
        {
            UPCRMResultRow resultRow = (UPCRMResultRow)result.ResultRowAtIndex(0);

            this.resCount--;
            if (resultRow != null)
            {
                string           recordIdent      = resultRow.RootRecordIdentification;
                RecordIdentifier recordIdentifier = new RecordIdentifier(recordIdent.InfoAreaId(), recordIdent.RecordId());
                UPMResultRow     row = new UPMResultRow(new RecordIdentifier(recordIdent));
                SearchAndList    searchConfiguration = this.configStore.SearchAndListByName(recordIdent.InfoAreaId());
                FieldControl     listFieldControl    = this.configStore.FieldControlByNameFromGroup("List", searchConfiguration.FieldGroupName);
                InfoArea         configInfoArea      = this.configStore.InfoAreaConfigById(recordIdent.InfoAreaId());
                row.RowColor = AureaColor.ColorWithString(configInfoArea.ColorKey);
                UPCRMListFormatter listFormatter = new UPCRMListFormatter(listFieldControl);
                int             fieldCount       = listFormatter.PositionCount;
                List <UPMField> listFields       = new List <UPMField>(fieldCount);
                for (int i = 0; i < fieldCount; i++)
                {
                    UPConfigFieldControlField configField = listFormatter.FirstFieldForPosition(i);
                    if (configField == null)
                    {
                        continue;
                    }

                    FieldAttributes attributes = configField.Attributes;
                    if (attributes.Hide)
                    {
                        continue;
                    }

                    UPMStringField stringField = new UPMStringField(StringIdentifier.IdentifierWithStringId($"{recordIdent}-{i}"));
                    string         stringValue = listFormatter.StringFromRowForPosition(resultRow, i);
                    if (attributes.Image)
                    {
                        DocumentManager documentManager = new DocumentManager();
                        string          documentKey     = stringValue;
                        DocumentData    documentData    = documentManager.DocumentForKey(documentKey);
                        if (documentData != null)
                        {
                            row.RecordImageDocument = new UPMDocument(documentData);
                        }
                        else
                        {
                            //row.RecordImageDocument = new UPMDocument(recordIdentifier, ServerSession.DocumentRequestUrlForDocumentKey(documentKey));
                        }

                        continue;
                    }

                    if (!string.IsNullOrEmpty(stringValue))
                    {
                        if (attributes.NoLabel && !string.IsNullOrEmpty(configField.Label))
                        {
                            stringValue = $"{configField.Label} {stringValue}";
                        }

                        stringField.StringValue = stringValue;
                        stringField.SetAttributes(attributes);
                    }

                    listFields.Add(stringField);
                }

                row.OnlineData = resultRow.IsServerResponse;
                if (row.OnlineData)
                {
                    //row.StatusIndicatorIcon = UIImage.UpXXImageNamed("crmpad-List-Cloud");    // CRM-5007
                }

                foreach (HistoryEntry entry in this.historyManager.HistoryEntries)
                {
                    if (entry.RecordIdentification == recordIdent)
                    {
                        this.rows.Add(row);
                        if (this.pendingRecords.Contains(recordIdent))
                        {
                            this.pendingRecords.Remove(recordIdent);
                        }

                        break;
                    }
                }

                row.Fields = listFields;
            }

            if (this.resCount == 0)
            {
                this.DisplayPage(this.rows);
            }
        }
コード例 #12
0
        private UPMEditField CreateDependEditField(IIdentifier participantIdentifier, UPCatalog catalog, UPMGroup editGroup)
        {
            UPCRMField field = null;

            if (catalog == this.ParticipantsControl.RequirementCatalog)
            {
                field = this.ParticipantsControl.RequirementField;
            }
            else if (catalog == this.ParticipantsControl.AcceptanceCatalog)
            {
                field = this.ParticipantsControl.AcceptanceField;
            }

            var editField = new UPMParticipantCatalogEditField(StringIdentifier.IdentifierWithStringId(
                                                                   field != null ? $"dependField_{participantIdentifier}_{field.InfoAreaId}_{field.FieldId}" : $"dependField_{participantIdentifier}_(null)_0"))
            {
                GroupModelController = this,
                Group = editGroup
            };

            if (catalog != null)
            {
                var           possibleValues = catalog.Values;
                List <string> explicitKeyOrder;
                var           possibleValuesAsString      = catalog.TextValuesForFieldValues(false);
                var           configStore                 = ConfigurationUnitStore.DefaultStore;
                var           acceptanceCatalogAttributes = configStore.CatalogAttributesForInfoAreaIdFieldId(field.InfoAreaId, field.FieldId);
                foreach (var catalogValue in possibleValues)
                {
                    var possibleValue = new UPMCatalogPossibleValue
                    {
                        TitleLabelField = new UPMStringField(StringIdentifier.IdentifierWithStringId("x"))
                        {
                            StringValue = catalogValue.Text
                        }
                    };

                    var configCatalogValueAttributes = acceptanceCatalogAttributes.ValuesByCode.ValueOrDefault(catalogValue.CodeKey.ToInt());

                    if (configCatalogValueAttributes != null)
                    {
                        var colorString = configCatalogValueAttributes.ColorKey;
                        if (!string.IsNullOrEmpty(colorString))
                        {
                            possibleValue.IndicatorColor = AureaColor.ColorWithString(colorString);
                        }

                        possibleValue.ImageString = configCatalogValueAttributes.ImageName;
                    }

                    possibleValue.Key = catalogValue.CodeKey;

                    editField.AddPossibleValue(possibleValue);
                }

                if (string.IsNullOrEmpty(possibleValuesAsString.ValueOrDefault("0")))
                {
                    editField.NullValueKey = "0";
                }

                if (acceptanceCatalogAttributes != null && !ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByAttributeFilter"))
                {
                    explicitKeyOrder = this.ExplicitKeyOrderByCatalogAttributeCodeOrder(acceptanceCatalogAttributes, catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false));
                }
                else if (ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByCode"))
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false);
                }
                else
                {
                    explicitKeyOrder = catalog.ExplicitKeyOrderEmptyValueIncludeHidden(false, false);
                }

                if (explicitKeyOrder != null)
                {
                    editField.ExplicitKeyOrder = explicitKeyOrder;
                }

                editField.ContinuousUpdate = true;
                editField.DisplayValues    = possibleValuesAsString.Values.ToList();
            }

            return(editField);
        }
コード例 #13
0
        private List <ICalendarItem> CalendarItemsFromResult()
        {
            List <ICalendarItem>    calendarItems = new List <ICalendarItem>();
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;

            this.resultContexts = new List <UPCoreMappingResultContext>();
            UPMAction goToAction = new UPMAction(StringIdentifier.IdentifierWithStringId("action"));

            goToAction.SetTargetAction(this, this.SwitchToDetail);
            goToAction.LabelText = LocalizedString.TextShowRecord;

            foreach (TimelineSearch timelineSearch in this.searches)
            {
                UPCRMResult result   = timelineSearch.Result;
                int         rowCount = result.RowCount;
                if (rowCount == 0)
                {
                    continue;
                }

                UPConfigTableCaption tableCaption = configStore.TableCaptionByName(timelineSearch.TimelineInfoArea.ConfigName) ??
                                                    configStore.TableCaptionByName(timelineSearch.TimelineInfoArea.InfoAreaId);

                List <UPContainerFieldMetaInfo> tableCaptionResultFieldMap = tableCaption.ResultFieldMapFromMetaInfo(result.MetaInfo);
                if (tableCaptionResultFieldMap == null)
                {
                    continue;
                }

                UPCRMResultCondition resultCondition = null;
                var functionNameFieldMapping         = result.MetaInfo.SourceFieldControl.FunctionNames();
                UPConfigFieldControlField fromField  = functionNameFieldMapping["Date"];
                if (fromField != null)
                {
                    if (this.fromDate != null)
                    {
                        resultCondition = new UPCRMResultFieldCondition(fromField.Field, UPConditionOperator.GreaterEqual,
                                                                        this.fromDate.Value.CrmValueFromDate(), fromField.TabIndependentFieldIndex);
                    }

                    if (this.toDate != null)
                    {
                        UPConfigFieldControlField toField = (functionNameFieldMapping.ContainsKey("EndDate")
                            ? functionNameFieldMapping["EndDate"]
                            : null) ?? fromField;

                        UPCRMResultCondition toCondition = new UPCRMResultFieldCondition(toField.Field, UPConditionOperator.LessEqual,
                                                                                         this.toDate.Value.CrmValueFromDate(), toField.TabIndependentFieldIndex);
                        resultCondition = resultCondition != null?resultCondition.ConditionByAppendingANDCondition(toCondition) : toCondition;
                    }
                }

                UPCoreMappingResultContext resultContext = new UPCoreMappingResultContext(result, result.MetaInfo.SourceFieldControl, timelineSearch.PreparedSearch.ListFieldControl.NumberOfFields);
                resultContext.Context = timelineSearch;
                this.resultContexts.Add(resultContext);

                UPConfigExpand expand = configStore.ExpandByName(timelineSearch.TimelineInfoArea.ConfigName) ??
                                        configStore.ExpandByName(timelineSearch.TimelineInfoArea.InfoAreaId);

                AureaColor defaultColor = null;
                if (!string.IsNullOrEmpty(timelineSearch.TimelineInfoArea.ColorString))
                {
                    defaultColor = AureaColor.ColorWithString(timelineSearch.TimelineInfoArea.ColorString);
                }

                if (defaultColor == null)
                {
                    defaultColor = AureaColor.ColorWithString(expand.ColorKey);
                }

                for (int i = 0; i < rowCount; i++)
                {
                    UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                    if (resultCondition != null && !resultCondition.Check(row))
                    {
                        continue;
                    }

                    ConfigTimelineCriteria matchingCriteria = timelineSearch.MatchingCriteriaForRow(row);
                    AureaColor             color            = null;
                    if (matchingCriteria.Setting1 != null)
                    {
                        color = AureaColor.ColorWithString(matchingCriteria.Setting1);
                    }

                    if (color == null)
                    {
                        color = defaultColor;
                    }

                    ICalendarItem calendarItem = new ResultRowCalendarItem(row, resultContext, new RecordIdentifier(row.RootRecordIdentification), tableCaption, tableCaptionResultFieldMap, null, color);
                    calendarItem.GoToAction = goToAction;
                    calendarItems.Add(calendarItem);
                }
            }

            if (this.fromDate != null && this.toDate != null && this.CalendarPage.IncludeSystemCalendar)
            {
#if PORTING
                ArrayList localCalendarItems = ResultRowCalendarItem.EventsFromLocalCalendarFromToSearchTextCalenderIdentifiers(this.fromDate, this.toDate, null, null);
                if (localCalendarItems.Count)
                {
                    calendarItems.AddRange(localCalendarItems);
                }
#endif
            }

            return(calendarItems);
        }
コード例 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ResultRowCalendarItem" /> class.
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="resultContext">The result context.</param>
        /// <param name="identifier">The identifier.</param>
        /// <param name="tableCaption">The table caption.</param>
        /// <param name="tableCaptionResultFieldMap">The table caption result field map.</param>
        /// <param name="attributes">The attributes.</param>
        /// <param name="color">The color.</param>
        /// <exception cref="Exception">StartDate is null</exception>
        public ResultRowCalendarItem(UPCRMResultRow row,
                                     UPCoreMappingResultContext resultContext,
                                     IIdentifier identifier,
                                     UPConfigTableCaption tableCaption, List <UPContainerFieldMetaInfo> tableCaptionResultFieldMap,
                                     UPConfigCatalogAttributes attributes, AureaColor color)
            : base(identifier)
        {
            this.ResultContext = resultContext;
            var    fieldMapping    = this.ResultContext.FieldControl.FunctionNames();
            var    dict            = this.ResultContext.FieldControl.FunctionNames(row);
            string startDateString = dict.ValueOrDefault("Date") as string;
            string startTimeString = dict.ValueOrDefault("Time") as string;
            string endDateString   = dict.ValueOrDefault("EndDate") as string;
            string endTimeString   = dict.ValueOrDefault("EndTime") as string;

            UPConfigFieldControlField personLabelControlField = fieldMapping.ValueOrDefault("PersonLabel");

            if (personLabelControlField != null)
            {
                this.PersonLabelField = UPMStringField.StringFieldWithIdentifierValue(
                    new FieldIdentifier(row.RootRecordIdentification, personLabelControlField.Field.FieldIdentification),
                    row.FormattedFieldValueAtIndex(personLabelControlField.TabIndependentFieldIndex, null, this.ResultContext.FieldControl));
            }

            UPConfigFieldControlField companyLabelControlField = fieldMapping.ValueOrDefault("CompanyLabel");

            if (companyLabelControlField != null)
            {
                this.CompanyLabelField = UPMStringField.StringFieldWithIdentifierValue(
                    new FieldIdentifier(row.RootRecordIdentification, companyLabelControlField.Field.FieldIdentification),
                    row.FormattedFieldValueAtIndex(companyLabelControlField.TabIndependentFieldIndex, null, this.ResultContext.FieldControl));
            }

            UPConfigFieldControlField field = fieldMapping.ValueOrDefault("Status");
            string status = dict.ValueOrDefault("Status") as string;

            if (field != null)
            {
                this.StatusLabelField = UPMStringField.StringFieldWithIdentifierValue(
                    new FieldIdentifier(row.RootRecordIdentification, field.Field.FieldIdentification),
                    field.Field.ValueForRawValueOptions(status, 0));
            }

            string repLabel = dict.ValueOrDefault("RepLabel") as string;

            if (string.IsNullOrEmpty(repLabel))
            {
                string repId = dict.ValueOrDefault("RepId") as string;
                if (!string.IsNullOrEmpty(repId))
                {
                    repLabel = UPCRMDataStore.DefaultStore.Reps.RepWithId(repId).RepName;
                }
            }

            this.RepLabelField = UPMStringField.StringFieldWithIdentifierValue(StringIdentifier.IdentifierWithStringId("rep"), repLabel);
            int iType = Convert.ToInt32(dict.ValueOrDefault("Type"));

            this.Type             = (UPCalendarItemType)iType;
            this.StartDate        = StringExtensions.DateFromStrings(startDateString, startTimeString);
            this.EndDate          = StringExtensions.DateFromStrings(endDateString, endTimeString);
            this.Identification   = identifier.IdentifierAsString;
            this.Color            = color;
            this.RowColor         = this.Color;
            this.CrmResultRow     = row;
            this.IPadCalendarItem = null;
            this.HasTime          = !string.IsNullOrEmpty(startTimeString);
            this.HasEndTime       = !string.IsNullOrEmpty(endTimeString);

            UPConfigCatalogValueAttributes temp = attributes?.ValuesByCode[iType];

            if (temp != null)
            {
                if (this.Color == null)
                {
                    string colorString = temp.ColorKey;
                    if (string.IsNullOrEmpty(colorString))
                    {
                        this.Color = AureaColor.ColorWithString(colorString);
                    }
                }

                this.ImageName = temp.ImageName;
            }

            if (tableCaption != null)
            {
                this.Subject = tableCaption.TableCaptionForResultRow(row, tableCaptionResultFieldMap);
            }
            else
            {
                this.Subject = dict.ValueOrDefault("Subject") as string;
            }

            if (this.StartDate == DateTime.MinValue)
            {
                throw new Exception("StartDate is null");
            }

            if (this.EndDate == DateTime.MinValue)
            {
                this.EndDate = this.StartDate;
            }

            if (this.Type < UPCalendarItemType.Color0 || this.Type >= UPCalendarItemType.ColorCount)
            {
                this.Type = UPCalendarItemType.Color0;
            }

            //this.AllDay = this.DetermineIsAllDay();
        }
        /// <summary>
        /// Creates the edit field.
        /// </summary>
        /// <returns>
        /// The <see cref="UPMEditField"/>.
        /// </returns>
        public override UPMEditField CreateEditField()
        {
            var field = new UPMCatalogEditField(this.FieldIdentifier, this.MultiSelect);

            if (this.MultiSelect)
            {
                field.MultiSelectMaxCount = this.ChildFields.Count + 1;
            }

            var possibleValues   = this.Catalog?.TextValuesForFieldValues(true);
            var explicitKeyOrder = this.Catalog != null &&
                                   ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("FixedCatalog.SortByCode")
                                       ? this.Catalog.ExplicitKeyOrderByCodeEmptyValueIncludeHidden(false, false)
                                       : this.Catalog?.ExplicitKeyOrderEmptyValueIncludeHidden(false, false);

            var attributes =
                ConfigurationUnitStore.DefaultStore.CatalogAttributesForInfoAreaIdFieldId(
                    this.FieldConfig.InfoAreaId,
                    this.FieldConfig.FieldId);
            var valueForCode0 = possibleValues.ValueOrDefault("0");

            if (string.IsNullOrEmpty(valueForCode0))
            {
                field.NullValueKey = "0";
            }
            else
            {
                field.NullValueText = valueForCode0;
            }

            foreach (var p in possibleValues ?? new Dictionary <string, string>())
            {
                var possibleValue = new UPMCatalogPossibleValue
                {
                    Key             = p.Key,
                    TitleLabelField = new UPMStringField(StringIdentifier.IdentifierWithStringId("x"))
                    {
                        StringValue = p.Value
                    }
                };

                if (!this.MultiSelect || !p.Key.Equals(field.NullValueKey))
                {
                    field.AddPossibleValue(possibleValue);
                }
            }

            var allKeys = field.AllKeysFromPossibleValues;

            foreach (var theObject in allKeys)
            {
                var temp = attributes?.ValuesByCode?.ValueOrDefault(JObjectExtensions.ToInt(theObject));
                if (temp == null)
                {
                    continue;
                }

                var possibleValue = field.PossibleValueForKey(theObject);
                var colorString   = temp.ColorKey;
                if (!string.IsNullOrEmpty(colorString))
                {
                    var color = AureaColor.ColorWithString(colorString);
                    possibleValue.IndicatorColor = color;
                }

                possibleValue.ImageString = temp.ImageName;
            }

            this.ApplyAttributesOnEditFieldConfig(field, this.FieldConfig);
            if (explicitKeyOrder != null)
            {
                field.ExplicitKeyOrder = explicitKeyOrder;
            }

            return(field);
        }