ComplianceServer/oldcode/Core.BLL/Res/RES_RESOURCEMOBILE_BL.cs

73 lines
2.5 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 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;
}
}
}
}