public object ProcessMembershipWithKeyValue() { CustomerFound = true; if (_keyValue.AccessControl.ModuleAccess.Find(x => x.HasAccess && x.Key == GroupCode.MEMB) == null) { NoAccessToMembership message = new NoAccessToMembership(); message.Message = "You dont' have access for Membership data."; return(message); } var cusKeys = new CustomerKeys(); var membershipField = new MembershipFields(); var membershipOutput = new MembershipOutput(); try { var pKey = GetCustomerPersistantKeyFromKeyValue(); if (pKey == 0) { cusKeys.Keys.HasPartialResult = false; cusKeys.Keys.Message = "No persistent key found for this customer"; CustomerFound = false; return(null); } try { membershipOutput.MembershipData = _membershipService.GetMembershipDetails(pKey); } catch (Exception ex) { _logger.Error("ProcessMembership From KeyValue: ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex); throw new Exception(ex.Message); } } catch (Exception ex) { _logger.Error("ProcessMembership From KeyValue: ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex); if (_logParameterValue) { _logger.Error($"Parameters MembershipForMembershipKeyValue:- Key={_keyValue.KeyValue.Key}, Value={_keyValue.KeyValue.Value}"); } throw new Exception(ex.Message); } return(membershipOutput); }
//恢复默认按键 void RecoveryDefaultKey() { TextAsset keyFile = (TextAsset)Resources.Load("Text/DefaultKey"); string keyInfo = keyFile.text; File.WriteAllText(Application.streamingAssetsPath + "/CustomerKeys.txt", keyInfo, Encoding.UTF8); string[] eachKey = File.ReadAllText(Application.streamingAssetsPath + "/CustomerKeys.txt", Encoding.UTF8).Split('\n'); foreach (string a in eachKey) { string[] temp = a.Split(','); Text t = PureDictTool.GetValue <string, Text>(keyText, temp[0]); t.text = temp[1]; } CustomerKeys.UpdateKeys(); }
/// <summary> /// PermissionsKeyValuePairStrategy.Execute() worker method.. /// </summary> /// <returns></returns> public object ProcessPermissionFromKeyValue() { object listOfPermission = new object(); CustomerKeys keys = new CustomerKeys(); try { int pkey = string.Compare(_keyValueParameter.KeyValue.Key, "CPCK", StringComparison.CurrentCultureIgnoreCase) == 0 ? GetCustomerIdFromPermissionId(Convert.ToInt64(_keyValueParameter.KeyValue.Value)) : GetCustomerIdFromKeyValue(); if (pkey == 0) { keys.Keys.HasPartialResult = false; keys.Keys.Message = "No Pkey found for the customer."; } else { try { listOfPermission = _permissionService.GetPermission(_keyValueParameter.ReturnMe.Permissions, _nameAndAddress.NameAndAddress, _keyValueParameter.KeyValue); return(listOfPermission); } catch (Exception ex) { _logger.Error("ProcessPermission Name and Value :" + ex.Message, ex); if (_logParameterValue) { _logger.Error($"Parameters ProcessPermissionFromKeyValue:- Key={_keyValueParameter.KeyValue.Key}, Value={_keyValueParameter.KeyValue.Value}"); } throw new Exception(ex.Message); } } } catch (Exception ex) { _logger.Error("ProcessPermission Key and Value Execute :" + ex.Message, ex); if (_logParameterValue) { _logger.Error($"Parameters ProcessPermissionFromKeyValue:- Key={_keyValueParameter.KeyValue.Key}, Value={_keyValueParameter.KeyValue.Value}"); } throw new Exception(ex.Message); } return(listOfPermission); }
//应用键位函数 void ReplyEditedKey() { string keyInfo = ""; foreach (string a in keyText.Keys) { keyInfo += (a + ","); Text t = PureDictTool.GetValue <string, Text>(keyText, a); if (t.text == "") { keyInfo += "U/N\n"; } else { keyInfo += t.text + '\n'; } } File.WriteAllText(Application.streamingAssetsPath + "/CustomerKeys.txt", keyInfo, Encoding.UTF8); CustomerKeys.UpdateKeys(); }
public object ProcessForKeyValue() { if (_keyValue.AccessControl.ModuleAccess.Find(x => x.HasAccess && x.Key == GroupCode.MAILH) == null) { NoAccessToMailingHistory message = new NoAccessToMailingHistory(); message.Message = "You dont' have access for MailingHistory data."; return(message); } if (_keyValue == null) { throw new ArgumentException("KeyValueParamter cannot be null."); } object output = new object();; try { var pkey = _mciRequestService.GetPersistantKey(_keyValue.KeyValue.Key, _keyValue.KeyValue.Value, "PKey"); CustomerKeys keys = new CustomerKeys(); if (!pkey.HasValue) { keys.Keys.HasPartialResult = null; keys.Keys.Message = "No Pkey found for the customer."; output = keys; } else { _keyValue.KeyValue.Key = "PKEY"; _keyValue.KeyValue.Value = pkey.Value.ToString(); List <int> ids = new List <int> { int.Parse(_keyValue.KeyValue.Value) }; dynamic mailingHistoryResult; if (_keyValue.ReturnMe.MailingHistory != null) { mailingHistoryResult = _mailingHistoryService.GetMailingHistoryList(_keyValue.ReturnMe.MailingHistory, null, ids); } else { mailingHistoryResult = _mailingHistoryService.GetMailingHistoryList(null, null, ids); } if (mailingHistoryResult.GetType().Equals(typeof(List <ExpandoObject>))) { MailingHisotyOutputDynamic examOutputDynamic = new MailingHisotyOutputDynamic(); foreach (var a in mailingHistoryResult) { examOutputDynamic.MailingHistoryExpando.Add(a); } output = examOutputDynamic; } else { MailingHistoryOutput mhOutput = new MailingHistoryOutput(); mhOutput.MailingHistoryList.AddRange(mailingHistoryResult); output = mhOutput; } } } catch (Exception ex) { _logger.Error("NameAndAddressStrategy ProcessForKeyValue: " + "ErrorTag: " + ErrorTagProvider.ErrorTag + " -- " + ex.Message, ex); throw new Exception(ex.Message); } return(output); }
//读取按键 void ReadKeyDown() { //字母键 if (Input.GetKeyUp(KeyCode.Q)) { SetKey("Q"); return; } if (Input.GetKeyUp(KeyCode.W)) { SetKey("W"); return; } if (Input.GetKeyUp(KeyCode.E)) { SetKey("E"); return; } if (Input.GetKeyUp(KeyCode.R)) { SetKey("R"); return; } if (Input.GetKeyUp(KeyCode.T)) { SetKey("T"); return; } if (Input.GetKeyUp(KeyCode.Y)) { SetKey("Y"); return; } if (Input.GetKeyUp(KeyCode.U)) { SetKey("U"); return; } if (Input.GetKeyUp(KeyCode.I)) { SetKey("I"); return; } if (Input.GetKeyUp(KeyCode.O)) { SetKey("O"); return; } if (Input.GetKeyUp(KeyCode.P)) { SetKey("P"); return; } if (Input.GetKeyUp(KeyCode.A)) { SetKey("A"); return; } if (Input.GetKeyUp(KeyCode.S)) { SetKey("S"); return; } if (Input.GetKeyUp(KeyCode.D)) { SetKey("D"); return; } if (Input.GetKeyUp(KeyCode.F)) { SetKey("F"); return; } if (Input.GetKeyUp(KeyCode.G)) { SetKey("G"); return; } if (Input.GetKeyUp(KeyCode.H)) { SetKey("H"); return; } if (Input.GetKeyUp(KeyCode.J)) { SetKey("J"); return; } if (Input.GetKeyUp(KeyCode.K)) { SetKey("K"); return; } if (Input.GetKeyUp(KeyCode.L)) { SetKey("L"); return; } if (Input.GetKeyUp(KeyCode.Z)) { SetKey("Z"); return; } if (Input.GetKeyUp(KeyCode.X)) { SetKey("X"); return; } if (Input.GetKeyUp(KeyCode.C)) { SetKey("C"); return; } if (Input.GetKeyUp(KeyCode.V)) { SetKey("V"); return; } if (Input.GetKeyUp(KeyCode.B)) { SetKey("B"); return; } if (Input.GetKeyUp(KeyCode.N)) { SetKey("N"); return; } if (Input.GetKeyUp(KeyCode.M)) { SetKey("M"); return; } //函数键 if (Input.GetKeyUp(KeyCode.F1)) { SetKey("F1"); return; } if (Input.GetKeyUp(KeyCode.F2)) { SetKey("F2"); return; } if (Input.GetKeyUp(KeyCode.F3)) { SetKey("F3"); return; } if (Input.GetKeyUp(KeyCode.F4)) { SetKey("F4"); return; } if (Input.GetKeyUp(KeyCode.F5)) { SetKey("F5"); return; } if (Input.GetKeyUp(KeyCode.F6)) { SetKey("F6"); return; } if (Input.GetKeyUp(KeyCode.F7)) { SetKey("F7"); return; } if (Input.GetKeyUp(KeyCode.F8)) { SetKey("F8"); return; } if (Input.GetKeyUp(KeyCode.F9)) { SetKey("F9"); return; } if (Input.GetKeyUp(KeyCode.F10)) { SetKey("F10"); return; } if (Input.GetKeyUp(KeyCode.F11)) { SetKey("F11"); return; } if (Input.GetKeyUp(KeyCode.F12)) { SetKey("F12"); return; } //数字键 if (Input.GetKeyUp(KeyCode.Alpha0)) { SetKey("0"); return; } if (Input.GetKeyUp(KeyCode.Alpha1)) { SetKey("1"); return; } if (Input.GetKeyUp(KeyCode.Alpha2)) { SetKey("2"); return; } if (Input.GetKeyUp(KeyCode.Alpha3)) { SetKey("3"); return; } if (Input.GetKeyUp(KeyCode.Alpha4)) { SetKey("4"); return; } if (Input.GetKeyUp(KeyCode.Alpha5)) { SetKey("5"); return; } if (Input.GetKeyUp(KeyCode.Alpha6)) { SetKey("6"); return; } if (Input.GetKeyUp(KeyCode.Alpha7)) { SetKey("7"); return; } if (Input.GetKeyUp(KeyCode.Alpha8)) { SetKey("8"); return; } if (Input.GetKeyUp(KeyCode.Alpha9)) { SetKey("9"); return; } //各种功能键 if (Input.GetKeyUp(KeyCode.Tab)) { SetKey("TAB"); return; } if (Input.GetKeyUp(KeyCode.CapsLock)) { SetKey("CAPSLOCK"); return; } if (Input.GetKeyUp(KeyCode.LeftShift)) { SetKey("LSHIFT"); return; } if (Input.GetKeyUp(KeyCode.RightShift)) { SetKey("RSHIFT"); return; } if (Input.GetKeyUp(KeyCode.RightControl)) { SetKey("RCTRL"); return; } if (Input.GetKeyUp(KeyCode.RightAlt)) { SetKey("RALT"); return; } if (Input.GetKeyUp(KeyCode.LeftAlt)) { SetKey("LALT"); return; } if (Input.GetKeyUp(KeyCode.LeftControl)) { SetKey("LCTRL"); return; } //标点符号 if (Input.GetKeyUp(KeyCode.LeftBracket)) { SetKey("["); return; } //[ if (Input.GetKeyUp(KeyCode.RightBracket)) { SetKey("]"); return; } //] if (Input.GetKeyUp(KeyCode.Slash)) { SetKey("/"); return; } /// if (Input.GetKeyUp(KeyCode.Semicolon)) { SetKey(";"); return; } //; if (Input.GetKeyUp(KeyCode.Period)) { SetKey("."); return; } //. if (Input.GetKeyUp(KeyCode.Minus)) { SetKey("-"); return; } //- if (Input.GetKeyUp(KeyCode.Equals)) { SetKey("="); return; } //= //键位设置取消 if (Input.GetKeyUp(KeyCode.Escape)) { isEditing = false; Cursor.visible = true; curEditKeyText.text = lastKey; lastKey = ""; curEditKeyText = null; CustomerKeys.UpdateKeys(); } }
public void CreateCustomerKeys(CustomerKeys customerKeys) { customerKeysRepository.Add(customerKeys); }
public void Update(CustomerKeys customerKeys) { customerKeysRepository.Update(customerKeys); }
public object Process(KeyValueParameter keyValueParameter) { var customerIndexList = new List <CustomerIndexResult>(); string messageSet = string.Empty; bool setHasPartialResult = false; CustomerKeys customerKeys = new CustomerKeys(); List <string> emptyList = new List <string>(); if (keyValueParameter.ReturnMe.CustomerKeys.SequenceEqual(emptyList)) { NoAccessToCusotmerKeys message = new NoAccessToCusotmerKeys(); message.Message = null; return(message); } if (keyValueParameter.AccessControl.CustomerKeyAccess.Count > 0 && keyValueParameter.AccessControl.CustomerKeyAccess.Find(x => x.HasAccess) == null) { NoAccessToCusotmerKeys message = new NoAccessToCusotmerKeys(); message.Message = "You dont' have access CustomerKeys data."; return(message); } try { foreach (var code in keyValueParameter.AccessControl.CustomerKeyAccess) { if (code.HasAccess) { var output = _mciRequestService.GetCustomerAllIndexKeys(keyValueParameter.KeyValue.Key, keyValueParameter.KeyValue.Value, code.Key.ToString()); if ((output != null) && output.Count > 0) { if ((output as List <CustomerIndexResult>)[0].CustomerFound == false) { CustomerFound = false; return(HttpStatusCode.NotFound); } } if (customerIndexList.Count > 0) { customerIndexList.AddRange(output); } else { customerIndexList = output; } } else { setHasPartialResult = customerIndexList.Count > 0; messageSet = string.Format(ErrorMessages.DontHavePermission, code.Key); } } } catch (Exception ex) { _logger.Error("CustomerKeyProcess: " + "ErrorTag: " + ErrorTagProvider.ErrorTag + " -- " + ex.Message, ex); throw new Exception(ex.Message); } List <string> invalidValues = new List <string>(); foreach (var key in keyValueParameter.ReturnMe.CustomerKeys) { if (keyValueParameter.AccessControl.CustomerKeyAccess.Exists(x => x.HasAccess == false && x.Key.ToString() == key)) { invalidValues.Add(key); } GroupCode code; var isValidCode = Enum.TryParse(key, true, out code); if (!isValidCode) { invalidValues.Add(key); } } if (invalidValues.Count > 0) { if (string.IsNullOrEmpty(messageSet)) { messageSet = $"Provided CustomerKey request has invalid value/s '{string.Join(",", invalidValues.ToArray())}'"; } setHasPartialResult = true; } customerKeys.Keys.Message = messageSet; customerKeys.Keys.HasPartialResult = setHasPartialResult; customerKeys.Keys.KeysList = customerIndexList; return(customerKeys); }
public object ProcessForNameAndAddress(NameAndAddressParameter nameAndAddressParameter, KeyValueParameter keyValueParameter = null) { List <string> emptyList = new List <string>(); if (nameAndAddressParameter.ReturnMe.CustomerKeys.SequenceEqual(emptyList)) { NoAccessToCusotmerKeys message = new NoAccessToCusotmerKeys(); message.Message = null; return(message); } else if (nameAndAddressParameter.AccessControl.CustomerKeyAccess.Find(x => x.HasAccess) == null) { NoAccessToCusotmerKeys message = new NoAccessToCusotmerKeys(); message.Message = "You dont' have access CustomerKeys data."; return(message); } if (nameAndAddressParameter == null) { throw new ArgumentException("NameAndAddress cannot be null."); } object customerIndexList = new object(); CustomerKeys keys = new CustomerKeys(); try { var pkey = _mciRequestService.GetPersistantKey(nameAndAddressParameter.NameAndAddress); if (pkey == null || !pkey.HasValue) { keys.Keys.HasPartialResult = false; keys.Keys = null; customerIndexList = keys; } else { if (keyValueParameter == null) { ReturnMeForKeyValuePair returnme = new ReturnMeForKeyValuePair(); returnme.CustomerKeys = nameAndAddressParameter.ReturnMe.CustomerKeys; returnme.MailingHistory = nameAndAddressParameter.ReturnMe.MailingHistory; returnme.Membership = nameAndAddressParameter.ReturnMe.Membership; returnme.Permissions = nameAndAddressParameter.ReturnMe.Permissions; keyValueParameter = new KeyValueParameter { AccessControl = nameAndAddressParameter.AccessControl, ReturnMe = returnme }; } keyValueParameter.KeyValue.Key = "PKEY"; keyValueParameter.KeyValue.Value = pkey.Value.ToString(); // AE : Feb 18 // Call to New self instance ! Replace with direct call to target ley value Process() method // var customerKeyProcess = new CustomerKeyProcess(keyValueParameter, _mciRequestService, // _clientScopeService, _logger); // customerIndexList = customerKeyProcess.Process(); customerIndexList = Process(keyValueParameter); } } catch (Exception ex) { _logger.Error("NameAndAddressStrategy Execute (CustomerKeys) " + "ErrorTag: " + ErrorTagProvider.ErrorTag + " -- " + ex.Message, ex); throw new Exception(ex.Message); } return(customerIndexList); }