private void callBackResultMethod(CallBackModel callBackModel) { if (callBackModel.Success) { zamknijOkno(); // wywołanie zdarzenia po zamknięciu okna OnCompletedTask(); if (!string.IsNullOrEmpty(callBackModel.Message)) { MessageBox.Show(callBackModel.Message); } } else { if (!string.IsNullOrEmpty(callBackModel.Message)) { MessageBox.Show(callBackModel.Message); } else { MessageBox.Show("Coś poszło nie tak"); } } }
public void AddCallBackToDB(CallBackModel model) { using (var context = new CallBackContext()) { model.Date = DateTime.Now; context.CallBackModels.Add(model); context.SaveChanges(); } }
/// <summary> ///回调页面 /// </summary> /// <returns></returns> public ActionResult CallBackUrl(string code) { try { var url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx5da57aa47edf8eb8&secret=253cf3aa5bd73d13146c610e055a007d&code=" + code + "&grant_type=authorization_code";//获取access_token和openid请求链接 string resp = WebToRequest.PushToWeb(url); CallBackModel cb = JSONHelper.DeserializeJsonToObject <CallBackModel>(resp); #region 数据操作 //此处可进行数据相互相关代码 #endregion return(View()); } catch (Exception) { throw; } }
public async Task <IActionResult> Post([FromBody] CallBackModel callBack) { await _callBackRepository.Create(callBack.Phone, callBack.Reason); var chatId = _apiSettings.Value.TelegramChatId; #pragma warning disable 4014 _botClient.SendTextMessageAsync(new ChatId(chatId), #pragma warning restore 4014 $"*Callback!*\n" + $"_Phone_: *{callBack.Phone}*\n" + $"_Reason_: {callBack.Reason}", ParseMode.Markdown); return(Ok()); }
protected void Page_Load(object sender, EventArgs e) { try { if (!IsPostBack) { var code = Request["code"]; var url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx5da57aa47edf8eb8&secret=253cf3aa5bd73d13146c610e055a007d&code=" + code + "&grant_type=authorization_code";//获取access_token和openid请求链接 string resp = WebToRequest.PushToWeb(url); CallBackModel cb = JSONHelper.DeserializeJsonToObject <CallBackModel>(resp); #region 数据操作 //此处可进行数据相互相关代码 #endregion } } catch (Exception) { throw; } }
private void callBackResultMethod(CallBackModel callBackModel) { if (callBackModel.Success) { if (!string.IsNullOrEmpty(callBackModel.Message)) { MessageBox.Show(callBackModel.Message); } refreshListView(); } else { if (!string.IsNullOrEmpty(callBackModel.Message)) { MessageBox.Show(callBackModel.Message); } else { MessageBox.Show("Coś poszło nie tak"); } } }
private bool sendMsg(string message, int?progress) { IMQFactory factory = null; if (!mFactory.TryGetTarget(out factory)) { return(false); } HpSchedulerJob.NET.Foundation.Log.i(String.Format("Task({0}) ::: send message = {1}, progress = {2}", this.taskid, message, progress == null ? "null" : progress.ToString())); try { CallBackModel callback = new CallBackModel() { task_id = this.taskid, message = message, progress = progress, time = DateTimeUtil.timestamp(DateTime.Now)// DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") }; var jsonstr = JsonConvert.SerializeObject(callback); using (var producer = factory.CreateMqProducer(routingkey)) { producer.sendMessage(jsonstr); } return(true); } catch (Exception ex) { HpSchedulerJob.NET.Foundation.Log.e(ex); return(false); } }
public JsonResult AddCallBack(CallBackModel model) { _callBackService.AddCallBackToDB(model); return(Json(new { success = true })); }