Ejemplo n.º 1
0
 public virtual void StartTracking()
 {
     if (ChangeTracker.ChangeTrackingEnabled)
     {
         return;
     }
     ChangeTracker.ChangeTrackingEnabled = true;
     if (DashboardNote != null)
     {
         DashboardNote.StartTracking();
     }
 }
Ejemplo n.º 2
0
        public virtual object Clone(Dictionary <object, object> clonedObjects, bool includePrimaryKey)
        {
            DashboardNote cloned = new DashboardNote();

            clonedObjects.Add(this, cloned);
            if (includePrimaryKey)
            {
                cloned._id = this._id;
            }
            cloned._text    = this._text;
            cloned._color   = this._color;
            cloned._roles   = this._roles;
            cloned._startDt = this._startDt;
            cloned._endDt   = this._endDt;
            cloned._audit_CreatorUserName      = this._audit_CreatorUserName;
            cloned._audit_CreatorIP            = this._audit_CreatorIP;
            cloned._audit_CreateDate           = this._audit_CreateDate;
            cloned._audit_LastModifyDate       = this._audit_LastModifyDate;
            cloned._audit_LastModifierUserName = this._audit_LastModifierUserName;
            cloned._audit_LastModifierIP       = this._audit_LastModifierIP;

            if (DashboardUserNotes != null)
            {
                cloned.DashboardUserNotes = new TrackableCollection <DashboardUserNote>();
                foreach (DashboardUserNote item in DashboardUserNotes)
                {
                    if (!clonedObjects.ContainsKey(item))
                    {
                        cloned.DashboardUserNotes.Add((DashboardUserNote)item.Clone(clonedObjects, includePrimaryKey));
                    }
                    else
                    {
                        cloned.DashboardUserNotes.Add((DashboardUserNote)clonedObjects[item]);
                    }
                }
            }


            return(cloned);
        }
Ejemplo n.º 3
0
        private void FixupDashboardNote(DashboardNote previousValue)
        {
            if (IsDeserializing)
            {
                return;
            }

            if (previousValue != null && previousValue.DashboardUserNotes.Contains(this))
            {
                previousValue.DashboardUserNotes.Remove(this);
            }

            if (DashboardNote != null)
            {
                if (!DashboardNote.DashboardUserNotes.Contains(this))
                {
                    DashboardNote.DashboardUserNotes.Add(this);
                }

                NoteId = DashboardNote.Id;
            }
            if (ChangeTracker.ChangeTrackingEnabled)
            {
                if (ChangeTracker.OriginalValues.ContainsKey("DashboardNote") &&
                    (ChangeTracker.OriginalValues["DashboardNote"] == DashboardNote))
                {
                    ChangeTracker.OriginalValues.Remove("DashboardNote");
                }
                else
                {
                    ChangeTracker.RecordOriginalValue("DashboardNote", previousValue);
                }
                if (DashboardNote != null && !DashboardNote.ChangeTracker.ChangeTrackingEnabled)
                {
                    DashboardNote.StartTracking();
                }
            }
        }
Ejemplo n.º 4
0
        public virtual bool Equals(object other, List <object> checked_objects)
        {
            if (checked_objects.Contains(this))
            {
                return(true);
            }

            checked_objects.Add(this);

            DashboardNote casted_other = other as DashboardNote;

            if (casted_other == null)
            {
                checked_objects.Remove(this);
                return(false);
            }

            if (!Typing.IsEquals(this.Id, casted_other.Id))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Text, casted_other.Text))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Color, casted_other.Color))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Roles, casted_other.Roles))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.StartDt, casted_other.StartDt))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.EndDt, casted_other.EndDt))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Audit_CreatorUserName, casted_other.Audit_CreatorUserName))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Audit_CreatorIP, casted_other.Audit_CreatorIP))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Audit_CreateDate, casted_other.Audit_CreateDate))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Audit_LastModifyDate, casted_other.Audit_LastModifyDate))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Audit_LastModifierUserName, casted_other.Audit_LastModifierUserName))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (!Typing.IsEquals(this.Audit_LastModifierIP, casted_other.Audit_LastModifierIP))
            {
                checked_objects.Remove(this);
                return(false);
            }
            if (this.DashboardUserNotes.Count != casted_other.DashboardUserNotes.Count)
            {
                checked_objects.Remove(this);
                return(false);
            }
            List <int> DashboardUserNotes_compared = new List <int>(this.DashboardUserNotes.Count);

            for (int i = 0; i < this.DashboardUserNotes.Count; ++i)
            {
                if (this.DashboardUserNotes[i] != null)
                {
                    bool found = false;
                    for (int j = 0; j < this.DashboardUserNotes.Count; ++j)
                    {
                        if (DashboardUserNotes_compared.Contains(j))
                        {
                            continue;
                        }
                        if (this.DashboardUserNotes[i].Equals(casted_other.DashboardUserNotes[j], checked_objects))
                        {
                            DashboardUserNotes_compared.Add(j);
                            found = true;
                            break;
                        }
                    }
                    if (!found)
                    {
                        checked_objects.Remove(this);
                        return(false);
                    }
                }
                else
                {
                    for (int j = 0; j < this.DashboardUserNotes.Count; ++j)
                    {
                        if (DashboardUserNotes_compared.Contains(j))
                        {
                            continue;
                        }
                        if (casted_other.DashboardUserNotes[j] == null)
                        {
                            DashboardUserNotes_compared.Add(j);
                            break;
                        }
                    }
                }
            }

            if (DashboardUserNotes_compared.Distinct().Count() != this.DashboardUserNotes.Count)
            {
                checked_objects.Remove(this);
                return(false);
            }

            checked_objects.Remove(this);

            return(true);
        }