public void BeginTransactionInsert(Contact t) { using (var conn = _unitOfWork.GetConnection()) { var transaction = _unitOfWork.BeginTransaction(conn); try { t.ContactID = Guid.NewGuid(); _dal.Insert(t); t.ContactID = Guid.NewGuid(); _dal.Insert(t); _unitOfWork.EndTransactionCommit(transaction); } catch (Exception e) { LogFactory.Error(LogType.Sql, System.Reflection.MethodBase.GetCurrentMethod().Name, e.Message); _unitOfWork.EndTransactionRollback(transaction); throw; } finally { transaction.Dispose(); } } }
public AddResultBaseModel <int> Add(AddContactModel model) { string cName = model.Cname; string eName = string.Empty; if (model.Cname.Contains("/")) { eName = model.Cname; cName = string.Empty; } List <ContactInfoEntity> contactInfoEntities = _contactDal.Query <ContactInfoEntity>( n => n.Cid == model.Cid && n.IsDel == "F" && (n.Cname == model.Cname || n.Ename == model.Cname), true) .ToList(); if (contactInfoEntities != null && contactInfoEntities.Count > 0) { List <int> contactId = new List <int>(); contactInfoEntities.ForEach(n => contactId.Add(n.Contactid)); int count = _contactIdentificationDal.Query <ContactIdentificationInfoEntity>( n => contactId.Contains(n.Contactid) && n.CardNo == model.CardNo, true).Count(); if (count > 0) { throw new Exception("当前已经存在该信息"); } } ContactInfoEntity contactInfo = new ContactInfoEntity() { Cname = cName, Ename = eName, Mobile = model.Mobile, Cid = model.Cid, LastUpdateTime = DateTime.Now, IsDel = "F", IsPassenger = model.IsPassenger, UpdateOid = "sys", DelTime = DateTime.Now, Email = model.Email, IsOnline = (model.OrderSource == "O" ? 0 : 1) }; contactInfo = _contactDal.Insert <ContactInfoEntity>(contactInfo); _contactIdentificationDal.Insert <ContactIdentificationInfoEntity>(new ContactIdentificationInfoEntity() { Contactid = contactInfo.Contactid, CardNo = model.CardNo, Iid = model.Iid, LastUpdateTime = DateTime.Now }); return(new AddResultBaseModel <int>() { IsSuccessed = true, Id = contactInfo.Contactid }); }
public IResult Insert(Contact contact) { IResult result = BusinessRules.Run(CheckIfPhoneNumberExists(contact.MobilePhone), CheckIfNull()); if (result != null) { return(result); } _contactDal.Insert(contact); return(new SuccessResult(Messages.ContactAdded)); }
public bool Insert(Contact model) { try { return(contactDal.Insert(model)); } catch (Exception ex) { throw ex; } }
public void ContactAdd(Contact contact) { _contactDal.Insert(contact); }
public void ContactAddBL(Contact contact) => _contactDal.Insert(contact);
public void AddContact(Contact contact) { _contactDal.Insert(contact); }
public void Add(Contact entity) { _contactDal.Insert(entity); }
public void ContactAdd(Contact contact) { _Contactdal.Insert(contact); }
public void CategoryAdd(Contact contact) { _contactDal.Insert(contact); }