public void RemoveContact(Contact entity, Int32 customerId, Int32 companyId) { var ccManager = new CustomerContactManager(this); var cc = new CustomerContact(); cc.ContactId = entity.ContactId; cc.CustomerId = customerId; ccManager.Delete(cc); var contactManager = new ContactManager(this); contactManager.Delete(entity); }
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> /// Loads contacts from the contact list of the customer /// </summary> private void Code_LoadContacts(object sender, EventArgs e) { CustomerContactManager contactManager = this.CustomerSession.ContactManager; if (contactManager != null) { contacts = contactManager.GetContacts(); } else { contacts = new Dictionary <string, ContactInformation>(); } }
/// <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); }