795 lines
32 KiB
C#
795 lines
32 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using WX.CRM.BLL.Redis;
|
||
using WX.CRM.BLL.Res;
|
||
using WX.CRM.Common;
|
||
using WX.CRM.DAL.Redis;
|
||
using WX.CRM.IBLL.RedisBL;
|
||
using WX.CRM.Model.Entity;
|
||
using WX.CRM.Model.QueryMap;
|
||
using WX.CRM.Model.Redis;
|
||
|
||
namespace WX.CRM.BLL.RedisBL
|
||
{
|
||
public class ReadOrWriteFromRedis_BL : IReadOrWriteFromRedis
|
||
{
|
||
#region res_customer模块
|
||
|
||
public WX.CRM.Model.Entity.RES_CUSTOMER GetInfo_Res_Customer(string resid, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
bool result = true;
|
||
RES_CUSTOMER rc = null;
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMER>(resid);
|
||
RedisClass<RES_CUSTOMER_REDIS> redis = new RedisClass<RES_CUSTOMER_REDIS>(rediskey);
|
||
RES_RESOURCEMOBILE_BL resResourcemobile = new RES_RESOURCEMOBILE_BL();
|
||
RES_CUSTOMER_REDIS model = redis.Get();
|
||
if (model != null)
|
||
{
|
||
rc = new RES_CUSTOMER();
|
||
rc.RESID = model.RESID;
|
||
rc.CUSTOMERID = model.CUSTOMERID;
|
||
rc.CTIME = model.CTIME;
|
||
rc.CUSTOMERFROM = model.CUSTOMERFROM;
|
||
//rc.LASTNUM3 = model.LASTNUM3;
|
||
PhoneLogModel phoneLogModel = new PhoneLogModel
|
||
{
|
||
Method = System.Reflection.MethodBase.GetCurrentMethod().Name,
|
||
userid = 0
|
||
};
|
||
rc.LASTNUM3 = resResourcemobile.GetNumberByResId(model.RESID, phoneLogModel);
|
||
rc.RES_CUSTOMERDETAIL = GetInfo_Res_CustomerDetail(resid, out result);
|
||
}
|
||
IsSuccess = result;
|
||
return rc;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("GetInfo_Res_Customer错误:" + resid + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public List<WX.CRM.Model.Entity.RES_CUSTOMER> GetList_Res_Customer(string[] resids, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
List<RES_CUSTOMER> list = new List<RES_CUSTOMER>();
|
||
bool result = true;
|
||
foreach (string s in resids)
|
||
{
|
||
var o = GetInfo_Res_Customer(s, out result);
|
||
if (o != null)
|
||
list.Add(o);
|
||
}
|
||
IsSuccess = result;
|
||
return list;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("GetList_Res_Customer错误:" + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public void AddRedis_Res_Customer(RES_CUSTOMER entity, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
RES_CUSTOMER_REDIS rs = new RES_CUSTOMER_REDIS();
|
||
rs.RESID = entity.RESID;
|
||
rs.CUSTOMERID = entity.CUSTOMERID;
|
||
rs.CTIME = entity.CTIME;
|
||
rs.CUSTOMERFROM = entity.CUSTOMERFROM;
|
||
rs.LASTNUM3 = entity.LASTNUM3;
|
||
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMER>(entity.RESID);
|
||
RedisClass<RES_CUSTOMER_REDIS> redis = new RedisClass<RES_CUSTOMER_REDIS>(rediskey);
|
||
redis.Set(rs);
|
||
IsSuccess = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Res_Customer错误:" + entity.RESID + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion res_customer模块
|
||
|
||
#region res_customerdetail模块
|
||
|
||
public RES_CUSTOMERDETAIL GetInfo_Res_CustomerDetail(string resid, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
RES_CUSTOMERDETAIL rd = null;
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMERDETAIL>(resid);
|
||
RedisClass<RES_CUSTOMERDETAIL_REDIS> redis = new RedisClass<RES_CUSTOMERDETAIL_REDIS>(rediskey);
|
||
RES_CUSTOMERDETAIL_REDIS model = redis.Get();
|
||
if (model != null)
|
||
{
|
||
rd = new RES_CUSTOMERDETAIL();
|
||
rd.ADDRESS = model.ADDRESS;
|
||
rd.RESID = model.RESID;
|
||
rd.AMOUNTTYPEID = model.AMOUNTTYPEID;
|
||
rd.BIRTHDAY = model.BIRTHDAY;
|
||
rd.CACCOUNT = model.CACCOUNT;
|
||
rd.CITYID = model.CITYID;
|
||
rd.CNAME = model.CNAME;
|
||
rd.CREATEUSER = model.CREATEUSER;
|
||
rd.CUSTOMERFROMBIG = model.CUSTOMERFROMBIG;
|
||
rd.CUSTOMERTYPEID = model.CUSTOMERTYPEID;
|
||
rd.EMAIL = model.EMAIL;
|
||
rd.FAX = model.FAX;
|
||
rd.GENDER = model.GENDER;
|
||
rd.ISPRIMARYNUM = model.ISPRIMARYNUM;
|
||
rd.JOBTYPEID = model.JOBTYPEID;
|
||
rd.MSN = model.MSN;
|
||
rd.OPERATIONTYPE = model.OPERATIONTYPE;
|
||
rd.PRIMARYNUMBERADDRESS = model.PRIMARYNUMBERADDRESS;
|
||
rd.PROVINCEID = model.PROVINCEID;
|
||
rd.QQ = model.QQ;
|
||
rd.SPECIALMEMO = model.SPECIALMEMO;
|
||
rd.UPDATEUSER = model.UPDATEUSER;
|
||
rd.UTIME = model.UTIME;
|
||
}
|
||
IsSuccess = true;
|
||
return rd;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("GetInfo_Res_CustomerDetail错误:" + resid + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public void AddRedis_Res_CustomerDetail(RES_CUSTOMERDETAIL detail, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
RES_CUSTOMERDETAIL_REDIS rd = new RES_CUSTOMERDETAIL_REDIS();
|
||
rd.ADDRESS = detail.ADDRESS;
|
||
rd.RESID = detail.RESID;
|
||
rd.AMOUNTTYPEID = detail.AMOUNTTYPEID;
|
||
rd.BIRTHDAY = detail.BIRTHDAY;
|
||
rd.CACCOUNT = detail.CACCOUNT;
|
||
rd.CITYID = detail.CITYID;
|
||
rd.CNAME = detail.CNAME;
|
||
rd.CREATEUSER = detail.CREATEUSER;
|
||
rd.CUSTOMERFROMBIG = detail.CUSTOMERFROMBIG;
|
||
rd.CUSTOMERTYPEID = detail.CUSTOMERTYPEID;
|
||
rd.EMAIL = detail.EMAIL;
|
||
rd.FAX = detail.FAX;
|
||
rd.GENDER = detail.GENDER;
|
||
rd.ISPRIMARYNUM = detail.ISPRIMARYNUM;
|
||
rd.JOBTYPEID = detail.JOBTYPEID;
|
||
rd.MSN = detail.MSN;
|
||
rd.OPERATIONTYPE = detail.OPERATIONTYPE;
|
||
rd.PRIMARYNUMBERADDRESS = detail.PRIMARYNUMBERADDRESS;
|
||
rd.PROVINCEID = detail.PROVINCEID;
|
||
rd.QQ = detail.QQ;
|
||
rd.SPECIALMEMO = detail.SPECIALMEMO;
|
||
rd.UPDATEUSER = detail.UPDATEUSER;
|
||
rd.UTIME = detail.UTIME;
|
||
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMERDETAIL>(detail.RESID);
|
||
RedisClass<RES_CUSTOMERDETAIL_REDIS> redis = new RedisClass<RES_CUSTOMERDETAIL_REDIS>(rediskey);
|
||
redis.Set(rd);
|
||
IsSuccess = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Res_CustomerDetail错误:" + detail.RESID + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion res_customerdetail模块
|
||
|
||
#region gjs_customer模块
|
||
|
||
//public Model.Entity.GJS_CUSTOMER GetInfo_Gjs_Customer(string tradecode, out bool IsSuccess)
|
||
//{
|
||
// try
|
||
// {
|
||
// GJS_CUSTOMER g = null;
|
||
// string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<GJS_CUSTOMER>(tradecode);
|
||
// RedisClass<GJS_CUSTOMER_REDIS> redis = new RedisClass<GJS_CUSTOMER_REDIS>(rediskey);
|
||
// GJS_CUSTOMER_REDIS m= redis.Get();
|
||
// if(m!=null)
|
||
// {
|
||
// g = new GJS_CUSTOMER();
|
||
// g.ACTIVATETIME = m.ACTIVATETIME;
|
||
// g.BUSINESSTYPE = m.BUSINESSTYPE;
|
||
// g.CANCELACCOUNTDATE = m.CANCELACCOUNTDATE;
|
||
// g.CLAIMEID = m.CLAIMEID;
|
||
// g.CLAIMTIME = m.CLAIMTIME;
|
||
// g.CREATIONACCOUNTDATE = m.CREATIONACCOUNTDATE;
|
||
// g.CTIME = m.CTIME;
|
||
// g.DEPTCDOE = m.DEPTCDOE;
|
||
// g.IMPORTID = m.IMPORTID;
|
||
// g.ISNEW = m.ISNEW;
|
||
// g.MANAGERUSERID = m.MANAGERUSERID;
|
||
// g.RESID = m.RESID;
|
||
// g.SALEUSERID = m.SALEUSERID;
|
||
// g.SCHEDULESTATUS = m.SCHEDULESTATUS;
|
||
// g.SIGNEDDATE = m.SIGNEDDATE;
|
||
// g.TRADECODE = m.TRADECODE;
|
||
// g.TRADENAME = m.TRADENAME;
|
||
// g.TRADERUSERID = m.TRADERUSERID;
|
||
// g.GJS_CUSTOMERBOCE = GetInfo_Gjs_Customerboce(tradecode);
|
||
// }
|
||
|
||
// IsSuccess = true;
|
||
// return g;
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// IsSuccess = false;
|
||
// LogHelper.Error("GetInfo_Gjs_Customer错误:" + tradecode + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
// return null;
|
||
// }
|
||
//}
|
||
|
||
////public List<Model.Entity.GJS_CUSTOMER> GetList_Gjs_Customer(string[] resids, out bool IsSuccess)
|
||
////{
|
||
//// try
|
||
//// {
|
||
//// List<GJS_CUSTOMER> list = new List<GJS_CUSTOMER>();
|
||
//// bool result = true;
|
||
//// foreach (var resid in resids)
|
||
//// {
|
||
//// string[] tradecodes = new Gjs.GJS_CUSTOMER_BL().GetAllTradeCodeByResid(resid);
|
||
//// if (tradecodes != null && tradecodes.Count() > 0)
|
||
//// {
|
||
//// foreach (var tds in tradecodes)
|
||
//// {
|
||
//// GJS_CUSTOMER model = GetInfo_Gjs_Customer(tds, out result);
|
||
//// if (model != null)
|
||
//// list.Add(model);
|
||
//// }
|
||
//// }
|
||
//// }
|
||
//// IsSuccess = result;
|
||
//// return list;
|
||
//// }
|
||
//// catch (Exception ex)
|
||
//// {
|
||
//// IsSuccess = false;
|
||
//// LogHelper.Error("GetList_Res_Customer错误:" + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
//// return null;
|
||
//// }
|
||
////}
|
||
|
||
//public void AddRedis_Gjs_Customer(GJS_CUSTOMER m, out bool IsSuccess)
|
||
//{
|
||
// try
|
||
// {
|
||
// GJS_CUSTOMER_REDIS g = new GJS_CUSTOMER_REDIS();
|
||
// g.ACTIVATETIME = m.ACTIVATETIME;
|
||
// g.BUSINESSTYPE = m.BUSINESSTYPE;
|
||
// g.CANCELACCOUNTDATE = m.CANCELACCOUNTDATE;
|
||
// g.CLAIMEID = m.CLAIMEID;
|
||
// g.CLAIMTIME = m.CLAIMTIME;
|
||
// g.CREATIONACCOUNTDATE = m.CREATIONACCOUNTDATE;
|
||
// g.CTIME = m.CTIME;
|
||
// g.DEPTCDOE = m.DEPTCDOE;
|
||
// g.IMPORTID = m.IMPORTID;
|
||
// g.ISNEW = m.ISNEW;
|
||
// g.MANAGERUSERID = m.MANAGERUSERID;
|
||
// g.RESID = m.RESID;
|
||
// g.SALEUSERID = m.SALEUSERID;
|
||
// g.SCHEDULESTATUS = m.SCHEDULESTATUS;
|
||
// g.SIGNEDDATE = m.SIGNEDDATE;
|
||
// g.TRADECODE = m.TRADECODE;
|
||
// g.TRADENAME = m.TRADENAME;
|
||
// g.TRADERUSERID = m.TRADERUSERID;
|
||
|
||
// string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<GJS_CUSTOMER>(m.TRADECODE);
|
||
// RedisClass<GJS_CUSTOMER_REDIS> redis = new RedisClass<GJS_CUSTOMER_REDIS>(rediskey);
|
||
// redis.Set(g);
|
||
// IsSuccess = true;
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// IsSuccess = false;
|
||
// LogHelper.Error("AddRedis_Gjs_Customer错误:" + m.TRADECODE + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
// }
|
||
//}
|
||
|
||
#endregion gjs_customer模块
|
||
|
||
#region gjs_customerboce
|
||
|
||
//public Model.Entity.GJS_CUSTOMERBOCE GetInfo_Gjs_Customerboce(string tradecode)
|
||
//{
|
||
// try
|
||
// {
|
||
// GJS_CUSTOMERBOCE g = null;
|
||
// string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<GJS_CUSTOMERBOCE>(tradecode);
|
||
// RedisClass<GJS_CUSTOMERBOCE_REDIS> redis = new RedisClass<GJS_CUSTOMERBOCE_REDIS>(rediskey);
|
||
// GJS_CUSTOMERBOCE_REDIS m = redis.Get();
|
||
// if(m!=null)
|
||
// {
|
||
// g = new GJS_CUSTOMERBOCE();
|
||
// g.ACCOUNTFROM = m.ACCOUNTFROM;
|
||
// g.ACTIVATETIME = m.ACTIVATETIME;
|
||
// g.AMTSTATUS = m.AMTSTATUS;
|
||
// g.AVAILABLEAMT = m.AVAILABLEAMT;
|
||
// g.BANK = m.BANK;
|
||
// g.BANKACCOUNT = m.BANKACCOUNT;
|
||
// g.BOCESTATUS = m.BOCESTATUS;
|
||
// g.CANCELDATE = m.CANCELDATE;
|
||
// g.CARDTYPE = m.CARDTYPE;
|
||
// g.COMMISSIONRATE = m.COMMISSIONRATE;
|
||
// g.CONTRACTSTATUS = m.CONTRACTSTATUS;
|
||
// g.CTIME = m.CTIME;
|
||
// g.CUSTOMERTYPE = m.CUSTOMERTYPE;
|
||
// g.DEPOSITRATIO = m.DEPOSITRATIO;
|
||
// g.FIRSTTRADETIME = m.FIRSTTRADETIME;
|
||
// g.FREEZETIME = m.FREEZETIME;
|
||
// g.IDCARD = m.IDCARD;
|
||
// g.MEDIACY = m.MEDIACY;
|
||
// g.MEDIACYCODE = m.MEDIACYCODE;
|
||
// g.MOBILE_LAST4 = m.MOBILE_LAST4;
|
||
// g.ORGAN = m.ORGAN;
|
||
// g.ORGANCODE = m.ORGANCODE;
|
||
// g.TEL_LAST4 = m.TEL_LAST4;
|
||
// g.TERMINATIONTIME = m.TERMINATIONTIME;
|
||
// g.TRADECODE = m.TRADECODE;
|
||
// g.URGENTCONTACT = m.URGENTCONTACT;
|
||
// g.UTIME = m.UTIME;
|
||
|
||
// }
|
||
// return g;
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// LogHelper.Error("GetInfo_Gjs_Customerboce错误:" + tradecode + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
// return null;
|
||
// }
|
||
//}
|
||
|
||
//public void AddRedis_Gjs_Customerboce(GJS_CUSTOMERBOCE m, out bool IsSuccess)
|
||
//{
|
||
// try
|
||
// {
|
||
// GJS_CUSTOMERBOCE_REDIS g = new GJS_CUSTOMERBOCE_REDIS();
|
||
// g.ACCOUNTFROM = m.ACCOUNTFROM;
|
||
// g.ACTIVATETIME = m.ACTIVATETIME;
|
||
// g.AMTSTATUS = m.AMTSTATUS;
|
||
// g.AVAILABLEAMT = m.AVAILABLEAMT;
|
||
// g.BANK = m.BANK;
|
||
// g.BANKACCOUNT = m.BANKACCOUNT;
|
||
// g.BOCESTATUS = m.BOCESTATUS;
|
||
// g.CANCELDATE = m.CANCELDATE;
|
||
// g.CARDTYPE = m.CARDTYPE;
|
||
// g.COMMISSIONRATE = m.COMMISSIONRATE;
|
||
// g.CONTRACTSTATUS = m.CONTRACTSTATUS;
|
||
// g.CTIME = m.CTIME;
|
||
// g.CUSTOMERTYPE = m.CUSTOMERTYPE;
|
||
// g.DEPOSITRATIO = m.DEPOSITRATIO;
|
||
// g.FIRSTTRADETIME = m.FIRSTTRADETIME;
|
||
// g.FREEZETIME = m.FREEZETIME;
|
||
// g.IDCARD = m.IDCARD;
|
||
// g.MEDIACY = m.MEDIACY;
|
||
// g.MEDIACYCODE = m.MEDIACYCODE;
|
||
// g.MOBILE_LAST4 = m.MOBILE_LAST4;
|
||
// g.ORGAN = m.ORGAN;
|
||
// g.ORGANCODE = m.ORGANCODE;
|
||
// g.TEL_LAST4 = m.TEL_LAST4;
|
||
// g.TERMINATIONTIME = m.TERMINATIONTIME;
|
||
// g.TRADECODE = m.TRADECODE;
|
||
// g.URGENTCONTACT = m.URGENTCONTACT;
|
||
// g.UTIME = m.UTIME;
|
||
|
||
// string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<GJS_CUSTOMERBOCE>(m.TRADECODE);
|
||
// RedisClass<GJS_CUSTOMERBOCE_REDIS> redis = new RedisClass<GJS_CUSTOMERBOCE_REDIS>(rediskey);
|
||
// redis.Set(g);
|
||
// IsSuccess = true;
|
||
// }
|
||
// catch (Exception ex)
|
||
// {
|
||
// IsSuccess = false;
|
||
// LogHelper.Error("AddRedis_Gjs_Customerboce错误:" + m.TRADECODE + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
// }
|
||
//}
|
||
|
||
#endregion gjs_customerboce
|
||
|
||
#region soft_user
|
||
|
||
public WX.CRM.Model.Entity.SOFT_USER GetInfo_Soft_User(string username, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<SOFT_USER>(username);
|
||
RedisClass<SOFT_USER> redis = new RedisClass<SOFT_USER>(rediskey);
|
||
SOFT_USER model = redis.Get();
|
||
IsSuccess = true;
|
||
return model;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("GetInfo_Soft_User错误:" + username + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public List<WX.CRM.Model.Entity.SOFT_USER> GetList_Soft_User(string[] usernames, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
List<SOFT_USER> list = new List<SOFT_USER>();
|
||
bool result = true;
|
||
foreach (string s in usernames)
|
||
{
|
||
var o = GetInfo_Soft_User(s, out result);
|
||
if (o != null)
|
||
list.Add(o);
|
||
}
|
||
IsSuccess = result;
|
||
return list;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("GetList_Soft_User错误:" + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public void AddRedis_Soft_User(WX.CRM.Model.Entity.SOFT_USER entity, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<SOFT_USER>(entity.USERNAME);
|
||
RedisClass<SOFT_USER> redis = new RedisClass<SOFT_USER>(rediskey);
|
||
redis.Set(entity);
|
||
IsSuccess = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Soft_User错误:" + entity.USERNAME + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion soft_user
|
||
|
||
#region res_customeruser_resid
|
||
|
||
public List<RES_CUSTOMERUSER> GetAll_Res_Customeruser(string[] resids, out bool isSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = "";
|
||
List<RES_CUSTOMERUSER> list = new List<RES_CUSTOMERUSER>();
|
||
List<string> strList;
|
||
|
||
foreach (string s in resids)
|
||
{
|
||
strList = new List<string>();
|
||
rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMERUSER_RESID>(s);
|
||
RedisSet<string> redis = new RedisSet<string>(rediskey);
|
||
strList = redis.Members().ToList();
|
||
list.AddRange(strList.Select(m => new RES_CUSTOMERUSER() { PKID = 1, RESID = s, CTIME = DateTime.Now, USERNAME = m }).ToList());
|
||
}
|
||
isSuccess = true;
|
||
return list;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
isSuccess = false;
|
||
LogHelper.Error("GetAll_Res_Customeruser错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public void AddRedis_Res_Customeruser_Resid(string resid, string username, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMERUSER_RESID>(resid);
|
||
RedisSet<string> redis = new RedisSet<string>(rediskey);
|
||
IsSuccess = redis.Add(username);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Res_Customeruser_Resid错误:" + resid + "," + username + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion res_customeruser_resid
|
||
|
||
#region res_customeruser_username
|
||
|
||
public List<RES_CUSTOMERUSER> GetAll_Res_Customeruser_Username(string[] usernames, out bool isSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = "";
|
||
List<RES_CUSTOMERUSER> list = new List<RES_CUSTOMERUSER>();
|
||
List<string> strList;
|
||
|
||
foreach (string s in usernames)
|
||
{
|
||
strList = new List<string>();
|
||
rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMERUSER_USERNAME>(s);
|
||
RedisSet<string> redis = new RedisSet<string>(rediskey);
|
||
strList = redis.Members().ToList();
|
||
list.AddRange(strList.Select(m => new RES_CUSTOMERUSER() { PKID = 1, RESID = m, CTIME = DateTime.Now, USERNAME = s }).ToList());
|
||
}
|
||
isSuccess = true;
|
||
return list;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
isSuccess = false;
|
||
LogHelper.Error("GetAll_Res_Customeruser_Username错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
return null;
|
||
}
|
||
}
|
||
|
||
public void AddRedis_Res_Customeruser_Username(string resid, string username, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CUSTOMERUSER_USERNAME>(username);
|
||
RedisSet<string> redis = new RedisSet<string>(rediskey);
|
||
IsSuccess = redis.Add(resid);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Res_Customeruser_Usernmae错误:" + resid + "," + username + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion res_customeruser_username
|
||
|
||
#region ord_memocontent模块
|
||
|
||
public WX.CRM.Model.Entity.ORD_MEMOCONTENT GetInfo_Ord_Memocontent(decimal contentid)
|
||
{
|
||
string content = double.Parse(contentid.ToString()).ToString();
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<ORD_MEMOCONTENT>(content);
|
||
RedisClass<ORD_MEMOCONTENT> redis = new RedisClass<ORD_MEMOCONTENT>(rediskey, RedisConfig.Redis1);
|
||
ORD_MEMOCONTENT model = redis.Get();
|
||
return model;
|
||
}
|
||
|
||
public void AddRedis_Ord_Memocontent(WX.CRM.Model.Entity.ORD_MEMOCONTENT entity, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<ORD_MEMOCONTENT>(entity.CONTENTID.ToString());
|
||
RedisClass<ORD_MEMOCONTENT> redis = new RedisClass<ORD_MEMOCONTENT>(rediskey, RedisConfig.Redis1);
|
||
redis.Set(entity);
|
||
IsSuccess = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Ord_Memocontent错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
public void DeleteRedis_Ord_Memocontent(decimal contentid, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string contentidStr = double.Parse(contentid.ToString()).ToString();
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<ORD_MEMOCONTENT>(contentidStr);
|
||
RedisClass<ORD_MEMOCONTENT> redis = new RedisClass<ORD_MEMOCONTENT>(rediskey, RedisConfig.Redis1);
|
||
IsSuccess = redis.Del();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("DeleteRedis_Ord_Memocontent错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion ord_memocontent模块
|
||
|
||
#region cache_ord_memo模块
|
||
|
||
public WX.CRM.Model.Entity.CACHE_ORD_MEMO GetInfo_CacheOrdMemo(decimal memoid)
|
||
{
|
||
string memoidStr = double.Parse(memoid.ToString()).ToString();
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<CACHE_ORD_MEMO>(memoidStr);
|
||
RedisClass<CACHE_ORD_MEMO> redis = new RedisClass<CACHE_ORD_MEMO>(rediskey, RedisConfig.Redis1);
|
||
CACHE_ORD_MEMO model = redis.Get();
|
||
return model;
|
||
}
|
||
|
||
public List<ORD_MemoQuery> GetAll_CacheOrdMemo(string customerid, out bool IsSuccess)
|
||
{
|
||
List<ORD_MemoQuery> list = new List<ORD_MemoQuery>();
|
||
try
|
||
{
|
||
string[] residArray = new RES_CUSTOMER_BL().GetAllResidByCustomerId(customerid);
|
||
List<decimal> memoidList = GetAll_MemoId(residArray);
|
||
|
||
ORD_MemoQuery model;
|
||
bool result = true;
|
||
|
||
foreach (decimal s in memoidList)
|
||
{
|
||
var o = GetInfo_CacheOrdMemo(s);
|
||
if (o != null)
|
||
{
|
||
model = new ORD_MemoQuery();
|
||
model.MEMOID = o.MEMOID;
|
||
model.MEMO_TYPE = Convert.ToInt32(o.MTYPEID);
|
||
model.INNERUSERID = o.INNERUSERID;
|
||
model.MEMOSTYLEID = o.MEMOSTYLEID;
|
||
model.MEMOTYPEID = o.MEMOTYPEID;
|
||
model.MEMOSUBTYPEID = o.MEMOSUBTYPEID;
|
||
model.MEMOCONTENTID = o.MEMOCONTENTID;
|
||
model.CTIME = o.CTIME;
|
||
model.CALLTIME = o.CALLTIME;
|
||
model.CALLTIMEEND = o.CALLTIMEEND;
|
||
model.BUSINESSID = o.BUSINESSID;
|
||
model.RESID = o.RESID;
|
||
ORD_MEMOCONTENT content = GetInfo_Ord_Memocontent(o.MEMOCONTENTID.Value);
|
||
model.STRCONTENT = content == null ? "" : content.STRCONTENT;
|
||
|
||
list.Add(model);
|
||
}
|
||
}
|
||
IsSuccess = result;
|
||
return list.OrderByDescending(m => m.CTIME).ToList();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("获取redis工单列表出错:" + ex.ToString() + ex.StackTrace.ToString());
|
||
return list;
|
||
}
|
||
}
|
||
|
||
public void AddRedis_CacheOrdMemo(WX.CRM.Model.Entity.CACHE_ORD_MEMO entity, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<CACHE_ORD_MEMO>(entity.MEMOID.ToString());
|
||
RedisClass<CACHE_ORD_MEMO> redis = new RedisClass<CACHE_ORD_MEMO>(rediskey, RedisConfig.Redis1);
|
||
redis.Set(entity);
|
||
IsSuccess = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_CacheOrdMemo错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
public void DeleteRedis_CacheOrdMemo(decimal memoid, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string memoidStr = double.Parse(memoid.ToString()).ToString();
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<CACHE_ORD_MEMO>(memoidStr);
|
||
RedisHash<CACHE_ORD_MEMO> redis = new RedisHash<CACHE_ORD_MEMO>(rediskey, RedisConfig.Redis1);
|
||
IsSuccess = redis.Del();
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("DeleteRedis_CacheOrdMemo错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
public void UpdateCallTime(decimal memoid, DateTime? calltime, DateTime? calltimeend, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string memostr = double.Parse(memoid.ToString()).ToString();
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<CACHE_ORD_MEMO>(memostr);
|
||
RedisClass<CACHE_ORD_MEMO> redis = new RedisClass<CACHE_ORD_MEMO>(rediskey, RedisConfig.Redis1);
|
||
redis.SetMemberSync("CALLTIME", calltime.HasValue ? calltime.ToString() : "");
|
||
redis.SetMemberSync("CALLTIMEEND", calltimeend.HasValue ? calltimeend.ToString() : "");
|
||
IsSuccess = true;
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("UpdateCallTime错误:" + memoid.ToString() + ":" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion cache_ord_memo模块
|
||
|
||
#region resid_memoid_redis模块
|
||
|
||
public List<decimal> GetAll_MemoId(string[] resids)
|
||
{
|
||
string rediskey = "";
|
||
List<decimal> list = new List<decimal>();
|
||
|
||
foreach (string s in resids)
|
||
{
|
||
rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RESID_MEMOID_REDIS>(s);
|
||
RedisSet<decimal> redis = new RedisSet<decimal>(rediskey, RedisConfig.Redis1);
|
||
list.AddRange(redis.Members().ToList());
|
||
}
|
||
return list;
|
||
}
|
||
|
||
public void AddRedis_Resid_Memoid(string resid, decimal memoid, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RESID_MEMOID_REDIS>(resid);
|
||
RedisSet<string> redis = new RedisSet<string>(rediskey, RedisConfig.Redis1);
|
||
IsSuccess = redis.Add(memoid.ToString());
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("AddRedis_Resid_Memoid错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
public void DeleteRedis_Resid_Memoid(string resid, decimal memoid, out bool IsSuccess)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RESID_MEMOID_REDIS>(resid);
|
||
RedisSet<string> redis = new RedisSet<string>(RedisConfig.Redis1);
|
||
IsSuccess = redis.Remove(rediskey, memoid.ToString());
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
IsSuccess = false;
|
||
LogHelper.Error("DeleteRedis_Resid_Memoid错误:" + ex.ToString() + ex.StackTrace.ToString());
|
||
}
|
||
}
|
||
|
||
#endregion resid_memoid_redis模块
|
||
|
||
#region 出局资源
|
||
|
||
public bool AddRedis_Res_CallOutCustomer(RES_CALLOUTCUSTOMER entity)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CALLOUTCUSTOMER>(entity.RESID + "_" + entity.CALLOUTTYPE);
|
||
RedisHelper redis = new RedisHelper();
|
||
return redis.AddToCache(rediskey, entity);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error("AddRedis_Res_CallOutCustomer错误:" + ex.Message.ToString() + ex.StackTrace.ToString());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
public bool RemoveRedis_Res_CallOutCustomer(string key)
|
||
{
|
||
try
|
||
{
|
||
string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey<RES_CALLOUTCUSTOMER>(key);
|
||
RedisHelper redis = new RedisHelper();
|
||
return redis.DeleteCache(rediskey);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
LogHelper.Error("RemoveRedis_Res_CallOutCustomer错误:" + ex.Message.ToString() + ex.StackTrace.ToString());
|
||
return false;
|
||
}
|
||
}
|
||
|
||
#endregion 出局资源
|
||
}
|
||
} |