示例#1
0
        private void FillTimesVariantWithoutType(UPCRMResultRow resultRow, string timeType, string prefix)
        {
            var            valuesWithFunctions = resultRow.ValuesWithFunctions();
            UPMContactTime contactTime;
            string         from          = $"{prefix}FROM";
            string         to            = $"{prefix}TO";
            string         afternoonFrom = $"{prefix}AFTERNOONFROM";
            string         afternoonTo   = $"{prefix}AFTERNOONTO";
            int            weekDay       = ((string)valuesWithFunctions.ValueOrDefault("DAYOFWEEK")).ToInt();

            if (weekDay < 7)
            {
                weekDay++;
            }
            else
            {
                weekDay = 1;
            }

            if (valuesWithFunctions.ValueOrDefault(from) != null && valuesWithFunctions.ValueOrDefault(to) != null)
            {
                contactTime = CreateContactTime((string)valuesWithFunctions.ValueOrDefault(from), (string)valuesWithFunctions.ValueOrDefault(to), weekDay, timeType);
                this.contactTimesGroup.AddChild(contactTime);
            }

            if (valuesWithFunctions.ValueOrDefault(afternoonFrom) != null && valuesWithFunctions.ValueOrDefault(afternoonTo) != null)
            {
                contactTime = CreateContactTime((string)valuesWithFunctions.ValueOrDefault(afternoonFrom), (string)valuesWithFunctions.ValueOrDefault(afternoonTo), weekDay, timeType);
                this.contactTimesGroup.AddChild(contactTime);
            }
        }
        private void ApplyQuotaResult(UPCRMResult result)
        {
            int count = result.RowCount;

            this.quotaDictionary = new Dictionary <string, UPSEQuota>();
            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                Dictionary <string, object> dict = row.ValuesWithFunctions();
                string itemNumber = dict.ValueOrDefault(this.ItemNumberFunctionName) as string;
                if (string.IsNullOrEmpty(itemNumber))
                {
                    continue;
                }

                UPSEQuota quota = this.quotaDictionary.ValueOrDefault(itemNumber);
                if (quota == null)
                {
                    quota = new UPSEQuota(itemNumber, this);
                    this.quotaDictionary.SetObjectForKey(quota, itemNumber);
                }

                quota.ApplyRecordIdentificationValues(row.RootRecordIdentification, dict);
            }

            this.Finished();
        }
示例#3
0
        private void SurveyAnswersLoaded(UPCRMResult result)
        {
            int count = result.RowCount;

            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                Dictionary <string, object> valuesWithFunction = row.ValuesWithFunctions();
                string questionKey = valuesWithFunction.ValueOrDefault(Constants.QuestionnaireQuestionNumber) as string;
                UPQuestionnaireQuestion question = this.Questionnaire?.QuestionForId(questionKey);
                if (question == null)
                {
                    continue;
                }

                UPSurveyAnswer answer = null;
                if (question.Multiple)
                {
                    answer = this.surveyAnswers.ValueOrDefault(questionKey);
                }

                if (answer == null)
                {
                    answer = new UPSurveyAnswer(row.RootRecordIdentification, valuesWithFunction, question, this);
                    this.surveyAnswers[questionKey] = answer;
                }
                else
                {
                    answer.AddAnswer(valuesWithFunction, row.RootRecordIdentification);
                }
            }

            this.crmQuery = null;
            this.LoadFinished();
        }
示例#4
0
        private UPMContactTimesGroup FillGroupVariantWithType(UPCRMResult result)
        {
            this.contactTimesGroup = this.EmptyGroup();
            var functionNames = this.fieldControl.FunctionNames();

            for (int row = 0; row < result.RowCount; row++)
            {
                UPCRMResultRow resultRow           = result.ResultRowAtIndex(row) as UPCRMResultRow;
                var            valuesWithFunctions = resultRow.ValuesWithFunctions();
                this.FillTimesVariantWithType(resultRow, valuesWithFunctions.ValueOrDefault("TYPE") as string);
            }

            return(this.contactTimesGroup);
        }
