예제 #1
0
 /// <summary>
 /// Queries the device contacts database and returns one or more Contact objects, each containing the fields specified.
 /// </summary>
 /// <param name="contactFields">Contact fields to be used as search qualifier. Only these fields will have values in the resulting Contact objects. [Required]</param>
 /// <param name="contactSuccess">Success callback function that is invoked with the contacts returned from the contacts database. [Required]</param>
 /// <param name="contactError">Error callback function. Invoked when error occurs. [Optional]</param>
 /// <param name="contactFindOptions">Search options to filter contacts. [Optional]</param>
 /// <returns>Contains properties that describe a contact, such as a user's personal or business contact.</returns>
 public Contact find(JsArray<JsString> contactFields, ContactSuccess contactSuccess, ContactError contactError, ContactFindOptions contactFindOptions) { return null; }
예제 #2
0
        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);
                }
            }
        }