static void Main(string[] args) { AddressBook addressBook = AddressBook.GetInstance(); addressBook.UserAdded += new EventHandler(UserAddedEvent); addressBook.UserRemoved += new EventHandler(UserRemovedEvent); ConsoleLogger cl = new ConsoleLogger(); WindowsEventLogger wl = new WindowsEventLogger(); FileLogger fl = new FileLogger(); //Comment if WindowsEventLogger //or FileLogger not working logger = new Loggers(wl); logger = new Loggers(fl); logger = new Loggers(cl); //logger.Debug test logger.Debug("AddressApp started at: "); //Add user for test Users user = new Users(); try { user.LastName = "Barnes"; user.FirstName = "Bill"; user.BirthDate = new DateTime(1990, 1, 18); user.TimeAdded = DateTime.Now; user.City = "Lviv"; user.Address = "ul. Gorodoc'ka, 100"; user.PhoneNumber = "+380951234567"; user.Gender = GenderEnum.Male; user.Email = "*****@*****.**"; addressBook.AddUser(user); } catch (Exception e) { logger.Error(e.Message); } user.ShowUsers(); //Delete user try { string lastName = "Barnes"; addressBook.RemoveUser(lastName); } catch (Exception e) { logger.Error(e.Message); } Console.ReadKey(); logger.Debug("AddressApp closed at: "); }
/// <summary> /// 通知cpos /// </summary> /// <param name="pEntity"></param> /// <param name="msg"></param> /// <param name="ht">附加参数</param> /// <param name="isTonyCard"></param> /// <returns></returns> public static bool Notify(AppOrderEntity pEntity, out string msg, Hashtable ht, bool isTonyCard = false) { string content = string.Format("OrderID={0}&OrderStatus={1}&CustomerID={2}&UserID={3}&ChannelID={4}&SerialPay={5}&isTonyCard={6}", pEntity.AppOrderID, pEntity.Status, pEntity.AppClientID, pEntity.AppUserID, pEntity.PayChannelID, pEntity.OrderID, isTonyCard ? 1 : 0); // 附加参数 if (ht.Count > 0) { foreach (DictionaryEntry item in ht) { content += "&" + item.Key + "=" + item.Value; } } var channelbll = new PayChannelBLL(new JIT.Utility.BasicUserInfo()); var channel = channelbll.GetByID(pEntity.PayChannelID); string notifyUrl = channel.NotifyUrl; Loggers.Debug(new DebugLogInfo() { Message = "wx pay Notify 开始调用通知接口:" + pEntity.ToJSON() }); var i = NotifyHandler.Notify(channel.NotifyUrl, content, out msg); string message = i ? " wx pay Notify 调用通知接口成功" : " wx pay Notify 调用通知接口失败"; message += (":" + msg + "::" + notifyUrl + "?" + content); Loggers.Debug(new DebugLogInfo() { Message = message }); return(i); }
/// <summary> /// /// </summary> /// <param name="orderId"></param> /// <param name="customerId"></param> /// <param name="openId"></param> /// <returns></returns> public static bool NotifyLifePayInfo(string orderId, string customerId, string openId) { try { var notifyUrl = ConfigurationManager.AppSettings["ApiHost"]; string param = "{\"common\": { \"isALD\": \"0\", \"customerId\": \"" + customerId + "\", \"locale\": \"zh\",\"openid\":\"" + openId + "\" }, \"special\": { \"orderId\": \"" + orderId + "\"} }"; string fulParam = string.Format("OnlineShopping/data/Data.aspx?action=getWxPersonInfoByOpenId&ReqContent={0}", param); Loggers.Debug(new DebugLogInfo() { Message = "NotifyLifePayInfo 开始调用通知接口:" + notifyUrl + "?" + fulParam }); string msg = string.Empty; var i = NotifyHandler.Notify(notifyUrl, fulParam, out msg); string message = i ? " NotifyLifePayInfo 调用通知接口成功" : " NotifyLifePayInfo 调用通知接口失败"; message += (":" + notifyUrl + "?" + fulParam + ":" + msg); Loggers.Debug(new DebugLogInfo() { Message = message }); return(i); } catch (Exception ex) { } return(false); }
/// <summary> /// 获取账户余额 /// </summary> /// <param name="hsPara"></param> /// <returns></returns> public DataSet GetMyAccount(Hashtable hsPara) { var parm = new SqlParameter[4]; parm[0] = new SqlParameter("@VipID", System.Data.SqlDbType.NVarChar) { Value = hsPara["MemberID"] }; parm[1] = new SqlParameter("@CustomerID", System.Data.SqlDbType.NVarChar) { Value = hsPara["CustomerID"] }; parm[2] = new SqlParameter("@PageSize", System.Data.SqlDbType.NVarChar) { Value = hsPara["PageSize"] }; parm[3] = new SqlParameter("@PageIndex", System.Data.SqlDbType.NVarChar) { Value = hsPara["PageIndex"] }; Loggers.Debug(new DebugLogInfo() { Message = parm.ToJSON() }); return(this.SQLHelper.ExecuteDataset(CommandType.StoredProcedure, "ProcGetVipAmountDetail", parm)); }
/// <summary> /// 根据订单状态,店员ID获取人人销售订单 /// </summary> public DataSet GetOrderByGroupingTypeEvery(string UserID, int PageIndex, int PageSize, string customer_id, int groupingType) { var parm = new SqlParameter[5]; parm[0] = new SqlParameter("@UserID", System.Data.SqlDbType.NVarChar) { Value = UserID }; parm[1] = new SqlParameter("@CustomerID", System.Data.SqlDbType.NVarChar) { Value = customer_id }; parm[2] = new SqlParameter("@GroupingType", System.Data.SqlDbType.Int) { Value = groupingType }; parm[3] = new SqlParameter("@PageIndex", System.Data.SqlDbType.Int) { Value = PageIndex + 1 }; parm[4] = new SqlParameter("@PageSize", System.Data.SqlDbType.Int) { Value = PageSize }; Loggers.Debug(new DebugLogInfo() { Message = parm.ToJSON() }); return(this.SQLHelper.ExecuteDataset(CommandType.StoredProcedure, "ProcGetUserOrderGrouping", parm)); }
/// <summary> /// 根据类别ID获取阿拉丁分类 /// </summary> /// <returns></returns> protected string GetALDByCategoryId() { var data = this.DeserializeJSONContent <ItemCategoryInfo>(); //同步到ALDCategoryID分类 data.CustomerID, data.Item_Category_Id. data.ALDCategoryID var url = ConfigurationManager.AppSettings["ALDApiURL"].ToString() + "/Gateway.ashx"; var request = new ItemCategory2ALDRequest() { Parameters = data }; var res = new MallALDCategoryEntity();// var resstr = ""; try { resstr = JIT.Utility.Web.HttpClient.GetQueryString(url, string.Format("Action=GetALDByCategoryId&ReqContent={0}", request.ToJSON())); Loggers.Debug(new DebugLogInfo() { Message = "调用获取ALD类别接口:" + resstr }); // res = resstr.DeserializeJSONTo<MallALDCategoryEntity>(); } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); throw new Exception("调用ALD平台失败:" + ex.Message); } return(resstr); }
/// <summary> /// 获取用户是否注册接口 /// </summary> public string GetIsRegistered() { string content = string.Empty; var respData = new GetIsRegisteredRespData(); try { string reqContent = Request["ReqContent"]; var reqObj = reqContent.DeserializeJSONTo <Default.ReqData>(); Loggers.Debug(new DebugLogInfo() { Message = string.Format("GetIsRegistered: {0}", reqContent) }); var loggingSessionInfo = Default.GetLjLoggingSession(); Default.WriteLog(loggingSessionInfo, "GetIsRegistered", reqObj, respData, reqObj.ToJSON()); respData.content = new GetIsRegisteredRespContentData(); VipBLL vipBLL = new VipBLL(loggingSessionInfo); var obj = vipBLL.GetByID(reqObj.common.userId); if (obj != null && obj.Status == 2) { respData.content.IsRegistered = 1; } } catch (Exception ex) { respData.code = "103"; respData.description = "数据库操作错误"; respData.exception = ex.ToString(); } content = respData.ToJSON(); return(content); }
public string TemplateDeleteData() { string content = string.Empty; string error = ""; var responseData = new ResponseData(); string key = string.Empty; if (FormatParamValue(Request("id")) != null && FormatParamValue(Request("id")) != string.Empty) { key = FormatParamValue(Request("id")).ToString().Trim(); } if (key == null || key.Trim().Length == 0) { responseData.success = false; responseData.msg = "活动ID不能为空"; return(responseData.ToJSON()); } Loggers.Debug(new DebugLogInfo() { Message = string.Format("模板标识:{0}", key) }); string[] ids = key.Split(','); MarketTemplateEntity model = new MarketTemplateEntity(); model.TemplateID = key; new MarketTemplateBLL(this.CurrentUserInfo).Delete(model); responseData.success = true; responseData.msg = error; content = responseData.ToJSON(); return(content); }
/// <summary> /// 金额变更 /// </summary> /// <param name="CustomerId">客户标识</param> /// <param name="AmountSourceId">来源</param> /// <param name="VipId">会员标识</param> /// <param name="Amount">金额</param> /// <param name="ObjectId">对象来源</param> /// <param name="remark">说明</param> /// <param name="InOut">添加还是消费:In 或者 Out</param> /// <param name="strError">错误输出</param> /// <param name="tran">批处理</param> /// <returns></returns> public bool SetVipAmountChange(string CustomerId , int AmountSourceId , string VipId , decimal Amount , string ObjectId , string Remark , string InOut , out string strError , System.Data.SqlClient.SqlTransaction tran = null ) { try { strError = "Success!"; bool bReturn = true; Loggers.Debug(new DebugLogInfo() { Message = string.Format("soureId: {0}, customerId: {1}, vipId: {2}, objectId: {3}, point: {4}", AmountSourceId, CustomerId, VipId, ObjectId, Amount) }); #region if (VipId == null || VipId.Equals("")) { strError = "没有会员标识."; return(false); } if (Amount.Equals("")) { strError = "没有金额."; return(false); } if (InOut == null || InOut.Equals("")) { strError = "没有说明是累加还是支出."; return(false); } #endregion #region string result = "0"; result = this._currentDAO.SetVipAmountChange(CustomerId, AmountSourceId, VipId, Amount, ObjectId, Remark, tran, InOut, out strError) ?? "0"; if (result.Equals("0")) { return(bReturn); } else { return(false); } #endregion } catch (Exception ex) { strError = ex.ToString(); return(false); } }
protected override void AjaxRequest(HttpContext pContext) { string content = ""; Loggers.Debug(new DebugLogInfo() { Message = string.Format("method:{0}", pContext.Request.QueryString["method"]) }); switch (pContext.Request.QueryString["method"]) { case "Search": //查询 content = SearchVipCard(); break; case "vipCardUpdateStatus": //修改卡状态 content = SetVipCardStatus(); break; case "templae_save": //修改保存 // content = SaveTemplate(); break; case "GetEventById": //content = GetEventById(); break; } pContext.Response.Write(content); pContext.Response.End(); }
public static bool Notify(string pUrl, string content, out string message) { try { var str = HttpClient.GetQueryString(pUrl, content); Loggers.Debug(new DebugLogInfo() { Message = string.Format("{0}?{1}", pUrl, content) }); if (str == "SUCCESS") { message = "通知成功"; return(true); } else { message = "通知失败:" + str; Loggers.Debug(new DebugLogInfo() { Message = message }); return(false); } } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); message = "通知失败:" + ex.Message; return(false); } }
/// <summary> /// 活动响应 /// </summary> /// <returns></returns> public string GetEventRequestData() { string content = string.Empty; var responseService = new MarketEventResponseBLL(this.CurrentUserInfo); string EventID = FormatParamValue(Request("eventId")); int pageIndex = Utils.GetIntVal(FormatParamValue(Request("page"))) - 1; Loggers.Debug(new DebugLogInfo() { Message = string.Format("EventID:{0}", EventID) }); if (EventID != null && !EventID.Equals("")) { var data = responseService.GetEventResponseInfo(EventID, pageIndex, PageSize); Loggers.Debug(new DebugLogInfo() { Message = string.Format("GetEventRequestData:{0}", data.ToJSON()) }); content = string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", data.MarketEventResponseInfoList.ToJSON(), data.ICount); } return(content); }
private string CreateTonyCardChargeOrder(AppOrderEntity appOrder, string rspData) { string returnStr = "FAIL"; try { var notifyUrl = ConfigurationManager.AppSettings["ApiHost"] + "OnlineShopping/data/Data.aspx"; string param = "{\"common\": { \"isALD\": \"0\", \"customerId\": \"" + appOrder.AppClientID + "\", \"locale\": \"zh\"}, \"special\": { \"orderId\": \"" + appOrder.AppOrderID + "\",\"status\":\"" + (rspData == "SUCCESS" ? "2" : "1") + "\"} }"; string fulParam = string.Format("action=createTonyCardChargeOrder&ReqContent={0}", param); Loggers.Debug(new DebugLogInfo() { Message = "GetTonyCardInfo 开始调用通知接口:" + notifyUrl + "?" + fulParam }); returnStr = HttpService.Get(notifyUrl + "?" + fulParam); string message = returnStr == "SUCCESS" ? " CreateTonyCardChargeOrder调用通知接口成功" : " CreateTonyCardChargeOrder调用通知接口失败"; message += (":" + returnStr); Loggers.Debug(new DebugLogInfo() { Message = message }); return(returnStr); } catch (Exception ex) { } return(returnStr); }
/// <summary> /// 获取code /// </summary> private void GetOAuthCode(string strState) { try { //判断客户ID是否传递 //if (!string.IsNullOrEmpty(Request["customerId"])) //{ // customerId = Request["customerId"]; //} //if (!string.IsNullOrEmpty(Request["applicationId"])) //{ // applicationId = Request["applicationId"]; //} //strState = (((goUrl1).Replace(".", "sb")).Replace("/", "555")).Replace(":", "666") + "sss" + customerId + "sss" + applicationId; //strState = CommonCompress.StringCompress(strState); string url = "http://open.weixin.qq.com/connect/oauth2/authorize?appid=" + strAppId + "&redirect_uri=" + HttpUtility.UrlEncode(strRedirectUri) + "&response_type=code&scope=snsapi_base&state=" + strState + "#wechat_redirect"; //Response.Write(url); Loggers.Debug(new DebugLogInfo() { Message = string.Format("GetOAuthCode: url = {0}", url) }); Response.Redirect(url, false); } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo() { ErrorMessage = string.Format("GetOAuthCode 出错: {0}", ex.ToString()) }); Response.Write("向微信请求认证Code出错,请联系管理员尽快处理."); Response.End(); } }
/// <summary> /// 日结对账统计 /// </summary> /// <param name="StareDate"></param> /// <param name="EndDate"></param> /// <param name="UnitID"></param> /// <returns></returns> public DataSet GetDayReconciliation(DateTime StareDate, DateTime EndDate, string UnitID, string CustomerID) { var parm = new SqlParameter[4]; parm[0] = new SqlParameter("@StareDate", System.Data.SqlDbType.DateTime) { Value = StareDate }; parm[1] = new SqlParameter("@EndDate", System.Data.SqlDbType.DateTime) { Value = EndDate }; parm[2] = new SqlParameter("@UnitID", System.Data.SqlDbType.NVarChar) { Value = UnitID }; parm[3] = new SqlParameter("@CustomerID", System.Data.SqlDbType.NVarChar) { Value = CustomerID }; Loggers.Debug(new DebugLogInfo() { Message = parm.ToJSON() }); return(this.SQLHelper.ExecuteDataset(CommandType.StoredProcedure, "Report_DayReconciliation", parm)); }
/// <summary> /// 多利储值卡充值方法 /// </summary> /// <param name="customerId"></param> /// <param name="orderId"></param> /// <returns></returns> public string RechargeTonysCardAct2(AppOrderEntity appOrder) { try { string msg = string.Empty; var rest = GetTonyCardInfo(appOrder.AppOrderID, appOrder.AppClientID, out msg); if (!rest.Item1) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("多利【{0}】充值异常:{1}", appOrder.AppOrderID, msg), }); } if (rest.Item4 == 0) { // 调用储值卡充值接口 var rspData = RechargeCard(rest.Item2, rest.Item3, appOrder); CreateTonyCardChargeOrder(appOrder, rspData); } } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("多利【{0}】充值异常:" + ex.Message), }); } return("SUCCESS"); }
protected override void AjaxRequest(HttpContext pContext) { string content = ""; Loggers.Debug(new DebugLogInfo() { Message = string.Format("method:{0}", pContext.Request.QueryString["method"]) }); switch (pContext.Request.QueryString["method"]) { case "GetTemplateListByType": //获取模板集合根据类型 content = GetTemplateListByType(); break; case "template_delete": //删除模板 content = TemplateDeleteData(); break; case "templae_save": //修改保存 content = SaveTemplate(); break; case "GetEventById": content = GetEventById(); break; } pContext.Response.Write(content); pContext.Response.End(); }
/// <summary> /// 支付中心通知失败重新通知到业务平台 /// </summary> public void PayCenterNotify() { try { var bll = new AppOrderBLL(new JIT.Utility.BasicUserInfo()); //获取未通知的订单信息 var entitys = bll.GetNotNodify(); Loggers.Debug(new DebugLogInfo() { Message = string.Format("找到{0}条待通知记录", entitys.Length) }); foreach (var item in entitys) { string msg; if (Notify(item, out msg)) { item.IsNotified = true; } else { //设定下次通知时间 item.NextNotifyTime = GetNextNotifyTime(item.NotifyCount ?? 0); } //NotifyCount++ item.NotifyCount++; //更新数据 bll.Update(item); } } catch (Exception ex) { Loggers.Exception(new ExceptionLogInfo(ex)); } }
public PushResponse Process(PushRequest pRequest) { Loggers.Debug(new DebugLogInfo() { Message = pRequest.ToJSON() }); PushResponse response; switch (pRequest.PlatForm) { case 1: AndroidRequestHandler handler1 = new AndroidRequestHandler(); response = handler1.Process(pRequest); break; case 2: IOSRequestHandler handler2 = new IOSRequestHandler(); response = handler2.Process(pRequest); break; default: response = new PushResponse(); response.ResultCode = 100; response.Message = "错误的平台,只支持Android和IOS"; break; } return(response); }
public override bool Process(PayChannelEntity pChannel, HttpContext pContext, out Entity.AppOrderEntity pEntity) { pContext.Response.ContentType = "text/plain"; try { var orderId = pContext.Request["outTradeNo"]; var outTradeNo = pContext.Request.QueryString["outTradeNo"]; Loggers.Debug(new DebugLogInfo() { Message = "outTradeNo:" + outTradeNo }); Loggers.Debug(new DebugLogInfo() { Message = "ChannelID:104&OrderId:" + orderId }); AppOrderBLL bll = new AppOrderBLL(new Utility.BasicUserInfo()); //根据订单号从数据库中找到记录 pEntity = bll.GetByID(orderId); #region 更新订单状态 pEntity.Status = 2; pEntity.ErrorMessage = ""; bll.Update(pEntity); #endregion return(true); } catch (Exception ex) { pEntity = null; Loggers.Exception(new ExceptionLogInfo(ex)); return(false); } }
static void Main(string[] args) { try { string batId = string.Empty; while (true) { Console.WriteLine(string.Format("[{0}]任务开始...", Utils.GetNow())); // to do... Console.WriteLine(string.Format("[{0}]任务结束", Utils.GetNow())); Console.WriteLine(string.Format("".PadLeft(50, '='))); Thread.Sleep(cycleTime); } } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("Exception:", ex.ToString()) }); Console.Write(ex.ToString()); Console.Read(); } }
/// <summary> /// 推送消息 /// </summary> /// <param name="msgUrl">微信调用接口地址譬如:http://IP/ialumni/sendmessage.aspx </param> /// <param name="msgText">推送内容</param> /// <param name="OpenID">客户在微信平台的唯一公众码</param> /// <returns></returns> public bool SetPushServer(string msgUrl, string msgText, string OpenID) { try { #region 推送消息 //string msgUrl = ConfigurationManager.AppSettings["push_weixin_msg_url"].Trim(); //string msgText = string.Format("您推荐的会员刚刚购买了我店商品,为了表示感谢。我们送您积分{0}分。",Convert.ToInt32(integralValue)); string msgData = "<xml><OpenID><![CDATA[" + OpenID + "]]></OpenID><Content><![CDATA[" + msgText + "]]></Content></xml>"; var msgResult = Common.Utils.GetRemoteData(msgUrl, "POST", msgData); #endregion Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPushServer:{0}", msgResult) }); return(true); } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("SetPushServerError:{0}", ex.ToString()) }); return(false); } }
/// <summary> /// 阿里大鱼 /// </summary> /// <param name="pSign"></param> /// <param name="pSMSContent"></param> /// <param name="pMobileNO"></param> /// <param name="pSmsTemplateCode"></param> /// <returns></returns> private static AlibabaAliqinFcSmsNumSendResponse AlidatySendMessage(string pSign, string pSMSContent, string pMobileNO, string pSmsTemplateCode) { string appKey = WebConfigurationManager.AppSettings["AlidayuAppKey"].ToString(); string secret = WebConfigurationManager.AppSettings["AlidayuSecret"].ToString(); string url = WebConfigurationManager.AppSettings["AlidayuURL"].ToString(); //短信发送日志 SMSSendBLL bll = new SMSSendBLL(new JIT.Utility.BasicUserInfo()); ITopClient client = new DefaultTopClient(url, appKey, secret); AlibabaAliqinFcSmsNumSendRequest req = new AlibabaAliqinFcSmsNumSendRequest(); req.SmsType = "normal"; req.SmsFreeSignName = pSign; //签名 req.SmsParam = pSMSContent; req.RecNum = pMobileNO; //手机号 req.SmsTemplateCode = pSmsTemplateCode; AlibabaAliqinFcSmsNumSendResponse rsp = client.Execute(req); string[] temp = pMobileNO.Split(','); foreach (var i in temp) { var entity = new SMSSendEntity() { MobileNO = i, Sign = pSign, }; if (rsp.Result != null) { entity.Status = 1; entity.SendCount = (entity.SendCount ?? 0) + 1; entity.RegularlySendTime = DateTime.Now; var debug = new DebugLogInfo() { Message = "【发送成功】{0}【手机号】:{1}{0}【内容】:{2}{0}【返回码】:{3}".Fmt(Environment.NewLine, entity.MobileNO, rsp.Result.Msg, rsp.Result.ErrCode) }; Loggers.Debug(debug); } else { entity.SendCount = (entity.SendCount ?? 0) + 1; rsp.Result = new BizResult() { ErrCode = rsp.ErrCode, Msg = rsp.SubErrMsg, Success = false, }; var debug = new DebugLogInfo() { Message = "【发送失败】{0}【手机号】:{1}{0}【内容】:{2}{0}【错误信息】:{3}".Fmt(Environment.NewLine, entity.MobileNO, rsp.SubErrCode, rsp.ErrCode) }; Loggers.Debug(debug); } //保存数据库 bll.Create(entity); } return(rsp); }
//处理扫描带参数二维码事件 public virtual void HandlerScan(string eventKey) { var application = new WApplicationInterfaceDAO(requestParams.LoggingSessionInfo); var appEntitys = application.QueryByEntity(new WApplicationInterfaceEntity() { WeiXinID = requestParams.WeixinId }, null); if (appEntitys != null && appEntitys.Length > 0) { var entity = appEntitys.FirstOrDefault(); BaseService.WriteLogWeixin("AppID: " + entity.AppID); BaseService.WriteLogWeixin("AppSecret: " + entity.AppSecret); BaseService.WriteLogWeixin("qrcodeId: " + eventKey); //保存用户信息 // /// <param name="isShow">1: 关注 0: 取消关注</param> //这个里面处理临时二维码的信息的代码(建立员工与会员的上下级关系)** commonService.SaveUserInfo(requestParams.OpenId, requestParams.WeixinId, "1", entity.AppID, entity.AppSecret, eventKey, requestParams.LoggingSessionInfo); #region 微信扫描二维码 回复消息 update by wzq 20140731 var eventsBll = new LEventsBLL(requestParams.LoggingSessionInfo); Loggers.Debug(new DebugLogInfo() { Message = "二维码信息:" + eventKey }); string nodeMsg = string.Empty; foreach (System.Xml.XmlNode item in requestParams.XmlNode.ChildNodes) { nodeMsg += " | " + item.Name + "-" + item.Value; } //加log记录信息看下 2014-11-24 15:57:30 Loggers.Debug(new DebugLogInfo() { Message = "二维码全部信息:" + "~" + requestParams.OpenId + "~" + requestParams.WeixinId + "~" + requestParams.MsgType + "~" + requestParams.XmlNode.ToString() + nodeMsg }); #region 注释备注:扫码时始终会调用保存用户信息接口,这里已经推送了消息 //BaseService.WriteLogWeixin("开始推送消息Wzq"); //处理扫描静态二维码的事件(包含处理上下级关系和推送图文信息) int sendMessageCount = 0; eventsBll.SendQrCodeWxMessage(requestParams.LoggingSessionInfo, requestParams.LoggingSessionInfo.CurrentLoggingManager.Customer_Id, requestParams.WeixinId, eventKey, requestParams.OpenId, this.httpContext, requestParams, out sendMessageCount); //BaseService.WriteLogWeixin("推送消息成功Wzq"); #endregion #endregion } }
/// <summary> /// 更新数据 /// </summary> /// <param name="sql"></param> /// <returns></returns> public int Update(string sql) { Loggers.Debug(new DebugLogInfo() { Message = sql }); return(this.SQLHelper.ExecuteNonQuery(sql)); }
public void GetUserIdByOpenId(string OpenId) { try { Response.Write("<br/>"); //Response.Write("获取用户标识"); string vipId = string.Empty; string status = "0"; VipBLL server = new VipBLL(loggingSessionInfo); var vipObjs = server.QueryByEntity(new VipEntity { WeiXinUserId = OpenId }, null); if (vipObjs == null || vipObjs.Length == 0 || vipObjs[0] == null) { //请求获取用户信息 //Jermyn20130911 从总部导入vip信息 bool bReturn = server.GetVipInfoFromApByOpenId(OpenId, null); var vipObjs1 = server.QueryByEntity(new VipEntity { WeiXinUserId = OpenId }, null); if (vipObjs1 == null || vipObjs1.Length == 0 || vipObjs1[0] == null) { } else { vipId = vipObjs1[0].VIPID; status = vipObjs1[0].Status.ToString(); } } else { vipId = vipObjs[0].VIPID; status = vipObjs[0].Status.ToString(); } //用户不存在或者取消关注,请处理 if (vipId == null || vipId.Equals("") || status.Equals("0")) { Response.Redirect(strNoFollowUrl); } Response.Write("vipId:" + vipId); Response.Write("<br/>"); goUrl = "http://" + HttpUtility.UrlDecode(goUrl) + "?customerId=" + customerId + "&userId=" + vipId + "&openId=" + OpenId + ""; //goUrl = "http://" + HttpUtility.UrlDecode(goUrl) + ""; //string strGotoUrl = "/OnlineClothing/go.htm?customerId=" + customerId + "&openId=" + OpenId + "&userId=" + vipId + "&backUrl=" + HttpUtility.UrlEncode(goUrl) + ""; //Response.Write(goUrl); Response.Redirect(goUrl); } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("GetUserIdByOpenId用户用户信息出错: {0}", ex.ToString()) }); Response.Write("GetUserIdByOpenId用户用户信息出错:" + ex.ToString()); } }
public override bool Process(PayChannelEntity pChannel, HttpContext pContext, out Entity.AppOrderEntity pEntity) { pContext.Response.ContentType = "text/plain"; try { //var WXChannel = pChannel.ChannelParameters.DeserializeJSONTo<WeiXinPayChannel>(); byte[] buffer = new byte[pContext.Request.InputStream.Length]; pContext.Request.InputStream.Read(buffer, 0, (int)pContext.Request.InputStream.Length); string str = Encoding.UTF8.GetString(buffer); Loggers.Debug(new DebugLogInfo() { Message = "WeiXinNotify:" + str }); //微信回调返回的信息*****可用于本地测试 //构建通知对象(反序列化) WeiXinPayHelper.NotifyResult result = new XmlSerializer(typeof(WeiXinPayHelper.NotifyResult)).Deserialize(new MemoryStream(Encoding.UTF8.GetBytes(str.Replace("xml>", "NotifyResult>")))) as WeiXinPayHelper.NotifyResult; Loggers.Debug(new DebugLogInfo() { Message = "交易状态:" + result.result_code + Environment.NewLine + result.ToJSON() }); //把反序列化的数据转换成json数据 //根据通知结果更新订单 AppOrderBLL bll = new AppOrderBLL(new Utility.BasicUserInfo()); Loggers.Debug(new DebugLogInfo() { Message = "WeiXinNotify_result.out_trade_no:" + result.out_trade_no }); //根据订单号从数据库中找到记录 pEntity = bll.GetByID(result.out_trade_no); if (result.result_code == "SUCCESS") { #region 更新订单状态 pEntity.Status = 2; pEntity.ErrorMessage = ""; bll.Update(pEntity); #endregion pContext.Response.Write("<xml><return_code><![CDATA[SUCCESS]]></return_code></xml>"); return(true); } else { pEntity.ErrorMessage = result.err_code_des; bll.Update(pEntity); pContext.Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>"); return(false); } } catch (Exception ex) { pEntity = null; Loggers.Exception(new ExceptionLogInfo(ex)); pContext.Response.Write("<xml><return_code><![CDATA[FAIL]]></return_code></xml>"); return(false); } }
/// <summary> /// 设置用户token信息 /// </summary> /// <param name="UserId">用户标识</param> /// <param name="AccessToken">token不存在</param> private void SetAccessToken(string UserId, string AccessToken, LoggingSessionInfo loggingSessionInfo, string resultErrorUrl) { try { if (UserId == null || UserId.Trim().Equals("")) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("新浪回调页面2-用户标识为空") }); } Response.Write("设置用户token信息1"); #region 处理业务 #region 判断用户是否存在会员表中 VipBLL vipServer = new VipBLL(loggingSessionInfo); VipEntity vipInfo = vipServer.GetByID(UserId); if (vipInfo == null || vipInfo.VIPID == null || vipInfo.VIPID.Equals("")) { vipInfo.VIPID = UserId; vipInfo.VipCode = vipServer.GetVipCode(); vipInfo.ClientID = loggingSessionInfo.CurrentUser.customer_id; vipInfo.Status = 1; vipServer.Create(vipInfo); } #endregion #region 判断用户是否存在会员的新浪微博扩展表中 VipExpandSinaWbBLL vipSinaWbServer = new VipExpandSinaWbBLL(loggingSessionInfo); VipExpandSinaWbEntity vipSinaWbInfo = new VipExpandSinaWbEntity(); vipSinaWbInfo = vipSinaWbServer.GetByID(UserId); if (vipSinaWbInfo != null && vipSinaWbInfo.VipId != null && !vipSinaWbInfo.VipId.Equals("")) { vipSinaWbInfo.AccessToken = AccessToken; vipSinaWbServer.Update(vipSinaWbInfo, false); } else { VipExpandSinaWbEntity vipSinaWbInfo1 = new VipExpandSinaWbEntity(); vipSinaWbInfo1.VipId = UserId; vipSinaWbInfo1.AccessToken = AccessToken; vipSinaWbServer.Create(vipSinaWbInfo1); } #endregion #endregion Loggers.Debug(new DebugLogInfo() { Message = string.Format("新浪回调页面3-设置用户信息成功.") }); } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("新浪回调页面4-错误信息提示 {0}:" + ex.ToString()) }); Response.Write(ex.ToString()); } }
public void SetPushSignIn(string qrcode_id, string WeiXin, string OpenId) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("中欧扫描--关注SetPushSignIn 进入 qrcode_id:{0},WeiXin:{1},OpenId:{2}", qrcode_id, WeiXin, OpenId) }); try { if (qrcode_id == null || qrcode_id.Equals("")) { } else { string eventKey = string.Empty; switch (qrcode_id) { case "1": //MBA课程 eventKey = "K_002001"; break; case "2": //EMBA课程 eventKey = "K_002002"; break; case "3": //FMBA课程 eventKey = "K_002003"; break; case "8": //高层经理培训课程 eventKey = "K_002004"; break; case "9": //捐赠 eventKey = "F0D62CB"; break; case "10": //中欧新闻 eventKey = "991644C"; break; } if (eventKey == null || eventKey.Equals("")) { } else { SetPushModel(eventKey, WeiXin, OpenId); } } } catch (Exception ex) { Loggers.Debug(new DebugLogInfo() { Message = string.Format("中欧扫描--关注SetPushSignIn 进入 错误:{0}", ex.ToString()) }); } }
public void Execute(IJobExecutionContext context) { Console.WriteLine("作业执行2" + DateTime.Now); Loggers.Debug(new DebugLogInfo() { Message = "作业执行2" }); }