/// <summary>
        /// Initializes a new instance of the <see cref="UPSyncDataSets"/> class.
        /// </summary>
        /// <param name="dataSetNames">
        /// The data set names.
        /// </param>
        /// <param name="incremental">
        /// if set to <c>true</c> [incremental].
        /// </param>
        /// <param name="session">
        /// The session.
        /// </param>
        /// <param name="crmDataStore">
        /// The CRM data store.
        /// </param>
        /// <param name="configStore">
        /// The configuration store.
        /// </param>
        /// <param name="theDelegate">
        /// The delegate.
        /// </param>
        public UPSyncDataSets(
            List <string> dataSetNames,
            bool incremental,
            IServerSession session,
            ICRMDataStore crmDataStore,
            IConfigurationUnitStore configStore,
            ISyncDataSetsDelegate theDelegate)
        {
            this.Delegate    = theDelegate;
            this.Session     = session;
            this.DataStore   = crmDataStore;
            this.ConfigStore = configStore;

            var dataSetArray = dataSetNames == null
                                   ? new List <UPSyncDataSet>()
                                   : new List <UPSyncDataSet>(dataSetNames.Count);
            var dataSets = dataSetNames?.Select(dataSetName => new UPSyncDataSet(dataSetName, incremental, crmDataStore));

            if (dataSets != null && dataSets.Any())
            {
                dataSetArray.AddRange(dataSets);
            }

            this.DataSets = dataSetArray;
        }
        /// <summary>
        /// Updates the metadata with view reference.
        /// </summary>
        /// <param name="viewReference">The view reference.</param>
        public override void UpdateMetadataWithViewReference(ViewReference viewReference)
        {
            base.UpdateMetadataWithViewReference(viewReference);
            string urlAsString = viewReference.ContextValueForKey("Url");

            this.LocalUrl = viewReference.ContextValueForKey("localWebArchiv") == "true";
            if (this.LocalUrl)
            {
                this.Url = new Uri($"{ServerSession.CurrentSession.SessionSpecificCachesPath}{urlAsString}.htm");
            }
            else
            {
                if (!urlAsString.Contains("$cur"))
                {
                    ICRMDataStore dataStore = UPCRMDataStore.DefaultStore;
                    urlAsString = urlAsString.Replace("$curRepId;", dataStore.Reps.CurrentRepId);
                    urlAsString = urlAsString.Replace("$curRep;", dataStore.Reps.CurrentRep.RepName);
                    urlAsString = urlAsString.Replace("$curTenantNo;", ServerSession.CurrentSession.TenantNo.ToString());
                    urlAsString = urlAsString.Replace("$curLanguage;", ServerSession.CurrentSession.LanguageKey);
                }

                if (string.IsNullOrEmpty(viewReference.ContextValueForKey("FieldGroup")) ||
                    string.IsNullOrEmpty(viewReference.ContextValueForKey("RecordId")))
                {
                    this.Url = new Uri(urlAsString);
                }
                else
                {
                    this.Finished     = false;
                    this.urlOperation = new OpenUrlOperation(
                        urlAsString,
                        viewReference.ContextValueForKey("RecordId"),
                        viewReference.ContextValueForKey("FieldGroup"),
                        (Uri result, Exception error) =>
                    {
                        this.Url = result;
                        if (error != null)
                        {
                            this.TheDelegate.WebContentMetaDataFailedWithError(this, error);
                        }
                        else
                        {
                            this.TheDelegate.WebContentMetaDataFinishedWithRedirectUrl(this, this.Url);
                        }
                    });

                    this.urlOperation?.PerformOperation();
                }

                if (this.Url == null)
                {
                    this.Url = new Uri("about:blank");
                }
                else if (string.IsNullOrEmpty(this.Url.Scheme))
                {
                    this.Url = new Uri($"http://{urlAsString}");
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMTableInfo"/> class.
        /// </summary>
        /// <param name="infoAreaId">
        /// The information area identifier.
        /// </param>
        /// <param name="dataStore">
        /// The data store.
        /// </param>
        public UPCRMTableInfo(string infoAreaId, ICRMDataStore dataStore)
        {
            this.InfoAreaId = infoAreaId;
            this.DataStore  = dataStore;
            var database = this.DataStore?.DatabaseInstance;

            this.tableInfo = database?.GetTableInfoByInfoArea(this.InfoAreaId);
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPCRMRecordImplicitOfflineFieldSetter"/> class.
 /// </summary>
 /// <param name="record">The record.</param>
 /// <param name="_offlineStationNumber">The offline station number.</param>
 public UPCRMRecordImplicitOfflineFieldSetter(UPCRMRecord record, int _offlineStationNumber)
 {
     this.Record               = record;
     this.infoAreaId           = this.Record.InfoAreaId;
     this.dataStore            = UPCRMDataStore.DefaultStore;
     this.tableInfo            = this.dataStore.TableInfoForInfoArea(this.infoAreaId);
     this.offlineStationNumber = _offlineStationNumber;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSyncDataSets"/> class.
 /// </summary>
 /// <param name="session">
 /// The session.
 /// </param>
 /// <param name="incremental">
 /// if set to <c>true</c> [incremental].
 /// </param>
 /// <param name="crmDataStore">
 /// The CRM data store.
 /// </param>
 /// <param name="configStore">
 /// The configuration store.
 /// </param>
 /// <param name="theDelegate">
 /// The delegate.
 /// </param>
 public UPSyncDataSets(
     IServerSession session,
     bool incremental,
     ICRMDataStore crmDataStore,
     IConfigurationUnitStore configStore,
     ISyncDataSetsDelegate theDelegate)
     : this(configStore?.AllDataSetNamesSorted(), incremental, session, crmDataStore, configStore, theDelegate)
 {
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CrmUndoRequest"/> class.
 /// </summary>
 /// <param name="requestId">The request identifier.</param>
 /// <param name="records">The records.</param>
 public CrmUndoRequest(int requestId, List <UPCRMRecord> records)
 {
     this.RequestId  = requestId;
     this.CrmRecords = records;
     this.DataStore  = UPCRMDataStore.DefaultStore;
     foreach (UPCRMRecord record in this.CrmRecords)
     {
         this.AddRecord(record);
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSyncDataSets"/> class.
 /// </summary>
 /// <param name="session">
 /// The session.
 /// </param>
 /// <param name="crmDataStore">
 /// The CRM data store.
 /// </param>
 /// <param name="configStore">
 /// The configuration store.
 /// </param>
 /// <param name="theDelegate">
 /// The delegate.
 /// </param>
 public UPSyncDataSets(
     IServerSession session,
     ICRMDataStore crmDataStore,
     IConfigurationUnitStore configStore,
     ISyncDataSetsDelegate theDelegate)
 {
     this.Session         = session;
     this.Delegate        = theDelegate;
     this.DataStore       = crmDataStore;
     this.ConfigStore     = configStore;
     this.ContinueRequest = true;
 }
예제 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPQuestionnaireQuestion"/> class.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="data">The data.</param>
        /// <param name="questionnaire">The questionnaire.</param>
        public UPQuestionnaireQuestion(string recordIdentification, Dictionary <string, object> data, UPQuestionnaire questionnaire)
        {
            this.Label           = data.ValueOrDefault(Constants.QuestionnaireLabel) as string;
            this.QuestionId      = data.ValueOrDefault(Constants.QuestionnaireQuestionNumber) as string;
            this.QuestionSortKey = Convert.ToInt32(this.QuestionId).ToString("D8");
            this.InfoAreaId      = data.ValueOrDefault(Constants.QuestionnaireInfoAreaId) as string;
            this.NextQuestionId  = data.ValueOrDefault(Constants.QuestionnaireFollowUpNumber) as string;
            int nextQuestionIntId = Convert.ToInt32(this.NextQuestionId);

            if (nextQuestionIntId > 0)
            {
                int questionIntId = Convert.ToInt32(this.QuestionId);
                if (nextQuestionIntId <= questionIntId)
                {
                    this.NextQuestionId = string.Empty;
                }
            }

            this.Mandatory      = data.ValueOrDefault(Constants.QuestionnaireMandatory) as string == "true";
            this.Read           = data.ValueOrDefault(Constants.QuestionnaireRead) as string == "true";
            this.Save           = data.ValueOrDefault(Constants.QuestionnaireSave) as string == "true";
            this.multiple       = data.ValueOrDefault(Constants.QuestionnaireMultiple) as string == "true";
            this.AdditionalInfo = data.ValueOrDefault(Constants.QuestionnaireAdditionalInfo) as string;
            this.StartsNewGroup = data.ValueOrDefault(Constants.QuestionnaireNewSection) as string == "true";
            this.DefaultAnswer  = data.ValueOrDefault(Constants.QuestionnaireDefault) as string;
            this.Hide           = data.ValueOrDefault(Constants.QuestionnaireHide) as string == "true";

            string fieldIdString = data.ValueOrDefault(Constants.QuestionnaireFieldId) as string;

            if (!string.IsNullOrEmpty(fieldIdString))
            {
                this.FieldId = Convert.ToInt32(fieldIdString);
                if (this.FieldId >= 0)
                {
                    ICRMDataStore dataStore = UPCRMDataStore.DefaultStore;
                    this.Field     = new UPCRMField(this.FieldId, this.InfoAreaId);
                    this.FieldInfo = dataStore.FieldInfoForField(this.Field);
                }
                else
                {
                    this.FieldId = -1;
                }
            }
            else
            {
                this.FieldId = -1;
            }

            this.RecordIdentification = recordIdentification;
            this.Questionnaire        = questionnaire;
        }
예제 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMFieldInfo" /> class.
        /// </summary>
        /// <param name="fieldId">The field identifier.</param>
        /// <param name="infoAreaId">The information area identifier.</param>
        /// <param name="dataStore">The data store.</param>
        /// <returns>UPCRMFieldInfo</returns>
        public static UPCRMFieldInfo Create(int fieldId, string infoAreaId, ICRMDataStore dataStore)
        {
            var tableInfo = dataStore.DatabaseInstance?.GetTableInfoByInfoArea(infoAreaId);

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

            return(new UPCRMFieldInfo
            {
                InfoAreaId = infoAreaId,
                FieldId = fieldId,
                fieldInfo = tableInfo.GetFieldInfo(fieldId)
            });
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMFieldInfo" /> class.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <param name="dataStore">The data store.</param>
        /// <returns>UPCRMFieldInfo</returns>
        public static UPCRMFieldInfo Create(UPCRMField field, ICRMDataStore dataStore)
        {
            if (field == null || dataStore == null)
            {
                return(null);
            }

            var tableInfo = dataStore.DatabaseInstance?.GetTableInfoByInfoArea(field.InfoAreaId);

            var fieldInfo = tableInfo?.GetFieldInfo(field.FieldId);

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

            return(new UPCRMFieldInfo
            {
                InfoAreaId = field.InfoAreaId,
                FieldId = field.FieldId,
                fieldInfo = fieldInfo
            });
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSyncDataSets"/> class.
        /// </summary>
        /// <param name="dataSetNames">
        /// The data set names.
        /// </param>
        /// <param name="linkRecordIdentification">
        /// The link record identification.
        /// </param>
        /// <param name="session">
        /// The session.
        /// </param>
        /// <param name="crmDataStore">
        /// The CRM data store.
        /// </param>
        /// <param name="configStore">
        /// The configuration store.
        /// </param>
        /// <param name="theDelegate">
        /// The delegate.
        /// </param>
        public UPSyncDataSets(
            List <string> dataSetNames,
            string linkRecordIdentification,
            IServerSession session,
            ICRMDataStore crmDataStore,
            IConfigurationUnitStore configStore,
            ISyncDataSetsDelegate theDelegate)
        {
            var dataSetArray = dataSetNames != null
                                   ? new List <UPSyncDataSet>(dataSetNames.Count)
                                   : new List <UPSyncDataSet>();

            if (dataSetNames != null)
            {
                dataSetArray.AddRange(dataSetNames.Select(dataSetName => new UPSyncDataSet(dataSetName)));
            }

            this.DataSets = dataSetArray;
            this.Delegate = theDelegate;
            this.LinkRecordIdentification = linkRecordIdentification;
            this.Session     = session;
            this.DataStore   = crmDataStore;
            this.ConfigStore = configStore;
        }
예제 #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CrmUndoRequest"/> class.
 /// </summary>
 /// <param name="requestId">The request identifier.</param>
 private CrmUndoRequest(int requestId)
 {
     this.RequestId = requestId;
     this.DataStore = UPCRMDataStore.DefaultStore;
     this.Load();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSyncDataModel"/> class.
 /// </summary>
 /// <param name="dataStore">
 /// The data store.
 /// </param>
 public UPSyncDataModel(ICRMDataStore dataStore)
 {
     this.DataStore = dataStore;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSyncQuery"/> class.
 /// </summary>
 /// <param name="dataStore">
 /// The data store.
 /// </param>
 public UPSyncQuery(ICRMDataStore dataStore)
 {
     this.DataStore = dataStore;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSyncCatalogs"/> class.
 /// </summary>
 /// <param name="dataStore">
 /// The data store.
 /// </param>
 public UPSyncCatalogs(ICRMDataStore dataStore)
 {
     this.DataStore = dataStore;
 }
예제 #16
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSyncDataSet"/> class.
 /// </summary>
 /// <param name="dataSetName">
 /// Name of the data set.
 /// </param>
 /// <param name="incremental">
 /// if set to <c>true</c> [incremental].
 /// </param>
 /// <param name="crmStore">
 /// The CRM store.
 /// </param>
 public UPSyncDataSet(string dataSetName, bool incremental, ICRMDataStore crmStore)
     : this(dataSetName, incremental ? crmStore.LastSyncOfDataset(dataSetName) : null)
 {
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPSynchronization"/> class.
 /// </summary>
 /// <param name="crmDataStore">
 /// The CRM data store.
 /// </param>
 /// <param name="configStore">
 /// The configuration store.
 /// </param>
 public UPSynchronization(ICRMDataStore crmDataStore, IConfigurationUnitStore configStore)
 {
     this.DataStore   = crmDataStore;
     this.ConfigStore = configStore;
 }