示例#5
0
        private void SourceCopyFieldGroupLoaded(UPCRMResultRow resultRow)
        {
            this.Parameters = resultRow.ValuesWithFunctions();
            UPQuestionnaireManager questionnaireManager = null; //ServerSession.CurrentSession.QuestionnaireManager;

            if (this.QuestionnaireLinkName == "RecordLink")
            {
                string questionnaireRecordIdentification = resultRow.RecordIdentificationForLinkInfoAreaIdLinkId(questionnaireManager.QuestionnaireList.InfoAreaId, -1);
                if (questionnaireRecordIdentification.Length == 0 && this.questionnairelinkFieldMetaInfo != null)
                {
                    string questionnaireRecordId = resultRow.RawValueAtIndex(this.questionnairelinkFieldMetaInfo.PositionInResult);
                    if (!string.IsNullOrEmpty(questionnaireRecordId))
                    {
                        questionnaireRecordIdentification = StringExtensions.InfoAreaIdRecordId(questionnaireManager.QuestionnaireList.InfoAreaId, questionnaireRecordId);
                    }
                }

                if (!string.IsNullOrEmpty(questionnaireRecordIdentification))
                {
                    this.Questionnaire = questionnaireManager.LoadQuestionaire(questionnaireRecordIdentification, this);
                }
                else
                {
                    this.TheDelegate.SurveyDidFailWithError(this, new Exception("cannot load questionnaire, recordIdentification empty"));
                    return;
                }
            }
            else
            {
                int catalogCode = Convert.ToInt32(this.Parameters.ValueOrDefault(this.QuestionnaireLinkName));
                if (catalogCode > 0)
                {
                    this.Questionnaire = questionnaireManager.LoadQuestionaire(catalogCode, this);
                }
                else
                {
                    this.TheDelegate.SurveyDidFailWithError(this, new Exception("cannot load questionnaire with code, catalogCode empty"));
                    return;
                }
            }

            if (this.Questionnaire != null)
            {
                this.QuestionnaireLoaded();
            }
        }
        private void QuestionnaireFromResult(UPCRMResult result)
        {
            if (result.RowCount == 0)
            {
                this.SignalError(new Exception("questionnaire not found"));
                return;
            }

            UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(0);

            this.RecordIdentification = row.RootRecordIdentification;
            this.DataDictionary       = row.ValuesWithFunctions();
            this.Label = this.DataDictionary.ValueOrDefault(Constants.QuestionnaireLabel) as string;

            int catCode = 0;

            int.TryParse(this.DataDictionary.ValueOrDefault(Constants.QuestionnaireQuestionnaireID) as string, out catCode);
            this.CatalogCode = catCode;

            if (string.IsNullOrEmpty(this.Label) && this.CatalogCode > 0)
            {
                UPConfigFieldControlField field = this.Manager.QuestionnaireList.FieldWithFunction(Constants.QuestionnaireQuestionnaireID);
                if (field != null)
                {
                    this.Label = field.Field.ValueForRawValueOptions(this.DataDictionary[Constants.QuestionnaireQuestionnaireID] as string, 0);
                }
            }

            this.currentQuery = new UPContainerMetaInfo(this.Manager.QuestionSearchAndList, this.filterParameters);
            this.currentQuery.SetLinkRecordIdentification(this.RecordIdentification);
            this.loadStep = 1;
            if (this.requestOption == UPRequestOption.BestAvailable || this.requestOption == UPRequestOption.FastestAvailable)
            {
                this.requestOption = row.IsServerResponse ? UPRequestOption.Online : UPRequestOption.Offline;
            }

            this.currentQuery.Find(this.requestOption, this);
        }
        private void ApplyArticleConfigurationResult(UPCRMResult result)
        {
            int count = result.RowCount;

            this.articleConfigurationDictionary = new Dictionary <string, UPSEArticleQuotaConfiguration>();
            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(i);
                Dictionary <string, object> dict = row.ValuesWithFunctions();
                string itemNumber = dict.ValueOrDefault(this.ItemNumberFunctionName) as string;
                if (string.IsNullOrEmpty(itemNumber))
                {
                    continue;
                }

                if (!this.articleConfigurationDictionary.ContainsKey(itemNumber))
                {
                    UPSEArticleQuotaConfiguration articleConfiguration = new UPSEArticleQuotaConfiguration(itemNumber, dict, row.RootRecordIdentification);
                    this.articleConfigurationDictionary[itemNumber] = articleConfiguration;
                }
            }

            this.LoadQuota();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSEPricingBulkVolume"/> class.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <param name="bulkVolumes">The bulk volumes.</param>
        public UPSEPricingBulkVolume(UPCRMResultRow resultRow, UPSEPricingBulkVolumes bulkVolumes)
        {
            this.BulkVolumes    = bulkVolumes;
            this.MaxVolumeIndex = 0;
            List <double> quantityScale = new List <double>(10);

            this.Data       = resultRow.ValuesWithFunctions();
            this.ItemNumber = this.Data.ValueOrDefault(this.BulkVolumes.ItemNumberFunctionName) as string;
            double lastNumber = 0;

            for (int i = 0; i < 10; i++)
            {
                string valueForKey = this.Data.ValueOrDefault($"Quantity{i}") as string;
                if (!string.IsNullOrEmpty(valueForKey) && valueForKey != "0")
                {
                    this.MaxVolumeIndex = i;
                    lastNumber          = Convert.ToDouble(valueForKey, System.Globalization.CultureInfo.InvariantCulture);
                }

                quantityScale.Add(lastNumber);
            }

            this.QuantityScale = quantityScale;
        }
