/// <summary> /// Populate client information after object initialization /// </summary> /// <returns></returns> private bool populateClientData() { this.clientConfig = new ClientConfigVO(this.pwnSecData.GlobalConfiguration.Version, this.pwnSecData.GlobalConfiguration.DataPublicKey); PawnSecVO.ClientPawnSecMachineVO machine = null; PawnSecVO.ClientStoreMapVO stoCliMap; if (CollectionUtilities.isNotEmpty(this.pwnSecData.ClientMachines) && CollectionUtilities.isNotEmpty(this.pwnSecData.ClientStoreMapList)) { stoCliMap = this.pwnSecData.ClientStoreMapList.Find(x => x.StoreNumber.Equals(this.storeNumber)); if (stoCliMap != null) { machine = this.pwnSecData.ClientMachines.Find(x => x.Machine.ClientId.Equals(stoCliMap.ClientRegistryId)); if (machine != null) { this.clientConfig.IpAddress = machine.Machine.IPAddress; this.clientConfig.MacAddress = machine.Machine.MACAddress; this.clientConfig.MachineName = machine.Machine.MachineName; } } } else { return(false); } if (stoCliMap != null && CollectionUtilities.isNotEmpty(this.pwnSecData.Stores)) { var pSecStore = this.pwnSecData.Stores.Find(x => x.StoreConfiguration.Id == stoCliMap.StoreConfigId); if (pSecStore != null) { this.clientConfig.StoreConfiguration = pSecStore.StoreConfiguration; this.clientConfig.StoreSite = pSecStore.StoreSite; this.clientConfig.AppVersion = pSecStore.AppVersion; if (machine != null) { //Get print enabled string and set boolean accordingly this.clientConfig.StoreSite.TerminalId = machine.StoreMachine.WorkstationId; this.clientConfig.ClientConfiguration.PrintEnabled = machine.StoreMachine.PrintEnabled; this.clientConfig.ClientConfiguration.CPNHSEnabled = machine.StoreMachine.CPNHSEnabled; } } } else { return(false); } this.clientConfig.GlobalConfiguration = this.pwnSecData.GlobalConfiguration; return(true); }
/// <summary> /// /// </summary> /// <param name="clientData"></param> /// <returns></returns> private bool initializeClientData(DataTable clientData) { if (clientData == null || clientData.Rows == null || clientData.Rows.Count <= 0) { return(false); } //Get the first data row var dataRow = clientData.Rows[0]; //Get app version var appVer = Utilities.GetStringValue(dataRow["appversion"], string.Empty); //Create and set client config this.clientConfig = new ClientConfigVO(appVer, this._publicKey); this.clientConfig.IpAddress = Utilities.GetStringValue( dataRow["ipaddress"], string.Empty); this.clientConfig.MacAddress = Utilities.GetStringValue( dataRow["macaddress"], string.Empty); this.clientConfig.MachineName = Utilities.GetStringValue( dataRow["machinename"], string.Empty); this.clientConfig.StoreSite.Alias = Utilities.GetStringValue( dataRow["aliascode"], string.Empty); this.clientConfig.StoreSite.CompanyNumber = Utilities.GetStringValue( dataRow["companynumber"], string.Empty); this.clientConfig.StoreSite.State = Utilities.GetStringValue( dataRow["state"], string.Empty); this.clientConfig.StoreSite.StoreNumber = Utilities.GetStringValue( dataRow["storenumber"], string.Empty); this.clientConfig.StoreConfiguration.CompanyName = Utilities.GetStringValue( dataRow["companyname"], string.Empty); var adobePathOvr = Utilities.GetStringValue( dataRow["adobeoverride"], string.Empty); var ghostPathOvr = Utilities.GetStringValue( dataRow["ghostscriptoverride"], string.Empty); //Get store config values var storeConfigVO = this.clientConfig.StoreConfiguration; storeConfigVO.Id = Utilities.GetULongValue( dataRow["id"], 0L); storeConfigVO.MetalsFile = Utilities.GetStringValue( dataRow["metalsfile"], string.Empty); storeConfigVO.StonesFile = Utilities.GetStringValue( dataRow["stonesfile"], string.Empty); storeConfigVO.FetchSizeMultiplier = Utilities.GetULongValue( dataRow["fetchszmx"], 0L); storeConfigVO.TimeZone = Utilities.GetStringValue( dataRow["timezone"], string.Empty); storeConfigVO.MillisecondOffset = Utilities.GetLongValue( dataRow["millisecondoffset"], 0L); storeConfigVO.SecondOffset = Utilities.GetLongValue( dataRow["secondoffset"], 0L); storeConfigVO.MinuteOffset = Utilities.GetLongValue( dataRow["minuteoffset"], 0L); storeConfigVO.HourOffset = Utilities.GetLongValue( dataRow["houroffset"], 0L); storeConfigVO.DayOffset = Utilities.GetLongValue( dataRow["dayoffset"], 0L); storeConfigVO.MonthOffset = Utilities.GetLongValue( dataRow["monthoffset"], 0L); storeConfigVO.YearOffset = Utilities.GetLongValue( dataRow["yearoffset"], 0L); storeConfigVO.StoreMode = Utilities.GetStringValue( dataRow["storemode"], "0"); //Get global config values var globalConfigVO = this.clientConfig.GlobalConfiguration; if (string.IsNullOrEmpty(adobePathOvr)) { globalConfigVO.AdobeReaderPath = Utilities.GetStringValue( dataRow["adobereaderpath"], string.Empty); } else { globalConfigVO.AdobeReaderPath = adobePathOvr; } globalConfigVO.BaseLogPath = Utilities.GetStringValue( dataRow["baselogpath"], string.Empty); globalConfigVO.BaseMediaPath = Utilities.GetStringValue( dataRow["basemediapath"], string.Empty); globalConfigVO.BaseTemplatePath = Utilities.GetStringValue( dataRow["basetemplatepath"], string.Empty); if (string.IsNullOrEmpty(ghostPathOvr)) { globalConfigVO.GhostScriptPath = Utilities.GetStringValue( dataRow["ghostscriptpath"], string.Empty); } else { globalConfigVO.GhostScriptPath = ghostPathOvr; } //Get store client config) var storeClientConfigVO = clientConfig.ClientConfiguration; storeClientConfigVO.LogLevel = Utilities.GetStringValue( dataRow["loglevel"], string.Empty); storeClientConfigVO.TerminalNumber = Utilities.GetIntegerValue( dataRow["terminalnumber"], 0); storeClientConfigVO.TraceLevel = Utilities.GetIntegerValue( dataRow["tracelevel"], 0); storeClientConfigVO.WorkstationId = Utilities.GetStringValue( dataRow["workstationid"], string.Empty); //Get print enabled string and set boolean accordingly this.clientConfig.StoreSite.TerminalId = storeClientConfigVO.WorkstationId; string printEnStr = Utilities.GetStringValue(dataRow["printenabled"], "0"); storeClientConfigVO.PrintEnabled = (printEnStr.Equals("1")); return(true); }
/// <summary> /// Populate database information after object initialization /// </summary> /// <returns></returns> private bool populateDbData(bool onlyDbData = false) { if (this.pwnSecData == null) { return(false); } if (CollectionUtilities.isNotEmpty(this.pwnSecData.DatabaseServiceMapList) && CollectionUtilities.isNotEmpty(this.pwnSecData.DatabaseServiceList)) { List <DatabaseServiceVO> dbList = null; if (this.pwnSecData.MapsValid == false) { List <PawnSecVO.DatabaseServiceStoreMapVO> dbStoMapEntryList; if (!onlyDbData) { dbStoMapEntryList = this.pwnSecData.DatabaseServiceMapList.FindAll( x => x.StoreConfigId.Equals(this.clientConfig.StoreConfiguration.Id)); } else { dbStoMapEntryList = this.pwnSecData.DatabaseServiceMapList; } if (CollectionUtilities.isNotEmpty(dbStoMapEntryList)) { var dbListE = from dbServ in this.pwnSecData.DatabaseServiceList join dbServMap in dbStoMapEntryList on dbServ.Id equals dbServMap.DatabaseServiceId select dbServ; dbList = new List <DatabaseServiceVO>(dbListE); } } else { KeyValuePair <PawnSecVO.PawnSecStoreVO, List <DatabaseServiceVO> > pSecStoreDbListKeyPair; if (!onlyDbData) { pSecStoreDbListKeyPair = this.pwnSecData.StoreToDatabaseServiceMap.First( x => x.Key.StoreSite.StoreNumber.Equals(this.storeNumber)); } else { pSecStoreDbListKeyPair = this.pwnSecData.StoreToDatabaseServiceMap.First(); } dbList = pSecStoreDbListKeyPair.Value; } if (dbList != null && CollectionUtilities.isNotEmpty(dbList)) { if (onlyDbData && this.clientConfig == null) { this.clientConfig = new ClientConfigVO("1", this._publicKey); } var idx = 0; foreach (var curDb in dbList) { if (curDb == null) { continue; } //Add database service to store client config var key = DBKEY + idx; this.clientConfig.DatabaseServices.Add(key, curDb); ++idx; } return(true); } } return(false); }