public void AddContact(Contact entity, Int32 companyId, Int32 customerId) { var contactManager = new ContactManager(this); entity.CompanyId = companyId; contactManager.Insert(entity); var ccManager = new CustomerContactManager(this); var cc = new CustomerContact(); cc.CustomerId = customerId; cc.ContactId = entity.ContactId; cc.CompanyId = companyId; ccManager.Insert(cc); }
/// <summary> /// this method add the administrator of new company as contact of host'customer /// </summary> /// <param name="customerId"></param> /// <param name="userId"></param> private void AddContactInHostCustomer(Int32 customerId, Int32 userId) { var contactManager = new ContactManager(this); var customerContactManager = new CustomerContactManager(this); var profileManager = new ProfileManager(this); Profile profile = profileManager.GetProfileByUser(userId); var contact = new Contact { Name = profile.Name, Phone = profile.Phone, CellPhone = profile.CellPhone, Address = profile.Address, AddressComp = profile.AddressComp, AddressNumber = profile.AddressNumber, Email = profile.Email, PostalCode = profile.PostalCode }; contactManager.Insert(contact); var customerContact = new CustomerContact(); customerContact.CompanyId = GetHostCompany().CompanyId; customerContact.ContactId = contact.ContactId; customerContact.CustomerId = customerId; customerContactManager.Insert(customerContact); }