示例#9
0
        private void FillTimesVariantWithType(UPCRMResultRow resultRow, string timeType)
        {
            if (this.contactTimesGroup.TimeTypeTitleForTimeType(timeType)?.Length == 0)
            {
                return;
            }

            var            valuesWithFunctions = resultRow.ValuesWithFunctions();
            UPMContactTime contactTime;
            string         from          = "FROM";
            string         to            = "TO";
            string         afternoonFrom = "AFTERNOONFROM";
            string         afternoonTo   = "AFTERNOONTO";
            int            weekDay       = ((string)valuesWithFunctions.ValueOrDefault("DAYOFWEEK")).ToInt();

            if (weekDay < 7)
            {
                weekDay++;
            }
            else
            {
                weekDay = 1;
            }

            if (valuesWithFunctions.ValueOrDefault(from) != null && valuesWithFunctions.ValueOrDefault(to) != null)
            {
                contactTime = CreateContactTime((string)valuesWithFunctions.ValueOrDefault(from), (string)valuesWithFunctions.ValueOrDefault(to), weekDay, timeType);
                this.contactTimesGroup.AddChild(contactTime);
            }

            if (valuesWithFunctions.ValueOrDefault(afternoonFrom) != null && valuesWithFunctions.ValueOrDefault(afternoonTo) != null)
            {
                contactTime = CreateContactTime((string)valuesWithFunctions.ValueOrDefault(afternoonFrom), (string)valuesWithFunctions.ValueOrDefault(afternoonTo), weekDay, timeType);
                this.contactTimesGroup.AddChild(contactTime);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSEPrice"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="recordId">The record identifier.</param>
 /// <param name="pricing">The pricing.</param>
 public UPSEPrice(UPCRMResultRow row, string recordId, UPSEPricing pricing)
     : this(row?.RootRecordIdentification, row?.ValuesWithFunctions(), pricing)
 {
     this.ArticleRecordId = recordId;
 }
示例#11
0
 /// <summary>
 /// Applies the result row.
 /// </summary>
 /// <param name="resultRow">The result row.</param>
 public void ApplyResultRow(UPCRMResultRow resultRow)
 {
     this.ApplyRecordIdentificationValues(resultRow.RootRecordIdentification, resultRow.ValuesWithFunctions());
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPQuestionnaireAnswer"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 public UPQuestionnaireAnswer(UPCRMResultRow row)
     : this(row.RootRecordIdentification, row.ValuesWithFunctions())
 {
 }
示例#13
0
        private void FillTimesVrianteWithoutTypeFromResultRowTimeTypePrefix(UPCRMResultRow resultRow, string timeType, string prefix)
        {
            var                  valuesWithFunctions = resultRow.ValuesWithFunctions();
            DateTime             fromDate;
            DateTime             toDate;
            UPMDateTimeEditField fromTime;
            UPMDateTimeEditField toTime;
            UPMContactTime       contactTime;
            var                  from          = $"{prefix}FROM";
            var                  to            = $"{prefix}TO";
            var                  afternoonFrom = $"{prefix}AFTERNOONFROM";
            var                  afternoonTo   = $"{prefix}AFTERNOONTO";
            int                  weekDay       = ((string)valuesWithFunctions.ValueOrDefault("DAYOFWEEK")).ToInt();

            if (weekDay < 7)
            {
                weekDay++;
            }
            else
            {
                weekDay = 1;
            }

            if (valuesWithFunctions.ValueOrDefault(to) != null && ((string)valuesWithFunctions.ValueOrDefault(to)).ToInt() > 0)
            {
                fromDate = (valuesWithFunctions.ValueOrDefault(from) as string).TimeFromCrmValue();
                toDate   = (valuesWithFunctions.ValueOrDefault(to) as string).TimeFromCrmValue();
                fromTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("fromTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = fromDate
                };

                toTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("toTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = toDate
                };

                contactTime = new UPMContactTime(weekDay, timeType, fromTime, toTime)
                {
                    RecordIdentification = resultRow.RecordIdentificationAtFieldIndex(0)
                };
                this.contactTimesGroup.AddChild(contactTime);
            }
            else
            {
                contactTime = new UPMContactTime(weekDay, timeType, null, null);
                this.contactTimesGroup.AddChild(contactTime);
            }

            if (valuesWithFunctions.ValueOrDefault(afternoonTo) != null && ((string)valuesWithFunctions.ValueOrDefault(afternoonTo)).ToInt() > 0)
            {
                fromDate = (valuesWithFunctions.ValueOrDefault(afternoonFrom) as string).TimeFromCrmValue();
                toDate   = (valuesWithFunctions.ValueOrDefault(afternoonTo) as string).TimeFromCrmValue();
                fromTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("fromTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = fromDate
                };
                toTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("toTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = toDate
                };
                contactTime = new UPMContactTime(weekDay, timeType, fromTime, toTime)
                {
                    RecordIdentification = resultRow.RecordIdentificationAtFieldIndex(0)
                };
                this.contactTimesGroup.AddChild(contactTime);
            }
            else
            {
                contactTime = new UPMContactTime(weekDay, timeType, null, null)
                {
                    RecordIdentification = resultRow.RecordIdentificationAtFieldIndex(0)
                };
                this.contactTimesGroup.AddChild(contactTime);
            }
        }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPQuestionnaireQuestion"/> class.
 /// </summary>
 /// <param name="row">The row.</param>
 /// <param name="questionnaire">The questionnaire.</param>
 public UPQuestionnaireQuestion(UPCRMResultRow row, UPQuestionnaire questionnaire)
     : this(row.RootRecordIdentification, row.ValuesWithFunctions(), questionnaire)
 {
 }
        private void ProcessResult(UPCRMResult result)
        {
            UPRecordCopyStep currentStep = this.stepQueue[0];

            this.stepQueue.RemoveAt(0);
            UPConfigQueryTable queryTable = currentStep.QueryTable;
            int count            = result.RowCount;
            int resultTableCount = result.NumberOfResultTables;
            UPContainerInfoAreaMetaInfo copyResultInfoArea = null;

            if (queryTable.InfoAreaId == currentStep.FieldControl.InfoAreaId)
            {
                copyResultInfoArea = result.MetaInfo.ResultInfoAreaMetaInfoAtIndex(0);
            }

            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row    = (UPCRMResultRow)result.ResultRowAtIndex(i);
                UPCRMRecord    record = new UPCRMRecord(queryTable.InfoAreaId);
                if (currentStep.DestinationRecord != null)
                {
                    record.AddLink(new UPCRMLink(currentStep.DestinationRecord, queryTable.LinkId));
                }

                for (int j = 1; j < resultTableCount; j++)
                {
                    string linkRecordIdentification = row.RecordIdentificationAtIndex(j);
                    if (string.IsNullOrEmpty(linkRecordIdentification) && !result.IsServerResult)
                    {
                        UPContainerInfoAreaMetaInfo resultInfoArea = result.MetaInfo.ResultInfoAreaMetaInfoAtIndex(j);
                        UPCRMLinkReader             linkReader     = new UPCRMLinkReader(StringExtensions.InfoAreaIdRecordId(currentStep.FieldControl.InfoAreaId, row.RootRecordId),
                                                                                         $"{resultInfoArea.InfoAreaId}:{resultInfoArea.LinkId}", null);
                        linkRecordIdentification = linkReader.RequestLinkRecordOffline();
                    }

                    int linkId = -1;
                    if (linkRecordIdentification?.Length > 8)
                    {
                        if (currentStep.DestinationRecord == null || queryTable.LinkId != linkId ||
                            linkRecordIdentification.InfoAreaId() != currentStep.DestinationRecord.InfoAreaId)
                        {
                            record.AddLink(new UPCRMLink(linkRecordIdentification, linkId));
                        }
                    }
                }

                Dictionary <string, object> fieldsWithFunctions = row.ValuesWithFunctions();
                UPConfigQueryTable          replacedTable       = queryTable.QueryTableByApplyingValueDictionary(fieldsWithFunctions);
                if (copyResultInfoArea != null)
                {
                    foreach (UPContainerFieldMetaInfo field in copyResultInfoArea.Fields)
                    {
                        string val = row.RawValueAtIndex(field.PositionInResult);
                        if (!string.IsNullOrEmpty(val))
                        {
                            record.AddValue(new UPCRMFieldValue(val, field.InfoAreaId, field.FieldId));
                        }
                    }
                }

                if (replacedTable != null)
                {
                    record.ApplyValuesFromTemplateFilter(replacedTable, true);
                }

                int numberOfSubTables = queryTable.NumberOfSubTables;
                if (numberOfSubTables > 0)
                {
                    for (int k = 0; k < numberOfSubTables; k++)
                    {
                        UPRecordCopyStep subStep = new UPRecordCopyStep();
                        subStep.QueryTable = queryTable.SubTableAtIndex(k);
                        subStep.SourceRecordIdentification = row.RootRecordIdentification;
                        subStep.DestinationRecord          = record;
                        this.ConfigForStepFromQueryTable(subStep, subStep.QueryTable);
                        this.stepQueue.Add(subStep);
                    }
                }

                this.recordArray.Add(record);
            }

            this.ExecuteNextStep();
        }
        /// <summary>
        /// Valueses from result row.
        /// </summary>
        /// <param name="resultRow">
        /// The result row.
        /// </param>
        /// <returns>
        /// The <see cref="Dictionary"/>.
        /// </returns>
        public Dictionary <string, object> ValuesFromResultRow(UPCRMResultRow resultRow)
        {
            Dictionary <string, object> dict = null;

            if (resultRow == null)
            {
                dict = new Dictionary <string, object>();
                var configStore     = ConfigurationUnitStore.DefaultStore;
                var contextMenuName = this.Definition.ValueOrDefault("value") as string;
                if (string.IsNullOrEmpty(contextMenuName))
                {
                    contextMenuName = this.Definition.ValueOrDefault("ContextMenu") as string;
                }

                var menu          = configStore.MenuByName(contextMenuName);
                var viewReference = menu?.ViewReference;
                var configExpand  = configStore.ExpandByName(viewReference?.ContextValueForKey("ConfigName"));
                var fieldControl  = configStore.FieldControlByNameFromGroup(
                    "List",
                    configExpand != null ? configExpand.FieldGroupName : viewReference?.ContextValueForKey("ConfigName"));

                var functionNameFieldMapping = fieldControl?.FunctionNames();
                if (functionNameFieldMapping != null)
                {
                    foreach (var key in functionNameFieldMapping.Keys)
                    {
                        if (!string.IsNullOrEmpty(this.TargetPrefix))
                        {
                            dict[$"{this.TargetPrefix}{key}"] = string.Empty;
                        }
                        else
                        {
                            dict[$"{key}"] = string.Empty;
                        }
                    }
                }

                if (this.FormattedParameters != null)
                {
                    foreach (var parameterName in this.FormattedParameters.Keys)
                    {
                        if (!string.IsNullOrEmpty(this.TargetPrefix))
                        {
                            dict[$"{this.TargetPrefix}{parameterName}"] = string.Empty;
                        }
                        else
                        {
                            dict[$"{parameterName}"] = string.Empty;
                        }
                    }
                }

                return(dict);
            }

            var rowValues = resultRow.ValuesWithFunctions(true);

            if (this.FormattedParameters != null)
            {
                dict = new Dictionary <string, object>(rowValues);
                if (rowValues.Count > 0)
                {
                    foreach (var parameterName in this.FormattedParameters.Keys)
                    {
                        var patternString = this.FormattedParameters.ValueOrDefault(parameterName) as string;
                        var str           = patternString.ReferencedStringWithDefault(patternString);
                        str = this.StringByApplyingValuesToString(rowValues, str);
                        if (!string.IsNullOrEmpty(str))
                        {
                            dict[parameterName] = str;
                        }
                    }
                }

                rowValues = dict;
            }

            // Dictionary<string, string> dict = null;
            if (!string.IsNullOrEmpty(this.TargetPrefix))
            {
                dict = new Dictionary <string, object>(rowValues.Count);
                foreach (var name in rowValues.Keys)
                {
                    dict[$"{this.TargetPrefix}{name}"] = rowValues.ValueOrDefault(name);
                }
            }
            else
            {
                dict = new Dictionary <string, object>(rowValues);
            }

            foreach (var clearValue in this.ClearValues ?? new List <string>())
            {
                if (dict.ValueOrDefault(clearValue) == null)
                {
                    dict[clearValue] = string.Empty;
                }
            }

            foreach (var fixedValue in (this.FixedValues ?? new Dictionary <string, object>()).Keys)
            {
                if (dict.ValueOrDefault(fixedValue) == null)
                {
                    dict[fixedValue] = this.FixedValues.ValueOrDefault(fixedValue) as string;
                }
            }

            return(dict);
        }
示例#17
0
        private void FillTimesVrianteWithTypeFromResultRowTimeType(UPCRMResultRow resultRow, string timeType)
        {
            if (string.IsNullOrEmpty(this.contactTimesGroup.TimeTypeTitleForTimeType(timeType)))
            {
                return;
            }

            var                  valuesWithFunctions = resultRow.ValuesWithFunctions();
            DateTime             fromDate;
            DateTime             toDate;
            UPMDateTimeEditField fromTime;
            UPMDateTimeEditField toTime;
            UPMContactTime       contactTime;
            string               from          = "FROM";
            string               to            = "TO";
            string               afternoonFrom = "AFTERNOONFROM";
            string               afternoonTo   = "AFTERNOONTO";
            int                  weekDay       = ((string)valuesWithFunctions.ValueOrDefault("DAYOFWEEK")).ToInt();

            if (weekDay < 7)
            {
                weekDay++;
            }
            else
            {
                weekDay = 1;
            }

            if ((valuesWithFunctions.ValueOrDefault(from) != null && ((string)valuesWithFunctions.ValueOrDefault(from)).ToInt() > 0) ||
                (valuesWithFunctions.ValueOrDefault(to) != null && ((string)valuesWithFunctions.ValueOrDefault(to)).ToInt() > 0))
            {
                fromDate = ((string)valuesWithFunctions.ValueOrDefault(from)).TimeFromCrmValue();
                toDate   = ((string)valuesWithFunctions.ValueOrDefault(to)).TimeFromCrmValue();
                fromTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("fromTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = fromDate
                };
                toTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("toTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = toDate
                };
                contactTime = new UPMContactTime(weekDay, timeType, fromTime, toTime)
                {
                    RecordIdentification = resultRow.RecordIdentificationAtFieldIndex(0)
                };
                this.contactTimesGroup.AddChild(contactTime);
            }

            if ((valuesWithFunctions.ValueOrDefault(afternoonFrom) != null && ((string)valuesWithFunctions.ValueOrDefault(afternoonFrom)).ToInt() > 0) ||
                (valuesWithFunctions.ValueOrDefault(afternoonTo) != null && ((string)valuesWithFunctions.ValueOrDefault(afternoonTo)).ToInt() > 0))
            {
                fromDate = ((string)valuesWithFunctions.ValueOrDefault(afternoonFrom)).TimeFromCrmValue();
                toDate   = ((string)valuesWithFunctions.ValueOrDefault(afternoonTo)).TimeFromCrmValue();
                fromTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("fromTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = fromDate
                };
                toTime = new UPMDateTimeEditField(StringIdentifier.IdentifierWithStringId("toTime"))
                {
                    Type      = DateTimeType.Time,
                    DateValue = toDate
                };
                contactTime = new UPMContactTime(weekDay, timeType, fromTime, toTime)
                {
                    RecordIdentification = resultRow.RecordIdentificationAtFieldIndex(0)
                };
                this.contactTimesGroup.AddChild(contactTime);
            }
        }