164 lines
7.1 KiB
C#
164 lines
7.1 KiB
C#
using Ninject;
|
|
using System;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.YunWx;
|
|
using WX.CRM.Model.DTO;
|
|
using WX.CRM.Model.EntityYun;
|
|
using WX.CRM.WebHelper.Infrastructure;
|
|
namespace WxYunService.Wx
|
|
{
|
|
public class Rcontact_RK
|
|
{
|
|
private IYunSEQuences sequencesbll = NinjectControllerFactory.ninjectKernel.Get<IYunSEQuences>();
|
|
private IYunWX_WORKACCOUNT workaccountBll = NinjectControllerFactory.ninjectKernel.Get<IYunWX_WORKACCOUNT>();
|
|
private IYunWX_RCONTACT rcontactBll = NinjectControllerFactory.ninjectKernel.Get<IYunWX_RCONTACT>();
|
|
private IYunWX_WORKACCOUNT_NOTE workaccount_noteBll = NinjectControllerFactory.ninjectKernel.Get<IYunWX_WORKACCOUNT_NOTE>();
|
|
|
|
public bool WxWorkAccount(rcontact info)
|
|
{
|
|
bool result = true;
|
|
try
|
|
{
|
|
var model = workaccountBll.Get(p => p.ALIAS == info.alias);
|
|
if (model != null)
|
|
{
|
|
#region
|
|
model.USERNAME = info.username;
|
|
model.CONREMARK = info.conRemark;
|
|
model.DOMAINLIST = info.domainList;
|
|
model.NICKNAME = info.nickname;
|
|
model.PYINITIAL = info.pyInitial;
|
|
model.QUANPIN = info.quanPin;
|
|
model.SHOWHEAD = info.showHead;
|
|
model.TYPE = info.type;
|
|
model.WEIBOFLAG = info.weiboFlag;
|
|
model.WEIBONICKNAME = info.weiboNickname;
|
|
model.CONREMARKPYFULL = info.conRemarkPYFull;
|
|
model.CONREMARKPYSHORT = info.conRemarkPYShort;
|
|
model.LVBUFF = null;
|
|
model.VERFYFLAG = info.verifyFlag;
|
|
model.ENCRYPTUSERNAME = info.encryptUsername;
|
|
model.CHATROOMFLAG = info.chatroomFlag;
|
|
model.DELETEFLAG = info.deleteFlag;
|
|
model.CONTACTLABELIDS = info.contactLabelIds;
|
|
#endregion
|
|
workaccountBll.Update(model);
|
|
}
|
|
else
|
|
{
|
|
#region 如果不存在插入到 WX_WORKACCOUNT_NOTE
|
|
var wxWorkAccount = new WX_WORKACCOUNT_NOTE()
|
|
{
|
|
PKID = sequencesbll.Seq_base_get(),
|
|
USERNAME = info.username,
|
|
ALIAS = info.alias,
|
|
CONREMARK = info.conRemark,
|
|
DOMAINLIST = info.domainList,
|
|
NICKNAME = info.nickname,
|
|
PYINITIAL = info.pyInitial,
|
|
QUANPIN = info.quanPin,
|
|
SHOWHEAD = info.showHead,
|
|
TYPE = info.type,
|
|
WEIBOFLAG = info.weiboFlag,
|
|
WEIBONICKNAME = info.weiboNickname,
|
|
CONREMARKPYFULL = info.conRemarkPYFull,
|
|
CONREMARKPYSHORT = info.conRemarkPYShort,
|
|
LVBUFF = null,
|
|
VERFYFLAG = info.verifyFlag,
|
|
ENCRYPTUSERNAME = info.encryptUsername,
|
|
CHATROOMFLAG = info.chatroomFlag,
|
|
DELETEFLAG = info.deleteFlag,
|
|
CONTACTLABELIDS = info.contactLabelIds,
|
|
CTIME = DateTime.Now
|
|
};
|
|
workaccount_noteBll.Add(wxWorkAccount);
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result = false;
|
|
LogHelper.Error(ex.ToString());
|
|
}
|
|
return result;
|
|
}
|
|
|
|
public bool WxRcontact(rcontact info)
|
|
{
|
|
bool result = true;
|
|
try
|
|
{
|
|
var rcontact = rcontactBll.Get(p => p.JOBWXUSERNAME == info.jobwxusername && p.USERNAME == info.username);
|
|
if (rcontact != null)
|
|
{
|
|
#region
|
|
rcontact.JOBWXUSERNAME = info.jobwxusername;
|
|
rcontact.USERNAME = info.username;
|
|
rcontact.ALIAS = info.alias;
|
|
rcontact.CONREMARK = info.conRemark;
|
|
rcontact.DOMAINLIST = info.domainList;
|
|
rcontact.NICKNAME = info.nickname;
|
|
rcontact.PYINITIAL = info.pyInitial;
|
|
rcontact.QUANPIN = info.quanPin;
|
|
rcontact.SHOWHEAD = info.showHead;
|
|
rcontact.TYPE = info.type;
|
|
rcontact.WEIBOFLAG = info.weiboFlag;
|
|
rcontact.WEIBONICKNAME = info.weiboNickname;
|
|
rcontact.CONREMARKPYFULL = info.conRemarkPYFull;
|
|
rcontact.CONREMARKPYSHORT = info.conRemarkPYShort;
|
|
rcontact.LVBUFF = null;
|
|
rcontact.VERFYFLAG = info.verifyFlag;
|
|
rcontact.ENCRYPTUSERNAME = info.encryptUsername;
|
|
rcontact.CHATROOMFLAG = info.chatroomFlag;
|
|
rcontact.DELETEFLAG = info.deleteFlag;
|
|
rcontact.CONTACTLABELIDS = info.contactLabelIds;
|
|
rcontact.ISTOBEADDFRIENDS = info.isToBeAddFriends;
|
|
#endregion
|
|
|
|
rcontactBll.Update(rcontact);
|
|
}
|
|
else
|
|
{
|
|
var wxRContact = new WX_RCONTACT
|
|
{
|
|
#region
|
|
PKID = sequencesbll.Seq_base_get(),
|
|
JOBWXUSERNAME = info.jobwxusername,
|
|
USERNAME = info.username,
|
|
ALIAS = info.alias,
|
|
CONREMARK = info.conRemark,
|
|
DOMAINLIST = info.domainList,
|
|
NICKNAME = info.nickname,
|
|
PYINITIAL = info.pyInitial,
|
|
QUANPIN = info.quanPin,
|
|
SHOWHEAD = info.showHead,
|
|
TYPE = info.type,
|
|
WEIBOFLAG = info.weiboFlag,
|
|
WEIBONICKNAME = info.weiboNickname,
|
|
CONREMARKPYFULL = info.conRemarkPYFull,
|
|
CONREMARKPYSHORT = info.conRemarkPYShort,
|
|
LVBUFF = null,
|
|
VERFYFLAG = info.verifyFlag,
|
|
ENCRYPTUSERNAME = info.encryptUsername,
|
|
CHATROOMFLAG = info.chatroomFlag,
|
|
DELETEFLAG = info.deleteFlag,
|
|
CONTACTLABELIDS = info.contactLabelIds,
|
|
RESOURCETAG = null,
|
|
ISTOBEADDFRIENDS = info.isToBeAddFriends,
|
|
CTIME = info.ctime > 0 ? DateTimeTool.GetTimeFromLinuxShortTime(info.ctime) : DateTime.Now
|
|
#endregion
|
|
};
|
|
rcontactBll.Add(wxRContact);
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
result = false;
|
|
LogHelper.Error(ex.ToString());
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
} |