private bool InsertCustomerContactToDb(DMCustomerContact customerContact, Guid userGuid) { var contact = (DMCustomerContact)MapperHelper.SetDefaultValueToNullProperty(customerContact); var entity = MapCustomerContactToCoreCustomerContact(contact, userGuid); _customerContactService.Add(entity); return(true); }
private DMCustomerContact EnableDisableDeleteCustomerContact(DMCustomerContact customerContact, Guid customerContactGuid) { var action = customerContact.Action.ToLower(); if (action == ImportAction.Delete.ToString().ToLower()) { var result = DeleteCustomerContact(customerContactGuid); customerContact.Reason = "Deleted Successfully"; } else if (action == ImportAction.Enable.ToString().ToLower()) { var result = EnableDisableCustomerContact(true, customerContactGuid); customerContact.Reason = "Enabled Successfully"; } else { var result = EnableDisableCustomerContact(false, customerContactGuid); customerContact.Reason = "Disabled Successfully"; } customerContact.ImportStatus = Core.Entities.ImportStatus.Success.ToString(); return(customerContact); }
private Core.Entities.CustomerContact MapCustomerContactToCoreCustomerContact(DMCustomerContact customerContact, Guid userGuid) { customerContactEntity = new Entities.CustomerContact(); customerContactEntity.ContactGuid = Guid.NewGuid(); customerContactEntity.FirstName = customerContact.FirstName.Trim(); customerContactEntity.MiddleName = customerContact.MiddleName.Trim(); customerContactEntity.LastName = customerContact.LastName.Trim(); customerContactEntity.PhoneNumber = customerContact.PhoneNumber; customerContactEntity.AltPhoneNumber = customerContact.AltPhoneNumber; customerContactEntity.EmailAddress = customerContact.EmailAddress; customerContactEntity.AltEmailAddress = customerContact.AltEmailAddress; customerContactEntity.CustomerGuid = customerContact.CustomerGuid; customerContactEntity.ContactTypeGuid = customerContact.ContactTypeGuid; customerContactEntity.CreatedOn = DateTime.UtcNow; customerContactEntity.IsActive = true; customerContactEntity.IsDeleted = false; customerContactEntity.CreatedBy = userGuid; customerContactEntity.UpdatedBy = userGuid; customerContactEntity.UpdatedOn = DateTime.UtcNow; return(customerContactEntity); }