Esempio n. 1
0
        public bool Contains(Region region, Zone zone, Division division, SubDivision subDivision)
        {
            if (!RegionId.HasValue && !ZoneId.HasValue && !DivisionId.HasValue && !SubDivisionId.HasValue) //all regions
                return true;

            if (RegionId.HasValue && region != null && RegionId == region.Id)  //by region
                return true;

            if (ZoneId.HasValue && zone != null && ZoneId == zone.Id)  //by zone
                return true;

            if (DivisionId.HasValue && division != null && DivisionId == division.Id)  //by division
                return true;

            if (SubDivisionId.HasValue && subDivision != null && SubDivisionId == subDivision.Id)  //by division
                return true;

            return false;
        }
Esempio n. 2
0
     private void FixupDivision(Division previousValue, bool skipKeys = false)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.EventAreas.Contains(this))
         {
             previousValue.EventAreas.Remove(this);
         }
 
         if (Division != null)
         {
             if (!Division.EventAreas.Contains(this))
             {
                 Division.EventAreas.Add(this);
             }
 
             DivisionId = Division.Id;
         }
         else if (!skipKeys)
         {
             DivisionId = null;
         }
 
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("Division")
                 && (ChangeTracker.OriginalValues["Division"] == Division))
             {
                 ChangeTracker.OriginalValues.Remove("Division");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("Division", previousValue);
             }
             if (Division != null && !Division.ChangeTracker.ChangeTrackingEnabled)
             {
                 Division.StartTracking();
             }
         }
     }
Esempio n. 3
0
     public bool Equals(Division other)
     {
         if (ReferenceEquals(null, other)) return false;
         if (ReferenceEquals(this, other)) return true;
 		if (other.Id == 0 && Id == 0)
 			return false;
 		else
 			return other.Id == Id;
     }