public static EntityContact ReadFromDTO(EntityContact target, EntityContactDTO source) { ContactDetailTX.ReadFromDTO(target.ContactDetail, source.ContactDetail); ContactTypeTX.ReadFromDTO(target.ContactType, source.ContactType); EntityTX.ReadFromDTO(target.Entity, source.Entity); target.ContactId = source.ContactId; target.EntityId = source.EntityId; target.ContactTypeId = source.ContactTypeId; target.ModifiedDate = source.ModifiedDate; return(target); }
public static EntityContactDTO WriteToDTO(EntityContact source) { return(new EntityContactDTO { ContactDetail = ContactDetailTX.WriteToDTO(source.ContactDetail), ContactType = ContactTypeTX.WriteToDTO(source.ContactType), Entity = EntityTX.WriteToDTO(source.Entity), ContactId = source.ContactId, EntityId = source.EntityId, ContactTypeId = source.ContactTypeId, ModifiedDate = source.ModifiedDate, }); }
public static int Compare(EntityContact lhs, EntityContactDTO rhs) { if (ReferenceEquals(lhs, null)) { return(-1); } if (ReferenceEquals(rhs, null)) { return(1); } return(lhs.ContactId.CompareTo(lhs.ContactId)); }
internal static Contact Map(EntityContact entity) { return(new Contact { ContactId = entity.ContactId, ContactGuid = entity.ContactGuid, EmployeeId = entity.EmployeeId, LandNumber = entity.LandNumber, MobileNumber = entity.MobileNumber, AddressNo = entity.AddressNo, AddressStreet = entity.AddressStreet, City = entity.City, Province = entity.Province, }); }
public static void ReadContactDetailsFromDTO(ICollection <EntityContact> target, IEnumerable <EntityContactDTO> source) { List <EntityContact> existing = target.ToList(); foreach (EntityContactDTO item in source) { EntityContact found = target.FirstOrDefault(t => EntityContactTX.Compare(t, item) == 0); if (found != null) { EntityContactTX.ReadFromDTO(found, item); existing.Remove(found); continue; } target.Add(EntityContactTX.ReadFromDTO(new EntityContact(), item)); } foreach (EntityContact deleted in existing) { target.Remove(deleted); } }
public async Task <IHttpActionResult> DeleteEntityContact(int contactId) { try { EntityContact found = await DbContext.EntityContacts.FindAsync(contactId); if (found == null) { return(NotFound()); } DbContext.EntityContacts.Remove(found); await DbContext.SaveChangesAsync(); return(Ok(found)); } catch (Exception ex) { Log.Error("EntityContact.Delete: " + ex); throw; } }
public StateAdvertisement(EntityContact entityContact) : base(entityContact.ID) { Appearances = entityContact.Appearances; Velocity = entityContact.Velocity; }
private void ContactResponse_Invoked(Object sender, ExternalDataEventArgs eventArgs) { if (Application == null) { RaiseActivityException("Invalid Application Reference Specified."); } if (Entity == null) { RaiseActivityException("Entity not assigned."); } ContactCanceled = false; if (UserInteractionResponseEventArgs != null) { if (UserInteractionResponseEventArgs.Response != null) { if (UserInteractionResponseEventArgs.Response.UserInteractionType == Mercury.Server.Workflows.UserInteractions.Enumerations.UserInteractionType.ContactEntity) { Mercury.Server.Workflows.UserInteractions.Response.ContactEntityResponse response = (Mercury.Server.Workflows.UserInteractions.Response.ContactEntityResponse)UserInteractionResponseEventArgs.Response; if ((!response.Cancel) || (!AllowCancel)) { if ((response.EntityContact.ContactType != Mercury.Server.Core.Enumerations.EntityContactType.NotSpecified) && (response.EntityContact.ContactOutcome != Mercury.Server.Core.Enumerations.ContactOutcome.NotSpecified)) { #region Contact Received EntityContact = response.EntityContact; EntityContact.Application = Application; if (!AllowEditContactDateTime) { EntityContact.ContactDate = DateTime.Now; } //else { // EntityContact.ContactDate = response.EntityContact.ContactDate; //} //EntityContact.EntityId = Entity.Id; //EntityContact.RelatedEntityId = (response.RelatedEntity != null) ? response.RelatedEntity.Id : 0; //EntityContact.EntityContactInformationId = response.EntityContactInformationId; //EntityContact.Direction = response.Direction; //EntityContact.ContactType = response.ContactType; //EntityContact.ContactOutcome = response.ContactOutcome; //EntityContact.Successful = (response.ContactOutcome == Mercury.Server.Core.Enumerations.ContactOutcome.Success); //EntityContact.Regarding = response.Regarding; //EntityContact.Remarks = response.Remarks; EntityContact.ContactedByName = Application.Session.UserDisplayName; if (AutoSaveContact) { ActivityCompleted = EntityContact.Save(); } else { ActivityCompleted = true; } if (ActivityCompleted) { ContactAttempts = ContactAttempts + 1; Success = EntityContact.Successful; ContactOutcome = EntityContact.ContactOutcome; WorkflowStepsAdd("Contact Outcome: " + ContactOutcome + " | # of Attempts = " + ContactAttempts); } else { RaiseActivityException("Unable to save contact information."); } #endregion } } else { #region Contact Canceled EntityContact = null; ContactCanceled = true; ActivityCompleted = true; #endregion } } } } return; }
public static int Compare(EntityContactDTO lhs, EntityContact rhs) { return(Compare(rhs, lhs) * -1); }
public void CheckForDataSets() { Address address = _dataContext.Addresses.FirstOrDefault(); Assert.IsNotNull(address); AddressType addressType = _dataContext.AddressTypes.FirstOrDefault(); Assert.IsNotNull(addressType); ContactDetail contactDetail = _dataContext.ContactDetails.FirstOrDefault(); Assert.IsNotNull(contactDetail); ContactType contactType = _dataContext.ContactTypes.FirstOrDefault(); Assert.IsNotNull(contactType); Customer customer = _dataContext.Customers.FirstOrDefault(); Assert.IsNotNull(customer); Department department = _dataContext.Departments.FirstOrDefault(); Assert.IsNotNull(department); Employee employee = _dataContext.Employees.FirstOrDefault(); Assert.IsNotNull(employee); EntityAddress entityAddress = _dataContext.EntityAddresses.FirstOrDefault(); Assert.IsNotNull(entityAddress); EntityContact entityContact = _dataContext.EntityContacts.FirstOrDefault(); Assert.IsNotNull(entityContact); Person person = _dataContext.Persons.FirstOrDefault(); Assert.IsNotNull(person); Role role = _dataContext.Roles.FirstOrDefault(); Assert.IsNotNull(role); SalesTerritory salesTerritory = _dataContext.SalesTerritories.FirstOrDefault(); Assert.IsNotNull(salesTerritory); SalesPerson salesPerson = _dataContext.SalesPersons.FirstOrDefault(); Assert.IsNotNull(salesPerson); StateProvince stateProvince = _dataContext.StateProvinces.FirstOrDefault(); Assert.IsNotNull(stateProvince); Store store = _dataContext.Stores.FirstOrDefault(); Assert.IsNotNull(store); }
private EntityContact DefaultValues(EntityContact row) { return row; }
protected override void Execute(CodeActivityContext context) { if (UserInteractionResponse.Get(context) == null) { return; } // VALIDATE RESPONSE WAS RECEIVED, OTHERWISE LOOP REQUEST ActivityCompleted.Set(context, false); ActivityCanceled.Set(context, false); if (UserInteractionResponse.Get(context).UserInteractionType == UserInteractions.Enumerations.UserInteractionType.ContactEntity) { Workflows.UserInteractions.Response.ContactEntityResponse response = (UserInteractions.Response.ContactEntityResponse)UserInteractionResponse.Get(context); if ((!response.Cancel) || (!AllowCancel.Get(context))) { //if ((response.ContactType != Mercury.Server.Core.Enumerations.EntityContactType.NotSpecified) && // (response.ContactOutcome != Mercury.Server.Core.Enumerations.ContactOutcome.NotSpecified)) { if ((response.EntityContact.ContactType != Mercury.Server.Core.Enumerations.EntityContactType.NotSpecified) && (response.EntityContact.ContactOutcome != Mercury.Server.Core.Enumerations.ContactOutcome.NotSpecified)) { #region Contact Received // Core.Entity.EntityContact entityContact = new Mercury.Server.Core.Entity.EntityContact (WorkflowManager.Get (context).Application); Core.Entity.EntityContact entityContact = response.EntityContact; entityContact.Application = WorkflowManager.Get(context).Application; if (!AllowEditContactDateTime.Get(context)) { entityContact.ContactDate = DateTime.Now; } //else { // entityContact.ContactDate = response.EntityContact.ContactDate; //} //entityContact.EntityId = (response.Entity != null) ? response.Entity.Id : 0; //entityContact.RelatedEntityId = (response.RelatedEntity != null) ? response.RelatedEntity.Id : 0; //entityContact.EntityContactInformationId = response.EntityContactInformationId; //entityContact.Direction = response.Direction; //entityContact.ContactType = response.ContactType; //entityContact.ContactOutcome = response.ContactOutcome; //entityContact.Successful = (response.ContactOutcome == Mercury.Server.Core.Enumerations.ContactOutcome.Success); //entityContact.Regarding = response.Regarding; //entityContact.Remarks = response.Remarks; entityContact.ContactedByName = WorkflowManager.Get(context).Application.Session.UserDisplayName; if (AutoSaveContact.Get(context)) { ActivityCompleted.Set(context, entityContact.Save()); } else { ActivityCompleted.Set(context, true); } EntityContact.Set(context, entityContact); if (ActivityCompleted.Get(context)) { ContactAttempts.Set(context, ContactAttempts.Get(context) + 1); ContactSuccess.Set(context, entityContact.Successful); ContactOutcome.Set(context, entityContact.ContactOutcome); Activities.CommonFunctions.WorkflowStepsAdd( WorkflowManager.Get(context).Application, 1, WorkQueueItemId.Get(context), WorkflowSteps.Get(context), "Contact Outcome: " + ContactOutcome.Get(context).ToString() + " | # of Attempts = " + ContactAttempts.Get(context).ToString() ); } else { Activities.CommonFunctions.RaiseActivityException( WorkflowManager.Get(context).Application, 1, WorkQueueItemId.Get(context), WorkflowSteps.Get(context), "Unable to save contact information." ); } #endregion } } else { // CONTACT CANCELED EntityContact.Set(context, null); ActivityCanceled.Set(context, true); ActivityCompleted.Set(context, true); } } }