using System.Linq; using WX.CRM.BLL.Base; using WX.CRM.IBLL.Sms; using WX.CRM.Model.Entity; namespace WX.CRM.BLL.Sms { public class SMS_FROMEMAIL_BL : ISMS_FROMEMAIL { public void Insert(SMS_FROMEMAIL model) { using (var db = new WX.CRM.Model.Entity.crmContext()) { var o = db.SMS_FROMEMAIL.FirstOrDefault(p => p.TRADECODE == model.TRADECODE); if (o != null) return; if (string.IsNullOrEmpty(model.TRADECODE) || string.IsNullOrEmpty(model.TRADEPWD)) return; model.PKID = new SEQUENCES_BL().Seq_base_get(); db.SMS_FROMEMAIL.Add(model); db.SaveChanges(); } } } }