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(resid); RedisClass redis = new RedisClass(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; rc.LASTNUM3 = resResourcemobile.GetNumberByResId(model.RESID); 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 GetList_Res_Customer(string[] resids, out bool IsSuccess) { try { List list = new List(); 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(entity.RESID); RedisClass redis = new RedisClass(rediskey); redis.Set(rs); IsSuccess = true; } catch (Exception ex) { IsSuccess = false; LogHelper.Error("AddRedis_Res_Customer错误:" + entity.RESID + ":" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #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(resid); RedisClass redis = new RedisClass(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(detail.RESID); RedisClass redis = new RedisClass(rediskey); redis.Set(rd); IsSuccess = true; } catch (Exception ex) { IsSuccess = false; LogHelper.Error("AddRedis_Res_CustomerDetail错误:" + detail.RESID + ":" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #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(tradecode); // RedisClass redis = new RedisClass(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 GetList_Gjs_Customer(string[] resids, out bool IsSuccess) ////{ //// try //// { //// List list = new List(); //// 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(m.TRADECODE); // RedisClass redis = new RedisClass(rediskey); // redis.Set(g); // IsSuccess = true; // } // catch (Exception ex) // { // IsSuccess = false; // LogHelper.Error("AddRedis_Gjs_Customer错误:" + m.TRADECODE + ":" + ex.ToString() + ex.StackTrace.ToString()); // } //} #endregion #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(tradecode); // RedisClass redis = new RedisClass(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(m.TRADECODE); // RedisClass redis = new RedisClass(rediskey); // redis.Set(g); // IsSuccess = true; // } // catch (Exception ex) // { // IsSuccess = false; // LogHelper.Error("AddRedis_Gjs_Customerboce错误:" + m.TRADECODE + ":" + ex.ToString() + ex.StackTrace.ToString()); // } //} #endregion #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(username); RedisClass redis = new RedisClass(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 GetList_Soft_User(string[] usernames, out bool IsSuccess) { try { List list = new List(); 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(entity.USERNAME); RedisClass redis = new RedisClass(rediskey); redis.Set(entity); IsSuccess = true; } catch (Exception ex) { IsSuccess = false; LogHelper.Error("AddRedis_Soft_User错误:" + entity.USERNAME + ":" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #region res_customeruser_resid public List GetAll_Res_Customeruser(string[] resids, out bool isSuccess) { try { string rediskey = ""; List list = new List(); List strList; foreach (string s in resids) { strList = new List(); rediskey = WX.CRM.Model.Redis.KeysDic.GetKey(s); RedisSet redis = new RedisSet(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(resid); RedisSet redis = new RedisSet(rediskey); IsSuccess = redis.Add(username); } catch (Exception ex) { IsSuccess = false; LogHelper.Error("AddRedis_Res_Customeruser_Resid错误:" + resid + "," + username + ":" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #region res_customeruser_username public List GetAll_Res_Customeruser_Username(string[] usernames, out bool isSuccess) { try { string rediskey = ""; List list = new List(); List strList; foreach (string s in usernames) { strList = new List(); rediskey = WX.CRM.Model.Redis.KeysDic.GetKey(s); RedisSet redis = new RedisSet(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(username); RedisSet redis = new RedisSet(rediskey); IsSuccess = redis.Add(resid); } catch (Exception ex) { IsSuccess = false; LogHelper.Error("AddRedis_Res_Customeruser_Usernmae错误:" + resid + "," + username + ":" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #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(content); RedisClass redis = new RedisClass(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(entity.CONTENTID.ToString()); RedisClass redis = new RedisClass(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(contentidStr); RedisClass redis = new RedisClass(rediskey, RedisConfig.Redis1); IsSuccess = redis.Del(); } catch (Exception ex) { IsSuccess = false; LogHelper.Error("DeleteRedis_Ord_Memocontent错误:" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #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(memoidStr); RedisClass redis = new RedisClass(rediskey, RedisConfig.Redis1); CACHE_ORD_MEMO model = redis.Get(); return model; } public List GetAll_CacheOrdMemo(string customerid, out bool IsSuccess) { List list = new List(); try { string[] residArray = new RES_CUSTOMER_BL().GetAllResidByCustomerId(customerid); List 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(entity.MEMOID.ToString()); RedisClass redis = new RedisClass(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(memoidStr); RedisHash redis = new RedisHash(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(memostr); RedisClass redis = new RedisClass(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 #region resid_memoid_redis模块 public List GetAll_MemoId(string[] resids) { string rediskey = ""; List list = new List(); foreach (string s in resids) { rediskey = WX.CRM.Model.Redis.KeysDic.GetKey(s); RedisSet redis = new RedisSet(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); RedisSet redis = new RedisSet(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); RedisSet redis = new RedisSet(RedisConfig.Redis1); IsSuccess = redis.Remove(rediskey, memoid.ToString()); } catch (Exception ex) { IsSuccess = false; LogHelper.Error("DeleteRedis_Resid_Memoid错误:" + ex.ToString() + ex.StackTrace.ToString()); } } #endregion #region 出局资源 public bool AddRedis_Res_CallOutCustomer(RES_CALLOUTCUSTOMER entity) { try { string rediskey = WX.CRM.Model.Redis.KeysDic.GetKey(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(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 } }