73 lines
2.5 KiB
C#
73 lines
2.5 KiB
C#
using CRM.Core.BLL.Util;
|
||
using CRM.Core.Model.Entity;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using WX.CRM.Common;
|
||
|
||
namespace CRM.Core.BLL.Res
|
||
{
|
||
public class RES_RESOURCEMOBILE_BL : DbContextRepository<RES_RESOURCEMOBILE>
|
||
{
|
||
string clientid = Utility.GetSettingByKey("CRMClientKey");
|
||
SecurityHelper sHelper = new SecurityHelper();
|
||
public string GetNumberByResId(string resId)
|
||
{
|
||
using (var db = new zxdContext())
|
||
{
|
||
RES_RESOURCEMOBILE entry = db.RES_RESOURCEMOBILE.FirstOrDefault(m => m.RESID == resId);
|
||
if (entry == null)
|
||
return "";
|
||
else
|
||
{
|
||
try
|
||
{
|
||
string mobule = sHelper.decyptData(clientid, entry.MOBILE);
|
||
return mobule;
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
string mobule = sHelper.decyptData("gd_crm", entry.MOBILE);
|
||
return mobule;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public IDictionary<string, string> GetNumberByResId(string[] resId)
|
||
{
|
||
using (var db = new zxdContext())
|
||
{
|
||
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))
|
||
{
|
||
try
|
||
{
|
||
rsts[entry.RESID] = sHelper.decyptData(clientid, entry.MOBILE);
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
try
|
||
{
|
||
rsts[entry.RESID] = sHelper.decyptData("gd_crm", entry.MOBILE);
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
LogHelper.Error("错误的客户ID:" + entry.MOBILE);
|
||
continue;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return rsts;
|
||
}
|
||
}
|
||
}
|
||
}
|