/// <summary> /// Gets this instance. /// </summary> /// <returns>IEnumerable<ILanguage>.</returns> public virtual IEnumerable <ILanguage> Get() { var preferences = preferencesService.Get(); var locales = resourceProvider.GetAvailableLocales(); var currentLocale = !string.IsNullOrWhiteSpace(preferences.Locale) ? preferences.Locale : CurrentLocale.CultureName; var languages = new List <ILanguage>(); foreach (var locale in locales) { languages.Add(InitModel(currentLocale, locale)); } return(languages.OrderBy(p => p.Abrv)); }
/// <summary> /// 订单支付通知 /// </summary> public void POSOrderPaidNotify() { try { Dictionary <string, string> param = HttpUtility.UrlDecode(content).ToDictionary(true); if (!param.ContainsKey("bizseq")) { throw new Exception("bizseq不能为空"); } string bizseq = param["bizseq"]; var orderPaid = iOrderPaidService.Get(t => t.OrderNumber == bizseq); if (orderPaid == null) { throw new Exception("订单不存在:" + bizseq); } //获取支付参数 var preferences = iPreferencesService.Get(t => t.MerchantID == orderPaid.MerchantID); this.vspExec = new VSPExec(preferences.POSBaoMerchant, preferences.POSBaoKey, preferences.APPID); if (vspExec.IsVerify(param))//验签成功 { POSOrderQueryResponse posOrderQueryResponse = JsonHelper.Deserialize <POSOrderQueryResponse>(JsonHelper.Serialize(param)); byte[] bytes = Encoding.GetEncoding("gbk").GetBytes(posOrderQueryResponse.trxreserve ?? ""); //将字符串转成gbk编码的字节数组 posOrderQueryResponse.trxreserve = Encoding.GetEncoding("utf-8").GetString(bytes); //将字节数组转回为字符串 if (posOrderQueryResponse.trxcode == "VSP001" && posOrderQueryResponse.trxstatus == "0000") { //订单支付成功后的平安和光大订单的后续处理 iOrderPaidService.VspOrderHandle(posOrderQueryResponse, orderPaid); Response.Write("success"); } } else { throw new Exception("通知验签失败"); } } catch (Exception ex) { logger.Error(ex.Message); Response.Write("error"); } }
/// <summary> /// Gets this instance. /// </summary> /// <returns>IEnumerable<IGame>.</returns> public virtual IEnumerable <IGame> Get() { var prefs = preferencesService.Get(); var registeredGames = StorageProvider.GetGames(); var gameSettings = StorageProvider.GetGameSettings(); var games = new List <IGame>(); foreach (var item in registeredGames) { var game = InitModel(item, gameSettings.FirstOrDefault(p => p.Type.Equals(item.Name)), prefs.Game); games.Add(game); } return(games.OrderBy(p => p.Type)); }
public ActionResult Create(PreferencesCM m) { var entity = iPreferencesService.Get(m.ID) ?? new Preferences(); try { if (ModelState.IsValid) { entity.MerchantID = currentUser.MerchantID; entity.APPID = m.APPID.Trim(); entity.POSBaoMerchant = m.POSBaoMerchant.Trim(); entity.POSBaoKey = m.POSBaoKey; iPreferencesService.Save(entity); iPreferencesService.Commit(); this.ShowTip(); } else { AddError(); } } catch (Exception ex) { this.AddError(ErrorCode.Exception, ex.Message); } return(RedirectToAction("Create", new { ID = entity.ID })); }
/// <summary> /// Gets this instance. /// </summary> /// <returns>IEnumerable<INotificationPosition>.</returns> public IEnumerable <INotificationPosition> Get() { var preferences = preferencesService.Get(); var registeredItems = StorageProvider.GetNotificationPositions(); var result = new List <INotificationPosition>(); foreach (var item in registeredItems) { var model = InitModel(item, preferences.NotificationPosition); result.Add(model); } EnsureSelection(result, registeredItems); return(result); }
public void GetOrderMsg() { string bizseq = ""; string cusid = ""; RspObj rsp = new RspObj(); for (int i = 0; i < Request.Form.Count; i++) { if (Request.Form.Keys[i] == "bizseq") { bizseq = Request.Form[i].ToString(); } if (Request.Form.Keys[i] == "cusid") { cusid = Request.Form[i].ToString(); } } var orderpaid = iOrderPaidService.Get(t => t.OrderNumber == bizseq); Preferences preferences = iPreferencesService.Get(t => t.POSBaoMerchant == cusid); if (orderpaid == null) { rsp.init("9999", "订单不存在", preferences.APPID, preferences.POSBaoMerchant); rsp.amount = ""; rsp.trxreserve = ""; rsp.bizseq = ""; rsp = BuildSignRspObj(rsp, preferences.POSBaoKey);//签名 Response.Write(JsonHelper.Serialize(rsp)); return; } //Preferences preferences = iPreferencesService.Get(t => t.MerchantID == orderpaid.MerchantID); this.vspExec = new VSPExec(preferences.POSBaoMerchant, preferences.POSBaoKey, preferences.APPID); //获取支付参数 string formString = HttpUtility.UrlDecode(Request.Form.ToString()); Dictionary <String, String> dicReqeust = formString.ToDictionary(true); if (vspExec.IsVerify(dicReqeust))//验签成功 { if (DateTime.Now > orderpaid.Project.Deadline) { rsp.init("9999", "订单已过期", preferences.APPID, preferences.POSBaoMerchant); rsp.amount = "";//由于nettonsoft.json会自动将空字段转化为null,因此手动赋值空字符串 rsp.trxreserve = ""; rsp.bizseq = ""; } else { rsp.init("0000", "查询成功", preferences.APPID, preferences.POSBaoMerchant); rsp.amount = ((int)(orderpaid.TransactionAmount * 100)).ToString(); // rsp.trxreserve = "05(业务类型)##订购人姓名#广州体育西(订购人地址)#15820335584(联系电话)#TN000001#01#440992198709257433(跟踪订单号)####"; rsp.trxreserve = "05##" + orderpaid.Member.Name + "#" + orderpaid.MemberMobile + "#" + orderpaid.OrderNumber + "#######"; //rsp.trxreserve = "05##" + "AAA" + "#" + orderpaid.MemberMobile + "#" + orderpaid.OrderNumber + "#######"; rsp.bizseq = orderpaid.OrderNumber;//业务流水号 } } else //验签失败 { rsp.init("9999", "验签失败", preferences.APPID, preferences.POSBaoMerchant); rsp.amount = "";//由于nettonsoft.json会自动将空字段转化为null,因此手动赋值空字符串 rsp.trxreserve = ""; rsp.bizseq = ""; } rsp = BuildSignRspObj(rsp, preferences.POSBaoKey);//签名 Response.Write(JsonHelper.Serialize(rsp)); }
/// <summary> /// Gets this instance. /// </summary> /// <returns>IPromptNotifications.</returns> public IPromptNotifications Get() { var preferences = preferencesService.Get(); return(Mapper.Map <IPromptNotifications>(preferences)); }
/// <summary> /// Gets this instance. /// </summary> /// <returns>IUpdateSettings.</returns> public virtual IUpdateSettings Get() { var preferences = preferencesService.Get(); return(Mapper.Map <IUpdateSettings>(preferences)); }
public ControllerActionPageViewModel( INavigationService navigationService, ITranslationService translationService, ICreationManager creationManager, IDeviceManager deviceManager, IDialogService dialogService, IPreferencesService preferences, NavigationParameters parameters) : base(navigationService, translationService) { _creationManager = creationManager; _deviceManager = deviceManager; _dialogService = dialogService; _preferences = preferences; ControllerAction = parameters.Get <ControllerAction>("controlleraction", null); ControllerEvent = parameters.Get <ControllerEvent>("controllerevent", null) ?? ControllerAction?.ControllerEvent; var device = _deviceManager.GetDeviceById(ControllerAction?.DeviceId); if (ControllerAction != null && device != null) { SelectedDevice = device; Action.Channel = ControllerAction.Channel; Action.IsInvert = ControllerAction.IsInvert; Action.ChannelOutputType = ControllerAction.ChannelOutputType; Action.MaxServoAngle = ControllerAction.MaxServoAngle; Action.ButtonType = ControllerAction.ButtonType; Action.AxisType = ControllerAction.AxisType; Action.AxisCharacteristic = ControllerAction.AxisCharacteristic; Action.MaxOutputPercent = ControllerAction.MaxOutputPercent; Action.AxisActiveZonePercent = ControllerAction.AxisActiveZonePercent; Action.AxisDeadZonePercent = ControllerAction.AxisDeadZonePercent; Action.ServoBaseAngle = ControllerAction.ServoBaseAngle; Action.StepperAngle = ControllerAction.StepperAngle; Action.SequenceName = ControllerAction.SequenceName; } else { var lastSelectedDeviceId = _preferences.Get <string>("LastSelectedDeviceId", null, "com.scn.BrickController2.ControllerActionPage"); SelectedDevice = _deviceManager.GetDeviceById(lastSelectedDeviceId) ?? _deviceManager.Devices.FirstOrDefault(); Action.Channel = 0; Action.IsInvert = false; Action.ChannelOutputType = ChannelOutputType.NormalMotor; Action.MaxServoAngle = 90; Action.ButtonType = ControllerButtonType.Normal; Action.AxisType = ControllerAxisType.Normal; Action.AxisCharacteristic = ControllerAxisCharacteristic.Linear; Action.MaxOutputPercent = 100; Action.AxisActiveZonePercent = 100; Action.AxisDeadZonePercent = 0; Action.ServoBaseAngle = 0; Action.StepperAngle = 90; Action.SequenceName = string.Empty; } SaveControllerActionCommand = new SafeCommand(async() => await SaveControllerActionAsync(), () => SelectedDevice != null && !_dialogService.IsDialogOpen); SelectDeviceCommand = new SafeCommand(async() => await SelectDeviceAsync()); OpenDeviceDetailsCommand = new SafeCommand(async() => await OpenDeviceDetailsAsync(), () => SelectedDevice != null); SelectChannelOutputTypeCommand = new SafeCommand(async() => await SelectChannelOutputTypeAsync(), () => SelectedDevice != null); OpenChannelSetupCommand = new SafeCommand(async() => await OpenChannelSetupAsync(), () => SelectedDevice != null); SelectButtonTypeCommand = new SafeCommand(async() => await SelectButtonTypeAsync()); SelectSequenceCommand = new SafeCommand(async() => await SelectSequenceAsync()); OpenSequenceEditorCommand = new SafeCommand(async() => await OpenSequenceEditorAsync()); SelectAxisTypeCommand = new SafeCommand(async() => await SelectAxisTypeAsync()); SelectAxisCharacteristicCommand = new SafeCommand(async() => await SelectAxisCharacteristicAsync()); }