/// <summary>
        /// Builds the page.
        /// </summary>
        protected override void BuildPage()
        {
            ViewReference documentUploadViewReference = this.DetermineDocumentUploadViewReference();

            if (documentUploadViewReference != null)
            {
                int fieldId = -1;
                fieldId = this.DetermineFieldIdDocumentUploadViewReference(fieldId, documentUploadViewReference);
                if (fieldId >= 0)
                {
                    string     infoAreaIdForQuery = this.ViewReference.ContextValueForKey("RecordId").InfoAreaId();
                    UPCRMField field = new UPCRMField(fieldId, infoAreaIdForQuery);
                    this.documentQuery = new UPContainerMetaInfo(new List <UPCRMField> {
                        field
                    }, infoAreaIdForQuery);
                    this.documentQuery.SetLinkRecordIdentification(this.RecordIdentification);
                    string filterName = documentUploadViewReference.ContextValueForKey("FilterName");
                    if (!string.IsNullOrEmpty(filterName))
                    {
                        UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(filterName);
                        if (filter != null)
                        {
                            this.documentQuery.ApplyFilter(filter);
                        }
                    }

                    if (this.documentQuery.Find(UPRequestOption.FastestAvailable, this) != null)
                    {
                        return;
                    }
                }
            }

            base.BuildPage();
        }
        /// <summary>
        /// Loads the specified the delegate.
        /// </summary>
        /// <param name="theDelegate">The delegate.</param>
        /// <returns></returns>
        public bool Load(IQuestionnaireDelegate theDelegate)
        {
            if (this.LoadDelegate != null)
            {
                return(false);
            }

            this.LoadDelegate = theDelegate;
            this.currentQuery = new UPContainerMetaInfo(this.Manager.QuestionnaireList);
            if (!string.IsNullOrEmpty(this.RecordIdentification))
            {
                this.currentQuery.SetLinkRecordIdentification(this.RecordIdentification);
            }
            else
            {
                UPConfigFilter filter = ConfigurationUnitStore.DefaultStore.FilterByName(this.Manager.QuestionnaireSearchAndList.FilterName);
                filter = filter.FilterByApplyingValueDictionary(
                    new Dictionary <string, object> {
                    { Constants.QuestionnaireQuestionnaireID, this.CatalogCode.ToString() }
                });

                if (filter != null)
                {
                    this.currentQuery.ApplyFilter(filter);
                }
            }

            this.requestOption = this.Manager.QuestionnaireRequestOption;
            this.loadStep      = 0;
            this.currentQuery.Find(this.requestOption, this);
            return(true);
        }
Exemple #3
0
        /// <summary>
        /// Searches the operation did finish with result.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="result">The result.</param>
        public virtual void SearchOperationDidFinishWithResult(Operation operation, UPCRMResult result)
        {
            int count = result.RowCount;

            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow resultRow = (UPCRMResultRow)result.ResultRowAtIndex(i);
                var            rowValues = resultRow.ValuesWithFunctions();

                string rep   = (string)rowValues.ValueOrDefault(Constants.UPRepAcceptanceFunctionName_RepId);
                int    repId = rep.ToInt();

                if (repId > 0)
                {
                    rep = StringExtensions.NineDigitStringFromRep(Convert.ToInt32(rep));

                    var repParticipant = this.ParticipantWithKey(rep);

                    if (repParticipant is UPCRMRepParticipant)
                    {
                        string acceptance = (string)rowValues[Constants.UPRepAcceptanceFunctionName_Acceptance];
                        ((UPCRMRepParticipant)repParticipant).AcceptanceFromRecordIdentification(acceptance, resultRow.RootRecordIdentification);
                    }
                }
            }

            this.repAcceptanceCrmQuery = null;
            this.Loaded();
        }
 /// <summary>
 /// Check if favorite.
 /// </summary>
 /// <param name="recordIdentification">The record identification.</param>
 /// <returns>True if favorite</returns>
 public bool RequestIsFavorite(string recordIdentification)
 {
     this.currentQuery = new UPContainerMetaInfo(new List <UPCRMField>(), Constants.FAVORITES_INFOAREAID);
     this.currentQuery.ApplyFilter(this.RepFilter);
     this.currentQuery.SetLinkRecordIdentification(recordIdentification, Constants.FAVORITES_LINKID);
     return(this.currentQuery.Find(UPRequestOption.BestAvailable, this) != null);
 }
        private void UpdatePage(UPContainerMetaInfo containerMetaInfo)
        {
            if (this.RequestOption != UPRequestOption.Offline)
            {
                // read record asynchronously online
                Operation operation;
                if (string.IsNullOrWhiteSpace(this.LinkRecordIdentification))
                {
                    operation = containerMetaInfo.ReadRecord(this.recordId, UPRequestOption.Online, this);
                }
                else
                {
                    containerMetaInfo.DisableVirtualLinks = true;
                    containerMetaInfo.SetLinkRecordIdentification(this.LinkRecordIdentification, this.LinkId);
                    operation = containerMetaInfo.Find(UPRequestOption.Online, this);
                }

                if (operation == null)
                {
                    this.UpdatePageWithResult(null);
                }
            }
            else
            {
                this.UpdatePageWithResult(null);
            }
        }
