コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (CompanyName != null ? CompanyName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ContactFirstName != null ? ContactFirstName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ContactLastName != null ? ContactLastName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ContactFullName != null ? ContactFullName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ZipCode != null ? ZipCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Email != null ? Email.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #2
0
        protected override void Execute(CodeActivityContext context)
        {
            #region Tracing Object
            //Tracing Object
            ITracingService traceObj = context.GetExtension <ITracingService>();
            #endregion

            #region Workflow Instance
            //Workflow Context Object
            IWorkflowContext workflowConext = context.GetExtension <IWorkflowContext>();
            #endregion

            #region Organization Details
            //Organization Service Factory
            IOrganizationServiceFactory orgServiceFactory = context.GetExtension <IOrganizationServiceFactory>();
            //ORganization Service Context
            IOrganizationService orgServiceConext = orgServiceFactory.CreateOrganizationService(workflowConext.UserId);
            #endregion

            try
            {
                traceObj.Trace("Workflow Starts successfully");

                Entity CreateContactEntity = new Entity("contact");
                CreateContactEntity["firstname"] = ContactFirstName.Get(context);
                CreateContactEntity["lastname"]  = ContactLastName.Get(context);

                CreatedContactId.Set(context, orgServiceConext.Create(CreateContactEntity));

                traceObj.Trace("Workflow End successfully");
            }
            catch (Exception e)
            {
                traceObj.Trace("Workflow Ends with Error");
                throw new InvalidPluginExecutionException("Error it is " + e.Message);
            }
        }