Browse Source

关注微信时更新CustomerUser

master
yashen 9 years ago
parent
commit
1587055ebb
1 changed files with 28 additions and 7 deletions
  1. +28
    -7
      B3WeChat.Web/Pages/WeChatReceive.cs

+ 28
- 7
B3WeChat.Web/Pages/WeChatReceive.cs View File

@ -1,13 +1,16 @@
using BWP.B3WeChat.BO;
using BWP.B3WeChat.Entities;
using BWP.B3WeChat.Utils;
using Forks.EnterpriseServices.BusinessInterfaces;
using Forks.EnterpriseServices.DomainObjects2;
using Forks.EnterpriseServices.DomainObjects2.DQuery;
using Forks.EnterpriseServices.SqlDoms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using TSingSoft.WebPluginFramework;
namespace BWP.Web.Pages
{
@ -75,15 +78,33 @@ namespace BWP.Web.Pages
}
static void UpdateQRCode(string sceneId, string OppenId)
{
var update = new DQUpdateDom(typeof(QRCode));
logger.Info("sceneId:" + sceneId + ",OppenId" + OppenId);
update.Where.Conditions.Add(DQCondition.EQ("ID", sceneId));
update.Columns.Add(new DQUpdateColumn("OppenId", OppenId));
using (var session = Dmo.NewSession())
var query = new DmoQuery(typeof(QRCode));
query.Where.Conditions.Add(DQCondition.EQ("ID", sceneId));
query.Range = SelectRange.Top(1);
var scene = query.EExecuteScalar<QRCode>();
var user = new CustomerUser();
user.CustomerCode = scene.Customer;
user.CustomerUsername = scene.UserId;
user.OpenID = OppenId;
using (var context = new TransactionContext())
{
session.ExecuteNonQuery(update);
session.Commit();
context.Session.AddInsertOrUpdate(user);
context.Commit();
}
//var update = new DQUpdateDom(typeof(QRCode));
//logger.Info("sceneId:" + sceneId + ",OppenId" + OppenId);
//update.Where.Conditions.Add(DQCondition.EQ("ID", sceneId));
//update.Columns.Add(new DQUpdateColumn("OppenId", OppenId));
//using (var session = Dmo.NewSession())
//{
// session.ExecuteNonQuery(update);
// session.Commit();
//}
}
}


Loading…
Cancel
Save