Exemple #6
0
        private void TrySourceCopyFieldGroupOfflineWithRecordLink()
        {
            if (!UPCRMDataStore.DefaultStore.RecordExistsOffline(this.RecordIdentification))
            {
                this.TheDelegate.SurveyDidFailWithError(this, new Exception("SourceCopyFields could not be loaded"));
                return;
            }

            this.crmQuery = this.SourceCopyFieldGroup != null
                ? new UPContainerMetaInfo(this.SourceCopyFieldGroup)
                : new UPContainerMetaInfo(new List <UPCRMField>(), this.RecordIdentification.InfoAreaId());

            UPQuestionnaireManager          questionnaireManager   = ServerSession.CurrentSession.QuestionnaireManager;
            UPCRMLinkField                  questionnairelinkField = new UPCRMLinkField(questionnaireManager.QuestionnaireList.InfoAreaId, -1, this.RecordIdentification.InfoAreaId());
            List <UPContainerFieldMetaInfo> fieldMetaInfos         = this.crmQuery.AddCrmFields(new List <UPCRMField> {
                questionnairelinkField
            });

            if (fieldMetaInfos.Count > 0)
            {
                this.questionnairelinkFieldMetaInfo = fieldMetaInfos[0];
            }

            this.crmQuery.SetLinkRecordIdentification(this.RecordIdentification);
            this.loadStep = 1;
            this.crmQuery.Find(UPRequestOption.Offline, this);
        }
