98 lines
3.2 KiB
C#
98 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Res;
|
|
using WX.CRM.Model.Entity;
|
|
namespace WX.CRM.BLL.Res
|
|
{
|
|
public class RES_RESOURCEMOBILE_BL : IRES_RESOURCEMOBILE_Q
|
|
{
|
|
string clientid = Utility.GetSettingByKey("CRMClientKey");
|
|
WX.CRM.IBLL.Util.ISecurityHelper sHelper = new SecurityHelper();
|
|
public string GetNumberByResId(string resId)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
RES_RESOURCEMOBILE entry = db.RES_RESOURCEMOBILE.FirstOrDefault(m => m.RESID == resId);
|
|
if (entry == null)
|
|
return "";
|
|
else
|
|
return sHelper.decyptData(clientid, entry.MOBILE);
|
|
}
|
|
}
|
|
|
|
public IDictionary<string, string> GetNumberByResId(string[] resId)
|
|
{
|
|
using (var db = new crmContext())
|
|
{
|
|
var entrys = db.RES_RESOURCEMOBILE.Where(m => resId.Contains(m.RESID));
|
|
IDictionary<string, string> rsts = new Dictionary<string, string>();
|
|
if (entrys != null && entrys.Count() > 0)
|
|
{
|
|
foreach (var entry in entrys)
|
|
{
|
|
if (!rsts.ContainsKey(entry.RESID))
|
|
{
|
|
rsts[entry.RESID] = sHelper.decyptData(clientid, entry.MOBILE);
|
|
}
|
|
}
|
|
}
|
|
return rsts;
|
|
}
|
|
}
|
|
|
|
public IList<string> GetNumberByResIdList(List<string> data)
|
|
{
|
|
var list = new List<string>();
|
|
using (var db = new crmContext())
|
|
{
|
|
foreach (var item in data)
|
|
{
|
|
var entry = db.RES_RESOURCEMOBILE.FirstOrDefault(m => m.RESID == item);
|
|
if (entry == null)
|
|
list.Add("");
|
|
else
|
|
list.Add(sHelper.decyptData(clientid, entry.MOBILE));
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
public IList<string> GetNumberByResIdListNoSql(List<string> data)
|
|
{
|
|
var list = new List<string>();
|
|
|
|
foreach (var item in data)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(item))
|
|
{
|
|
list.Add("");
|
|
continue;
|
|
}
|
|
try
|
|
{
|
|
list.Add(sHelper.decyptData(clientid, item));//直接解密,不需要访问数据库
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
try
|
|
{
|
|
list.Add(sHelper.decyptData("gd_crm", item));//直接解密,不需要访问数据库
|
|
//rsts[entry.RESID] = sHelper.decyptData("gd_crm", entry.MOBILE);
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
LogHelper.Info("号码:" + item);
|
|
LogHelper.Info(e.ToString());
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
return list;
|
|
}
|
|
}
|
|
}
|