ComplianceServer/oldcode/WeChatServerServices/WxDbJob/Rcontact_RK.cs

165 lines
7.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Newtonsoft.Json;
using System;
using WX.CRM.BLL.Base;
using WX.CRM.BLL.Wx;
using WX.CRM.Common;
using WX.CRM.Model.DTO;
using WX.CRM.Model.Entity;
namespace WeChatServerServices.WxDbJob
{
public class Rcontact_RK
{
private WX_WORKACCOUNT_BL workaccountBll = new WX_WORKACCOUNT_BL();
private WX_RCONTACT_BL rcontactBll = new WX_RCONTACT_BL();
private WX_WORKACCOUNT_NOTE_BL workaccount_noteBll = new WX_WORKACCOUNT_NOTE_BL();
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 = new SEQUENCES_BL().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("出错的jobusername:" + info.jobwxusername + ";username" + info.username + ";错误新:" + ex.ToString());
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 = new SEQUENCES_BL().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("出错数据:" + JsonConvert.SerializeObject(info) + ";错误新:" + ex.ToString());
}
return result;
}
}
}