Exemple #7
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();
        }
        protected override void InitializeWithDestinationResult(UPCRMResult result, UPContainerMetaInfo searchOperation)
        {
            foreach (UPSEColumn column in this.Columns)
            {
                var destColumn = column as UPSEDestinationColumn;
                if (destColumn != null)
                {
                    switch (column.Function)
                    {
                    case "UnitPrice":
                        this.RowUnitPriceColumn = destColumn;
                        break;

                    case "EndPrice":
                        this.RowEndPriceColumn = destColumn;
                        break;

                    case "Quantity":
                        this.RowQuantityColumn = destColumn;
                        break;

                    case "FreeGoods":
                        this.RowFreeGoodsColumn = destColumn;
                        break;

                    case "NetPrice":
                        this.RowNetPriceColumn = destColumn;
                        break;
                    }
                }
            }

            this.ComputePriceForQuantity1 = ConfigurationUnitStore.DefaultStore.ConfigValueIsSet("SerialEntry.UnitPriceCheckPriceScaleFor1");
            base.InitializeWithDestinationResult(result, searchOperation);
        }
        private UPContainerMetaInfo Query()
        {
            if (this.QueryConfiguration == null)
            {
                return(null);
            }

            UPContainerMetaInfo query = new UPContainerMetaInfo(this.QueryConfiguration, this.FilterParameters);

            if (query == null)
            {
                return(null);
            }

            query.DisableVirtualLinks = true;
            if (this.LinkRecordIdentification?.Length > 0)
            {
                query.SetLinkRecordIdentification(this.LinkRecordIdentification, this.LinkId);
            }

            if (this.AnalysisConditions?.Count > 0)
            {
                // currently not implemented (analysis conditions are not set, and so do not influence the query)
            }

            return(query);
        }
        /// <summary>
        /// Continues with query
        /// </summary>
        /// <param name="filterParameters">Filter parameters</param>
        public void ContinueWithQuery(Dictionary <string, object> filterParameters)
        {
            UPConfigQuery query = ConfigurationUnitStore.DefaultStore.QueryByName(this.QueryName);

            query = query.QueryByApplyingValueDictionaryDefaults(filterParameters, true);
            if (query == null)
            {
                string queryNotFound = $"query {this.QueryName} could not be found";
                this.ReportError(new Exception(queryNotFound), false);
                return;
            }

            this.crmQuery = new UPContainerMetaInfo(query);
            if (this.RecordIdentification?.Length > 0)
            {
                this.crmQuery.SetLinkRecordIdentification(this.RecordIdentification, this.LinkId);
            }

            var strOption = this.Options.ValueOrDefault("MaxResults") as string;

            if (strOption?.Length > 0)
            {
                this.MaxResults = strOption.ToInt();
                if (this.MaxResults > 0)
                {
                    this.crmQuery.MaxResults = this.MaxResults;
                }
            }
            else
            {
                this.MaxResults = 0;
            }

            this.crmQuery.Find(this.RequestOption, this);
        }
