Esempio n. 1
0
        public override int GetHashCode()
        {
            int hash = 13;

            hash = (hash * 7) + FromState.GetHashCode();
            hash = (hash * 7) + ToState.GetHashCode();
            return(hash + Cost);
        }
Esempio n. 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (FromState != null ? FromState.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ FromStateId.GetHashCode();
         hashCode = (hashCode * 397) ^ (ToState != null ? ToState.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ ToStateId.GetHashCode();
         hashCode = (hashCode * 397) ^ (PermissionGroups != null ? PermissionGroups.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SkipPermissionGroups.GetHashCode();
         return(hashCode);
     }
 }
        public override int GetHashCode()
        {
            int hashCode = -855846569;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (ReferenceId != null)
            {
                hashCode += ReferenceId.GetHashCode();
            }

            if (FromState != null)
            {
                hashCode += FromState.GetHashCode();
            }

            if (ToState != null)
            {
                hashCode += ToState.GetHashCode();
            }

            if (LocationId != null)
            {
                hashCode += LocationId.GetHashCode();
            }

            if (CatalogObjectId != null)
            {
                hashCode += CatalogObjectId.GetHashCode();
            }

            if (CatalogObjectType != null)
            {
                hashCode += CatalogObjectType.GetHashCode();
            }

            if (Quantity != null)
            {
                hashCode += Quantity.GetHashCode();
            }

            if (TotalPriceMoney != null)
            {
                hashCode += TotalPriceMoney.GetHashCode();
            }

            if (OccurredAt != null)
            {
                hashCode += OccurredAt.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (Source != null)
            {
                hashCode += Source.GetHashCode();
            }

            if (EmployeeId != null)
            {
                hashCode += EmployeeId.GetHashCode();
            }

            if (TransactionId != null)
            {
                hashCode += TransactionId.GetHashCode();
            }

            if (RefundId != null)
            {
                hashCode += RefundId.GetHashCode();
            }

            if (PurchaseOrderId != null)
            {
                hashCode += PurchaseOrderId.GetHashCode();
            }

            if (GoodsReceiptId != null)
            {
                hashCode += GoodsReceiptId.GetHashCode();
            }

            return(hashCode);
        }
Esempio n. 4
0
            public bool CanAutoTrigger()
            {
                var hasTimeTrigger      = TriggerAfter != null;
                var byTimeResult        = false;
                var hasConditionTrigger = AutoTriggerFunction != null;
                var byConditionResult   = false;

                if (hasTimeTrigger)
                {
                    var state    = Workflow.States.FirstOrDefault(x => x.InnerState.GetHashCode() == FromState.GetHashCode());
                    var timeSpan = DateTime.Now.Subtract(state.EntryDate);
                    byTimeResult = timeSpan >= TriggerAfter;
                }


                if (hasConditionTrigger)
                {
                    byConditionResult = AutoTriggerFunction.Invoke();
                }

                if (hasTimeTrigger && hasConditionTrigger)
                {
                    return(byTimeResult && byConditionResult); //pass both
                }
                else
                {
                    return((hasTimeTrigger && byTimeResult) || (hasConditionTrigger && byConditionResult));
                }
            }