예제 #1
0
 public void AddGlobalError(string errortxt)
 {
     using (var wxdb = new WXDBEntity())
     {
         wxdb.Global_Error.Add(new Global_Error {
             Content = errortxt, CreateDate = DateTime.Now
         });
         wxdb.SaveChanges();
     }
 }
예제 #2
0
 /// <summary>
 /// 记录转化请求对象的数据
 /// </summary>
 /// <param name="requeststr">请求字符串</param>
 /// <param name="failjson">转换对象失败的json串</param>
 /// <returns></returns>
 public int AddRequestParserFail(string requeststr, string failjson)
 {
     using (var wxdb = new WXDBEntity())
     {
         wxdb.WX_RequestParserFail.Add(new WX_RequestParserFail {
             RequestXML = requeststr, RequestJson = failjson, CreateDate = DateTime.Now
         });
         return(wxdb.SaveChanges());
     }
 }
예제 #3
0
 /// <summary>
 /// 添加回复信息记录
 /// </summary>
 /// <param name="data">回复实体</param>
 /// <param name="requestid">回复的请求id</param>
 /// <param name="responsexml">回复json串</param>
 /// <returns></returns>
 public int AddResponseMsgLog(BaseResponseData data, int requestid, string responsexml)
 {
     using (var wxdb = new WXDBEntity())
     {
         WX_ResponseMsgLog log = new WX_ResponseMsgLog();
         log.ToUserName   = data.ToUserName;
         log.FromUserName = data.FromUserName;
         log.CreateTime   = data.CreateTime;
         log.MsgType      = data.MsgType;
         log.RequestId    = requestid;
         log.ResponseXML  = responsexml;
         log.CreateDate   = DateTime.Now;
         wxdb.WX_ResponseMsgLog.Add(log);
         wxdb.SaveChanges();
         return(log.Id);
     }
 }
예제 #4
0
 /// <summary>
 /// 添加请求信息记录
 /// </summary>
 /// <param name="data">信息实体</param>
 /// <param name="json">信息json串</param>
 /// <returns></returns>
 public int AddRequestMsgLog(BaseRequestData data, string json, string requestxml)
 {
     using (var wxdb = new WXDBEntity())
     {
         WX_RequestMsgLog log = new WX_RequestMsgLog();
         log.ToUserName   = data.ToUserName;
         log.FromUserName = data.FromUserName;
         log.CreateTime   = data.CreateTime;
         log.MsgType      = data.MsgType;
         log.MsgId        = data.MsgId;
         log.RequestJson  = json;
         log.RequestXML   = requestxml;
         log.CreateDate   = DateTime.Now;
         wxdb.WX_RequestMsgLog.Add(log);
         wxdb.SaveChanges();
         return(log.Id);
     }
 }
예제 #5
0
 /// <summary>
 /// 更新accesstoken 并返回最新的保存成功的
 /// </summary>
 /// <param name="accesstoken"></param>
 /// <returns>accesstoken</returns>
 public string UpdataAccess_token(string accesstoken)
 {
     using (var wxdb = new WXDBEntity())
     {
         var model = wxdb.WX_Access_token.SingleOrDefault();
         if (model == null)
         {
             model = new WX_Access_token();
             wxdb.WX_Access_token.Add(model);
         }
         model.access_token = accesstoken;
         model.updatedate   = DateTime.Now;
         var result = wxdb.SaveChanges();
         if (result > 0)
         {
             return(accesstoken);
         }
         return(string.Empty);
     }
 }