97 lines
3.2 KiB
C#
97 lines
3.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
using WX.CRM.BLL.Base;
|
|
using WX.CRM.BLL.Util;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.Model.Entity;
|
|
|
|
namespace WX.CRM.BLL.Res
|
|
{
|
|
public class RES_USERAPPLYMODULE_BL
|
|
{
|
|
public bool CheckDataByResId(string resid)
|
|
{
|
|
bool relust = false;
|
|
using (crmContext db = new crmContext())
|
|
{
|
|
var obj = db.RES_USERAPPLYMODULE.Where(p => p.RESID.Trim() == resid).ToList();
|
|
|
|
if (obj.Count() > 0)
|
|
{
|
|
relust = true;
|
|
}
|
|
}
|
|
return relust;
|
|
}
|
|
|
|
public bool CheckDataByUserName(string userName, int moduleId)
|
|
{
|
|
bool relust = false;
|
|
using (crmContext db = new crmContext())
|
|
{
|
|
var obj = db.RES_USERAPPLYMODULE.Where(p => p.USERNAME.Trim() == userName && p.MODULEID == moduleId).ToList();
|
|
|
|
if (obj.Count() > 0)
|
|
{
|
|
relust = true;
|
|
}
|
|
}
|
|
return relust;
|
|
}
|
|
|
|
|
|
public bool insertData(RES_USERAPPLYMODULE info)
|
|
{
|
|
using (crmContext db = new crmContext())
|
|
{
|
|
var entry = db.RES_APPLY.FirstOrDefault(m => m.PKID == info.PKID);
|
|
if (entry != null)
|
|
{
|
|
return false;
|
|
}
|
|
info.PKID = new SEQUENCES_BL().Seq_base_get();
|
|
db.RES_USERAPPLYMODULE.Add(info);
|
|
return db.SaveChanges().GetResult();
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// (当手机号不为空时时进入资源系统,等清洗)从接口抓取到的申请模块的客户
|
|
/// </summary>
|
|
/// <param name="mobile">手机号</param>
|
|
/// <param name="tag">注册标签</param>
|
|
/// <param name="cardNo">卡号</param>
|
|
/// <param name="userName">用户名</param>
|
|
/// <param name="regDate">注册时间</param>
|
|
public bool ImportResApply(ValidationErrors err, string mobile, string tag, string cardNo, string userName, DateTime? ctime)
|
|
{
|
|
ValidationErrors errors = new ValidationErrors();
|
|
try
|
|
{
|
|
if (string.IsNullOrEmpty(mobile))
|
|
return true;
|
|
|
|
WX.CRM.Model.Entity.RES_APPLY model = new WX.CRM.Model.Entity.RES_APPLY();
|
|
model.PKID = new Base.SEQUENCES_BL().Seq_base_get(WX.CRM.Model.Enum.PKIDType.LargeTable);
|
|
model.RESOURCETAG = tag;
|
|
model.RESID = Common.ResUtil.CreateResId(mobile);
|
|
model.USERNAME = userName;
|
|
model.JSONDATA = "{'memo:','userApplyModule资源'}";
|
|
model.RTIME = ctime;
|
|
model.JSONTYPE = 1;
|
|
model.STATUS = 0;
|
|
model.MOBILE = mobile.Trim();
|
|
new BLL.Res.RES_APPLY_BL().Create(ref errors, model);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
errors.Add(ex.Message + ex.StackTrace);
|
|
//WX.CRM.Common.LogHelper.Error("----------"+ex.Message + ex.StackTrace);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|