Exemple #11
0
        private void ContinueLoadRecordData()
        {
            this.crmQuery         = new UPContainerMetaInfo(this.DestinationFieldControl);
            this.currentQueryType = 2;
            if (!string.IsNullOrEmpty(this.DestinationFilterName))
            {
                UPConfigFilter destinationFilter = ConfigurationUnitStore.DefaultStore.FilterByName(this.DestinationFilterName);
                if (destinationFilter != null)
                {
                    this.crmQuery.ApplyFilter(destinationFilter);
                }
            }

            if (this.RecordIdentification.InfoAreaId() == "FI")
            {
                string         companyFilterName = $"{this.DestinationFieldControl.InfoAreaId}.CompanyRelated";
                UPConfigFilter companyFilter     = ConfigurationUnitStore.DefaultStore.FilterByName(companyFilterName);
                if (companyFilter != null)
                {
                    this.crmQuery.ApplyFilter(companyFilter);
                }
            }

            this.crmQuery.SetLinkRecordIdentification(this.RecordIdentification);
            this.crmQuery.Find(this.DestinationRequestOption, this);
        }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPRightsCheckerRequest"/> class.
 /// </summary>
 /// <param name="recordIdentification">The record identification.</param>
 /// <param name="crmQuery">The CRM query.</param>
 /// <param name="theDelegate">The delegate.</param>
 /// <param name="rightsChecker">The rights checker.</param>
 public UPRightsCheckerRequest(string recordIdentification, UPContainerMetaInfo crmQuery, UPRightsCheckerDelegate theDelegate, UPRightsChecker rightsChecker)
 {
     this.RecordIdentification = recordIdentification;
     this.Delegate             = theDelegate;
     this.RightsChecker        = rightsChecker;
     this.CrmQuery             = crmQuery;
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteSearchOperation"/> class.
 /// </summary>
 /// <param name="containerMetaInfo">
 /// The container meta information.
 /// </param>
 /// <param name="recordIdentification">
 /// The record identification.
 /// </param>
 /// <param name="handler">
 /// The handler.
 /// </param>
 public RemoteSearchOperation(
     UPContainerMetaInfo containerMetaInfo,
     string recordIdentification,
     ISearchOperationHandler handler)
     : this(containerMetaInfo, recordIdentification, null, -1, handler)
 {
 }
        /// <summary>
        /// Files the name for document.
        /// </summary>
        /// <param name="urlCache">
        /// The URL cache.
        /// </param>
        /// <returns>
        /// file name
        /// </returns>
        public string FileNameForDocument(UPSyncDocumentDownloadUrlCache urlCache)
        {
            UPCRMResultRow row;

            if (urlCache != null)
            {
                var fieldGroupCache = urlCache.FieldGroupUrlCacheForFieldGroup(this.FieldGroupName);
                row = fieldGroupCache.RowForRecordIdentification(this.RecordIdentification);
            }
            else
            {
                FieldControl fieldControl = ConfigurationUnitStore.DefaultStore.FieldControlByNameFromGroup("List", this.FieldGroupName);
                if (fieldControl == null)
                {
                    return(null);
                }

                var crmQuery = new UPContainerMetaInfo(fieldControl);
                var result   = crmQuery.ReadRecord(this.RecordIdentification);
                if (result.RowCount == 0)
                {
                    return(null);
                }

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

            // FUNCTION NAME "Title"
            return(row.ValueAtIndex(1));
        }
Exemple #15
0
        private string LoadRootRecordIdentification()
        {
            string rootIdentification;

            // load objectives linked to a call
            if (!string.IsNullOrEmpty(this.ParentLink))
            {
                UPContainerMetaInfo personLoadContainer = new UPContainerMetaInfo(Constants.PersonInfoArea);
                personLoadContainer.SetLinkRecordIdentification(this.RecordIdentification);
                UPCRMResult personResult = personLoadContainer.Find();

                // person related record...load objectives for person
                if (personResult.RowCount == 1)
                {
                    rootIdentification = personResult.ResultRowAtIndex(0).RootRecordIdentification;
                }
                else
                {
                    // company related record..load objectives for company
                    UPContainerMetaInfo companyLoadContainer = new UPContainerMetaInfo(Constants.AccountInfoArea);
                    companyLoadContainer.SetLinkRecordIdentification(this.RecordIdentification);
                    UPCRMResult companyResult = companyLoadContainer.Find();
                    rootIdentification = companyResult.RowCount == 1
                        ? companyResult.ResultRowAtIndex(0).RootRecordIdentification
                        : this.RecordIdentification;
                }
            }
            else
            {
                rootIdentification = this.RecordIdentification;
            }

            return(rootIdentification);
        }
        /// <summary>
        /// Loads this instance.
        /// </summary>
        /// <returns></returns>
        public bool Load()
        {
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(this.SearchAndListConfigName);
            UPConfigFilter          filter        = null;

            if (searchAndList != null)
            {
                filter = configStore.FilterByName(searchAndList.FilterName);
            }

            if (searchAndList == null)
            {
                return(false);
            }

            this.fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName);
            if (this.fieldControl != null)
            {
                this.crmQuery = new UPContainerMetaInfo(this.fieldControl, filter, null);
            }

            if (this.crmQuery == null)
            {
                return(false);
            }

            var result = this.crmQuery.Find();

            this.HandleResult(result);
            return(true);
        }
 /// <summary>
 /// Searches the operation did fail with error.
 /// </summary>
 /// <param name="operation">The operation.</param>
 /// <param name="error">The error.</param>
 public void SearchOperationDidFailWithError(Operation operation, Exception error)
 {
     this.crmQuery = null;
     this.resultsForClientReports = null;
     this.TheDelegate.WebContentMetaDataFailedWithError(this, error);
     return;
 }
Exemple #18
0
        /// <summary>
        /// Searches the operation did finish with result.
        /// </summary>
        /// <param name="operation">The operation.</param>
        /// <param name="result">The result.</param>
        public void SearchOperationDidFinishWithResult(Operation operation, UPCRMResult result)
        {
            this.crmQuery = null;
            switch (this.currentQueryType)
            {
            case 0:
                this.HandleGroupResult(result);
                break;

            case 1:
                this.HandleItemResult(result);
                break;

            case 2:
                this.HandleDestinationResult(result);
                break;

            case 3:
                this.HandleSourceFieldResult(result);
                break;

            default:
                break;
            }
        }
Exemple #19
0
        /// <summary>
        /// The query for link link record.
        /// </summary>
        /// <param name="linkInfo">
        /// The link info.
        /// </param>
        /// <param name="recordIdentification">
        /// The record identification.
        /// </param>
        /// <returns>
        /// The <see cref="UPContainerMetaInfo"/>.
        /// </returns>
        public UPContainerMetaInfo QueryForLinkLinkRecord(UPCRMLinkInfo linkInfo, string recordIdentification)
        {
            UPContainerMetaInfo crmQuery = new UPContainerMetaInfo(null, linkInfo.TargetInfoAreaId);

            crmQuery.SetLinkRecordIdentification(recordIdentification, linkInfo.LinkId);
            return(crmQuery);
        }
Exemple #20
0
        /// <summary>
        /// Copies the field values for record identification.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="alwaysRemote">if set to <c>true</c> [always remote].</param>
        /// <param name="theDelegate">The delegate.</param>
        /// <returns></returns>
        public Operation CopyFieldValuesForRecordIdentification(string recordIdentification, bool alwaysRemote, UPCopyFieldsDelegate theDelegate)
        {
            if (!alwaysRemote)
            {
                Dictionary <string, object> dict = this.CopyFieldValuesForRecordIdentification(recordIdentification);
                if (dict?.Count > 0)
                {
                    theDelegate?.CopyFieldsDidFinishWithValues(this, dict);
                    return(null);
                }
            }

            UPContainerMetaInfo crmQuery = new UPContainerMetaInfo(this.FieldControlConfiguration);

            crmQuery.SetLinkRecordIdentification(recordIdentification);
            UPCopyFieldsRequest request = new UPCopyFieldsRequest(crmQuery, theDelegate, this);

            request.AlwaysRemote = true;

            if (this.requests == null)
            {
                this.requests = new List <UPCopyFieldsRequest>();
            }

            this.requests.Add(request);

            return(request.Start());
        }
Exemple #21
0
 /// <summary>
 /// Adds the container meta information.
 /// </summary>
 /// <param name="containerMetaInfo">
 /// The container meta information.
 /// </param>
 /// <param name="linkRecordIdentification">
 /// The link record identification.
 /// </param>
 /// <param name="linkId">
 /// The link identifier.
 /// </param>
 public virtual void AddContainerMetaInfo(
     UPContainerMetaInfo containerMetaInfo,
     string linkRecordIdentification,
     int linkId)
 {
     this.AddContainerMetaInfo(containerMetaInfo, null, linkRecordIdentification, linkId);
 }
Exemple #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RemoteSearchOperation"/> class.
        /// </summary>
        /// <param name="containerMetaInfo">
        /// The container meta information.
        /// </param>
        /// <param name="recordIdentification">
        /// The record identification.
        /// </param>
        /// <param name="linkRecordIdentification">
        /// The link record identification.
        /// </param>
        /// <param name="linkId">
        /// The link identifier.
        /// </param>
        /// <param name="handler">
        /// The handler.
        /// </param>
        public RemoteSearchOperation(
            UPContainerMetaInfo containerMetaInfo,
            string recordIdentification,
            string linkRecordIdentification,
            int linkId,
            ISearchOperationHandler handler)
        {
            this.ContainerMetaInfo      = containerMetaInfo;
            this.QueryParameters        = new Dictionary <string, string>();
            this.SearchOperationHandler = handler;

            this.QueryParameters["QueryDef"] = JsonConvert.SerializeObject(containerMetaInfo?.QueryToObject());
            if (!string.IsNullOrEmpty(linkRecordIdentification))
            {
                this.QueryParameters["LinkRecordIdentification"] = linkRecordIdentification;
                if (linkId >= 0)
                {
                    this.QueryParameters["LinkId"] = $" {linkId}";
                }
            }

            if (!string.IsNullOrEmpty(recordIdentification))
            {
                this.RecordIdentification = recordIdentification;
                this.SkipLocalMerge       = true;
                this.QueryParameters["RecordIdentification"] = recordIdentification;
            }

            if (containerMetaInfo?.MaxResults > 0)
            {
                this.QueryParameters["MaxResults"] = $" {containerMetaInfo.MaxResults}"; // it was  {containerMetaInfo.MaxResults + 1}. I can't find the logic in this +1 here.
            }
        }
Exemple #23
0
 private void SurveyRootExistsLocally()
 {
     this.loadStep = 3;
     this.crmQuery = new UPContainerMetaInfo(this.SurveyAnswerSearchAndList, this.Parameters);
     this.crmQuery.SetLinkRecordIdentification(this.AnswerRootRecordIdentification);
     this.crmQuery.Find(this.DestinationRequestOption, this);
 }
        /// <summary>
        /// Loads the specified request option.
        /// </summary>
        /// <param name="requestOption">The request option.</param>
        /// <param name="currencyDelegate">The currency delegate.</param>
        /// <returns></returns>
        public bool Load(UPRequestOption requestOption, ICurrencyConversionDelegate currencyDelegate)
        {
            if (this.CurrencyDelegate != null)
            {
                return(false);
            }

            this.CurrencyDelegate = currencyDelegate;
            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(this.SearchAndListConfigName);
            UPConfigFilter          filter        = null;

            if (searchAndList != null)
            {
                filter = configStore.FilterByName(searchAndList.FilterName);
            }

            this.fieldControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName);
            if (this.fieldControl != null)
            {
                this.crmQuery = new UPContainerMetaInfo(this.fieldControl, filter, null);
            }

            if (this.crmQuery == null)
            {
                this.CurrencyDelegate = null;
                this.crmQuery         = null;
                currencyDelegate.CurrencyConversionDidFailWithError(this, new Exception($"invalid searchAndList configuration {this.SearchAndListConfigName}"));
                return(true);
            }

            this.crmQuery.Find(requestOption, this);
            return(true);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSyncDocumentDownloadFieldGroupUrlCache"/> class.
        /// </summary>
        /// <param name="fieldGroupName">
        /// Name of the field group.
        /// </param>
        public UPSyncDocumentDownloadFieldGroupUrlCache(string fieldGroupName)
        {
            this.FieldControl = ConfigurationUnitStore.DefaultStore?.FieldControlByNameFromGroup("List", fieldGroupName);
            if (this.FieldControl != null)
            {
                var crmQuery = new UPContainerMetaInfo(this.FieldControl);
                this.result = crmQuery.Find();
                var count = this.result?.RowCount ?? 0;
                this.resultDictionary = new Dictionary <string, ICrmDataSourceRow>(count);
                for (var i = 0; i < count; i++)
                {
                    var row = this.result?.ResultRowAtIndex(i);
                    var rid = row?.RootRecordId;
                    if (!string.IsNullOrEmpty(rid))
                    {
                        this.resultDictionary[rid] = row;
                    }
                }
            }

            var fieldMapping = this.FieldControl?.FunctionNames();
            var field        = fieldMapping?.ValueOrDefault("UpdDate");

            this.ServerModifyDateFieldIndex = field?.TabIndependentFieldIndex ?? -1;

            field = fieldMapping?.ValueOrDefault("UpdTime");
            this.ServerModifyTimeFieldIndex = field?.TabIndependentFieldIndex ?? -1;

            this.HasServerDateTime = this.ServerModifyDateFieldIndex >= 0 && this.ServerModifyTimeFieldIndex >= 0;
        }
Exemple #26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteSearchOperation"/> class.
 /// </summary>
 /// <param name="containerMetaInfo">
 /// The container meta information.
 /// </param>
 /// <param name="linkRecordIdentification">
 /// The link record identification.
 /// </param>
 /// <param name="linkId">
 /// The link identifier.
 /// </param>
 /// <param name="handler">
 /// The handler.
 /// </param>
 public RemoteSearchOperation(
     UPContainerMetaInfo containerMetaInfo,
     string linkRecordIdentification,
     int linkId,
     ISearchOperationHandler handler)
     : this(containerMetaInfo, null, linkRecordIdentification, linkId, handler)
 {
 }
        /// <inheritdoc/>
        public void SearchOperationDidFailWithError(Operation operation, Exception error)
        {
            ICurrencyConversionDelegate currencyDelegate = this.CurrencyDelegate;

            this.CurrencyDelegate = null;
            this.crmQuery         = null;
            currencyDelegate.CurrencyConversionDidFailWithError(this, error);
        }
        /// <summary>
        /// Filters for configuration filter.
        /// </summary>
        /// <param name="configFilter">The configuration filter.</param>
        /// <param name="searchAndListName">Name of the search and list.</param>
        /// <param name="filterParameters">The filter parameters.</param>
        /// <param name="singleSelect">if set to <c>true</c> [single select].</param>
        /// /// <returns>Filter</returns>
        public static UPMFilter FilterForConfigFilter(UPConfigFilter configFilter, string searchAndListName, Dictionary <string, object> filterParameters, bool singleSelect)
        {
            if (string.IsNullOrEmpty(searchAndListName))
            {
                return(null);
            }

            IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
            SearchAndList           searchAndList = configStore.SearchAndListByName(searchAndListName);

            if (searchAndList != null)
            {
                return(null);
            }

            FieldControl listControl = configStore.FieldControlByNameFromGroup("List", searchAndList.FieldGroupName);

            if (listControl == null)
            {
                return(null);
            }

            UPContainerMetaInfo crmQuery = new UPContainerMetaInfo(searchAndListName, filterParameters);

            UPCRMResult result = crmQuery.Find();
            int         count  = result.RowCount;

            if (count == 0)
            {
                return(null);
            }

            UPCRMListFormatter                  listFormatter = new UPCRMListFormatter(listControl.TabAtIndex(0));
            StringIdentifier                    identifier    = StringIdentifier.IdentifierWithStringId("SelectFilter");
            UPMSelectCatalogFilter              filter        = new UPMSelectCatalogFilter(identifier);
            Dictionary <string, string>         dict          = new Dictionary <string, string>(count);
            Dictionary <string, UPCRMResultRow> rowDict       = new Dictionary <string, UPCRMResultRow>(count);

            for (int i = 0; i < count; i++)
            {
                UPCRMResultRow row        = (UPCRMResultRow)result.ResultRowAtIndex(i);
                string         fieldValue = listFormatter.StringFromRowForPosition(row, 0);
                dict[row.RootRecordIdentification]    = fieldValue;
                rowDict[row.RootRecordIdentification] = row;
            }

            filter.CrmResult             = result;
            filter.FilterParameters      = filterParameters;
            filter.ResultRowDictionary   = rowDict;
            filter.ExplicitCatalogValues = dict;
            filter.ParameterName         = "Select";
            filter.Name = configFilter.UnitName;

            filter.DisplayName = !string.IsNullOrEmpty(configFilter.DisplayName) ? configFilter.DisplayName : configFilter.UnitName;

            filter.SingleSelect = singleSelect;
            return(filter);
        }
Exemple #29
0
        /// <summary>
        /// Copies the field values for record identification.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <returns></returns>
        public Dictionary <string, object> CopyFieldValuesForRecordIdentification(string recordIdentification)
        {
            UPContainerMetaInfo crmQuery = new UPContainerMetaInfo(this.FieldControlConfiguration);

            crmQuery.SetLinkRecordIdentification(recordIdentification);
            UPCRMResult result = crmQuery.Find();

            return(result.RowCount >= 1 ? this.CopyFieldValuesForResult((UPCRMResultRow)result.ResultRowAtIndex(0)) : null);
        }
        /// <summary>
        /// The document data for record id.
        /// </summary>
        /// <param name="recordId">
        /// The record id.
        /// </param>
        /// <returns>
        /// The <see cref="DocumentData"/>.
        /// </returns>
        public DocumentData DocumentDataForRecordId(string recordId)
        {
            UPContainerMetaInfo query = new UPContainerMetaInfo(this.FieldControl);

            query.SetLinkRecordIdentification(this.InfoAreaId.InfoAreaIdRecordId(recordId));
            UPCRMResult result = query.Find();

            return(result.RowCount > 0 ? this.DocumentDataForResultRow(result.ResultRowAtIndex(0) as UPCRMResultRow) : null);
        }