using CRM.Core.BLL.Util; using System; using WX.CRM.Common; namespace CRM.Core.Res { public class RES_APPLY_BL { string clientid = Utility.GetSettingByKey("CRMClientKey"); CRM.Core.BLL.Util.SecurityHelper sHelper = new SecurityHelper(); ValidationErrors errors = new ValidationErrors(); public bool Create(ref ValidationErrors errors, CRM.Core.Model.Entity.RES_APPLY model) { try { //LogHelper.Error("g----------------------------------------------------" + sHelper.encyptData(clientid, model.MOBILE)); using (var db = new CRM.Core.Model.Entity.zxdContext()) { //var entry = db.RES_APPLY.FirstOrDefault(m => m.PKID == model.PKID); //if (entry != null) //{ // errors.Add("该编码已经被占用!"); // return false; //} model.CTIME = DateTime.Now; model.ENMOBILE = Utility.NumberFormat(model.MOBILE); model.MOBILE = sHelper.encyptData(clientid, model.MOBILE); db.RES_APPLY.Add(model); return db.SaveChanges().GetResult(); } } catch (Exception ex) { errors.Add(ex.Message); LogHelper.Error(ex.Message + "|" + ex.StackTrace); return false; } } } }