/// <summary> /// Internal use /// </summary> public ShortMessageAttachment ShallowCopy(bool allData = false, bool preserveState = false) { ShortMessageAttachment e = new ShortMessageAttachment(); e.StartAutoUpdating = false; e.ID = ID; e.DataLastModified = DataLastModified; if (preserveState) { e.IsDataLastModifiedModified = IsDataLastModifiedModified; } else { e.IsDataLastModifiedModified = false; } e.DataLink = DataLink; if (preserveState) { e.IsDataLinkModified = IsDataLinkModified; } else { e.IsDataLinkModified = false; } e.DataMimeType = DataMimeType; if (preserveState) { e.IsDataMimeTypeModified = IsDataMimeTypeModified; } else { e.IsDataMimeTypeModified = false; } e.MessageID = MessageID; if (allData) { e.MsgData = MsgData; if (preserveState) { e.IsMsgDataModified = IsMsgDataModified; } else { e.IsMsgDataModified = false; } } e.DistinctString = GetDistinctString(true); e.IsPersisted = IsPersisted; if (preserveState) { e.IsEntityChanged = IsEntityChanged; } else { e.IsEntityChanged = false; } e.StartAutoUpdating = true; return(e); }
/// <summary> /// <see cref="ShortMessageDataBlock.ShortMessageAttachmentRef" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="ShortMessageDataBlock.DelLoadShortMessageAttachmentRef" /> was setup /// before calling it. /// </summary> public void LoadShortMessageAttachmentRef() { if (_ShortMessageAttachmentRef != null) { return; } if (DelLoadShortMessageAttachmentRef != null) { _ShortMessageAttachmentRef = DelLoadShortMessageAttachmentRef(); } }
/// <summary> /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) intrinsic identifiers. /// </summary> /// <param name="other">The entity to be compared to.</param> /// <returns> /// The result of comparison. /// </returns> public bool IsEntityTheSame(ShortMessageAttachment other) { if (other == null) { return(false); } else { return(ID == other.ID); } }
/// <summary> /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) primary key(s). /// </summary> /// <param name="other">The entity to be compared to.</param> /// <returns> /// The result of comparison. /// </returns> public bool IsEntityIdentical(ShortMessageAttachment other) { if (other == null) { return(false); } if (ID != other.ID) { return(false); } return(true); }
/// <summary> /// Update changes to the current entity compared to an input <paramref name="newdata" /> and set the entity to a proper state for updating. /// </summary> /// <param name="newdata">The "new" entity acting as the source of the changes, if any.</param> /// <returns> /// </returns> public void UpdateChanges(ShortMessageAttachment newdata) { int cnt = 0; if (CompletedSize != newdata.CompletedSize) { CompletedSize = newdata.CompletedSize; IsCompletedSizeModified = true; cnt++; } if (DataMimeType != newdata.DataMimeType) { DataMimeType = newdata.DataMimeType; IsDataMimeTypeModified = true; cnt++; } if (FileName != newdata.FileName) { FileName = newdata.FileName; IsFileNameModified = true; cnt++; } if (ContentSize != newdata.ContentSize) { ContentSize = newdata.ContentSize; IsContentSizeModified = true; cnt++; } if (DataLastModified != newdata.DataLastModified) { DataLastModified = newdata.DataLastModified; IsDataLastModifiedModified = true; cnt++; } if (DataLink != newdata.DataLink) { DataLink = newdata.DataLink; IsDataLinkModified = true; cnt++; } if (RelativePath != newdata.RelativePath) { RelativePath = newdata.RelativePath; IsRelativePathModified = true; cnt++; } IsEntityChanged = cnt > 0; }
/// <summary> /// Update changes to the current entity compared to an input <paramref name="newdata" /> and set the entity to a proper state for updating. /// </summary> /// <param name="newdata">The "new" entity acting as the source of the changes, if any.</param> /// <returns> /// </returns> public void UpdateChanges(ShortMessageAttachment newdata) { int cnt = 0; if (DataLastModified != newdata.DataLastModified) { DataLastModified = newdata.DataLastModified; IsDataLastModifiedModified = true; cnt++; } if (DataLink != newdata.DataLink) { DataLink = newdata.DataLink; IsDataLinkModified = true; cnt++; } if (DataMimeType != newdata.DataMimeType) { DataMimeType = newdata.DataMimeType; IsDataMimeTypeModified = true; cnt++; } bool bMsgData = MsgData == null && newdata.MsgData != null || MsgData != null && newdata.MsgData == null || MsgData != null && newdata.MsgData != null && MsgData.Length != newdata.MsgData.Length; if (!bMsgData && MsgData != null) { for (int i = 0; i < MsgData.Length; i++) { bMsgData = MsgData[i] != newdata.MsgData[i]; if (bMsgData) { break; } } } if (bMsgData) { MsgData = newdata.MsgData; IsMsgDataModified = true; cnt++; } IsEntityChanged = cnt > 0; }
/// <summary> /// Merge changes inside entity <paramref name="from" /> to the entity <paramref name="to" />. Any changes in <paramref name="from" /> that is not changed in <paramref name="to" /> is updated inside <paramref name="to" />. /// </summary> /// <param name="from">The "old" entity acting as merging source.</param> /// <param name="to">The "new" entity which inherits changes made in <paramref name="from" />.</param> /// <returns> /// </returns> public static void MergeChanges(ShortMessageAttachment from, ShortMessageAttachment to) { if (to.IsPersisted) { if (from.IsDataLastModifiedModified && !to.IsDataLastModifiedModified) { to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = true; } if (from.IsDataLinkModified && !to.IsDataLinkModified) { to.DataLink = from.DataLink; to.IsDataLinkModified = true; } if (from.IsDataMimeTypeModified && !to.IsDataMimeTypeModified) { to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = true; } if (from.IsMsgDataModified && !to.IsMsgDataModified) { to.MsgData = from.MsgData; to.IsMsgDataModified = true; } } else { to.IsPersisted = from.IsPersisted; to.ID = from.ID; to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = from.IsDataLastModifiedModified; to.DataLink = from.DataLink; to.IsDataLinkModified = from.IsDataLinkModified; to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = from.IsDataMimeTypeModified; to.MsgData = from.MsgData; to.IsMsgDataModified = from.IsMsgDataModified; to.MessageID = from.MessageID; } }
/// <summary> /// Merge changes inside entity <paramref name="from" /> to the entity <paramref name="to" />. Any changes in <paramref name="from" /> that is not changed in <paramref name="to" /> is updated inside <paramref name="to" />. /// </summary> /// <param name="from">The "old" entity acting as merging source.</param> /// <param name="to">The "new" entity which inherits changes made in <paramref name="from" />.</param> /// <returns> /// </returns> public static void MergeChanges(ShortMessageAttachment from, ShortMessageAttachment to) { if (to.IsPersisted) { if (from.IsDataLastModifiedModified && !to.IsDataLastModifiedModified) { to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = true; } if (from.IsDataLinkModified && !to.IsDataLinkModified) { to.DataLink = from.DataLink; to.IsDataLinkModified = true; } if (from.IsDataMimeTypeModified && !to.IsDataMimeTypeModified) { to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = true; } if (from.IsMsgDataModified && !to.IsMsgDataModified) { to.MsgData = from.MsgData; to.IsMsgDataModified = true; } } else { to.IsPersisted = from.IsPersisted; to.ID = from.ID; to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = from.IsDataLastModifiedModified; to.DataLink = from.DataLink; to.IsDataLinkModified = from.IsDataLinkModified; to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = from.IsDataMimeTypeModified; to.MsgData = from.MsgData; to.IsMsgDataModified = from.IsMsgDataModified; to.MessageID = from.MessageID; } }
/// <summary> /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) intrinsic identifiers. /// </summary> /// <param name="other">The entity to be compared to.</param> /// <returns> /// The result of comparison. /// </returns> public bool IsEntityTheSame(ShortMessageAttachment other) { if (other == null) return false; else return ID == other.ID; }
/// <summary> /// Whether or not the present entity is identitical to <paramref name="other" />, in the sense that they have the same (set of) primary key(s). /// </summary> /// <param name="other">The entity to be compared to.</param> /// <returns> /// The result of comparison. /// </returns> public bool IsEntityIdentical(ShortMessageAttachment other) { if (other == null) return false; if (ID != other.ID) return false; return true; }
/// <summary> /// <see cref="ShortMessageDataBlock.ShortMessageAttachmentRef" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="ShortMessageDataBlock.DelLoadShortMessageAttachmentRef" /> was setup /// before calling it. /// </summary> public void LoadShortMessageAttachmentRef() { if (_ShortMessageAttachmentRef != null) return; if (DelLoadShortMessageAttachmentRef != null) _ShortMessageAttachmentRef = DelLoadShortMessageAttachmentRef(); }
/// <summary> /// Internal use /// </summary> public ShortMessageAttachment ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false) { ShortMessageAttachment e = new ShortMessageAttachment(); e.StartAutoUpdating = false; e.ID = ID; e.ContentBlockSize = ContentBlockSize; e.DataCreateDate = DataCreateDate; e.IsDataVirtual = IsDataVirtual; e.CompletedSize = CompletedSize; if (preserveState) e.IsCompletedSizeModified = IsCompletedSizeModified; else e.IsCompletedSizeModified = false; e.DataMimeType = DataMimeType; if (preserveState) e.IsDataMimeTypeModified = IsDataMimeTypeModified; else e.IsDataMimeTypeModified = false; e.FileName = FileName; if (preserveState) e.IsFileNameModified = IsFileNameModified; else e.IsFileNameModified = false; e.ContentSize = ContentSize; if (preserveState) e.IsContentSizeModified = IsContentSizeModified; else e.IsContentSizeModified = false; e.DataLastModified = DataLastModified; if (preserveState) e.IsDataLastModifiedModified = IsDataLastModifiedModified; else e.IsDataLastModifiedModified = false; e.DataLink = DataLink; if (preserveState) e.IsDataLinkModified = IsDataLinkModified; else e.IsDataLinkModified = false; e.RelativePath = RelativePath; if (preserveState) e.IsRelativePathModified = IsRelativePathModified; else e.IsRelativePathModified = false; e.MessageID = MessageID; e.DistinctString = GetDistinctString(true); e.IsPersisted = IsPersisted; if (preserveState) e.IsEntityChanged = IsEntityChanged; else e.IsEntityChanged = false; e.StartAutoUpdating = true; return e; }
/// <summary> /// Update changes to the current entity compared to an input <paramref name="newdata" /> and set the entity to a proper state for updating. /// </summary> /// <param name="newdata">The "new" entity acting as the source of the changes, if any.</param> /// <returns> /// </returns> public void UpdateChanges(ShortMessageAttachment newdata) { int cnt = 0; if (CompletedSize != newdata.CompletedSize) { CompletedSize = newdata.CompletedSize; IsCompletedSizeModified = true; cnt++; } if (DataMimeType != newdata.DataMimeType) { DataMimeType = newdata.DataMimeType; IsDataMimeTypeModified = true; cnt++; } if (FileName != newdata.FileName) { FileName = newdata.FileName; IsFileNameModified = true; cnt++; } if (ContentSize != newdata.ContentSize) { ContentSize = newdata.ContentSize; IsContentSizeModified = true; cnt++; } if (DataLastModified != newdata.DataLastModified) { DataLastModified = newdata.DataLastModified; IsDataLastModifiedModified = true; cnt++; } if (DataLink != newdata.DataLink) { DataLink = newdata.DataLink; IsDataLinkModified = true; cnt++; } if (RelativePath != newdata.RelativePath) { RelativePath = newdata.RelativePath; IsRelativePathModified = true; cnt++; } IsEntityChanged = cnt > 0; }
/// <summary> /// Merge changes inside entity <paramref name="from" /> to the entity <paramref name="to" />. Any changes in <paramref name="from" /> that is not changed in <paramref name="to" /> is updated inside <paramref name="to" />. /// </summary> /// <param name="from">The "old" entity acting as merging source.</param> /// <param name="to">The "new" entity which inherits changes made in <paramref name="from" />.</param> /// <returns> /// </returns> public static void MergeChanges(ShortMessageAttachment from, ShortMessageAttachment to) { if (to.IsPersisted) { if (from.IsCompletedSizeModified && !to.IsCompletedSizeModified) { to.CompletedSize = from.CompletedSize; to.IsCompletedSizeModified = true; } if (from.IsDataMimeTypeModified && !to.IsDataMimeTypeModified) { to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = true; } if (from.IsFileNameModified && !to.IsFileNameModified) { to.FileName = from.FileName; to.IsFileNameModified = true; } if (from.IsContentSizeModified && !to.IsContentSizeModified) { to.ContentSize = from.ContentSize; to.IsContentSizeModified = true; } if (from.IsDataLastModifiedModified && !to.IsDataLastModifiedModified) { to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = true; } if (from.IsDataLinkModified && !to.IsDataLinkModified) { to.DataLink = from.DataLink; to.IsDataLinkModified = true; } if (from.IsRelativePathModified && !to.IsRelativePathModified) { to.RelativePath = from.RelativePath; to.IsRelativePathModified = true; } } else { to.IsPersisted = from.IsPersisted; to.ID = from.ID; to.ContentBlockSize = from.ContentBlockSize; to.DataCreateDate = from.DataCreateDate; to.IsDataVirtual = from.IsDataVirtual; to.CompletedSize = from.CompletedSize; to.IsCompletedSizeModified = from.IsCompletedSizeModified; to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = from.IsDataMimeTypeModified; to.FileName = from.FileName; to.IsFileNameModified = from.IsFileNameModified; to.ContentSize = from.ContentSize; to.IsContentSizeModified = from.IsContentSizeModified; to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = from.IsDataLastModifiedModified; to.DataLink = from.DataLink; to.IsDataLinkModified = from.IsDataLinkModified; to.RelativePath = from.RelativePath; to.IsRelativePathModified = from.IsRelativePathModified; to.MessageID = from.MessageID; } }
/// <summary> /// Internal use /// </summary> public ShortMessageAttachment ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false) { ShortMessageAttachment e = new ShortMessageAttachment(); e.StartAutoUpdating = false; e.ID = ID; e.ContentBlockSize = ContentBlockSize; e.DataCreateDate = DataCreateDate; e.IsDataVirtual = IsDataVirtual; e.CompletedSize = CompletedSize; if (preserveState) { e.IsCompletedSizeModified = IsCompletedSizeModified; } else { e.IsCompletedSizeModified = false; } e.DataMimeType = DataMimeType; if (preserveState) { e.IsDataMimeTypeModified = IsDataMimeTypeModified; } else { e.IsDataMimeTypeModified = false; } e.FileName = FileName; if (preserveState) { e.IsFileNameModified = IsFileNameModified; } else { e.IsFileNameModified = false; } e.ContentSize = ContentSize; if (preserveState) { e.IsContentSizeModified = IsContentSizeModified; } else { e.IsContentSizeModified = false; } e.DataLastModified = DataLastModified; if (preserveState) { e.IsDataLastModifiedModified = IsDataLastModifiedModified; } else { e.IsDataLastModifiedModified = false; } e.DataLink = DataLink; if (preserveState) { e.IsDataLinkModified = IsDataLinkModified; } else { e.IsDataLinkModified = false; } e.RelativePath = RelativePath; if (preserveState) { e.IsRelativePathModified = IsRelativePathModified; } else { e.IsRelativePathModified = false; } e.MessageID = MessageID; e.DistinctString = GetDistinctString(true); e.IsPersisted = IsPersisted; if (preserveState) { e.IsEntityChanged = IsEntityChanged; } else { e.IsEntityChanged = false; } e.StartAutoUpdating = true; return(e); }
/// <summary> /// Update changes to the current entity compared to an input <paramref name="newdata" /> and set the entity to a proper state for updating. /// </summary> /// <param name="newdata">The "new" entity acting as the source of the changes, if any.</param> /// <returns> /// </returns> public void UpdateChanges(ShortMessageAttachment newdata) { int cnt = 0; if (DataLastModified != newdata.DataLastModified) { DataLastModified = newdata.DataLastModified; IsDataLastModifiedModified = true; cnt++; } if (DataLink != newdata.DataLink) { DataLink = newdata.DataLink; IsDataLinkModified = true; cnt++; } if (DataMimeType != newdata.DataMimeType) { DataMimeType = newdata.DataMimeType; IsDataMimeTypeModified = true; cnt++; } bool bMsgData = MsgData == null && newdata.MsgData != null || MsgData != null && newdata.MsgData == null || MsgData != null && newdata.MsgData != null && MsgData.Length != newdata.MsgData.Length; if (!bMsgData && MsgData != null) { for (int i = 0; i < MsgData.Length; i++) { bMsgData = MsgData[i] != newdata.MsgData[i]; if (bMsgData) break; } } if (bMsgData) { MsgData = newdata.MsgData; IsMsgDataModified = true; cnt++; } IsEntityChanged = cnt > 0; }
/// <summary> /// Internal use /// </summary> public ShortMessageAttachment ShallowCopy(bool allData = false, bool preserveState = false) { ShortMessageAttachment e = new ShortMessageAttachment(); e.StartAutoUpdating = false; e.ID = ID; e.DataLastModified = DataLastModified; if (preserveState) e.IsDataLastModifiedModified = IsDataLastModifiedModified; else e.IsDataLastModifiedModified = false; e.DataLink = DataLink; if (preserveState) e.IsDataLinkModified = IsDataLinkModified; else e.IsDataLinkModified = false; e.DataMimeType = DataMimeType; if (preserveState) e.IsDataMimeTypeModified = IsDataMimeTypeModified; else e.IsDataMimeTypeModified = false; e.MessageID = MessageID; if (allData) { e.MsgData = MsgData; if (preserveState) e.IsMsgDataModified = IsMsgDataModified; else e.IsMsgDataModified = false; } e.DistinctString = GetDistinctString(true); e.IsPersisted = IsPersisted; if (preserveState) e.IsEntityChanged = IsEntityChanged; else e.IsEntityChanged = false; e.StartAutoUpdating = true; return e; }
/// <summary> /// Merge changes inside entity <paramref name="from" /> to the entity <paramref name="to" />. Any changes in <paramref name="from" /> that is not changed in <paramref name="to" /> is updated inside <paramref name="to" />. /// </summary> /// <param name="from">The "old" entity acting as merging source.</param> /// <param name="to">The "new" entity which inherits changes made in <paramref name="from" />.</param> /// <returns> /// </returns> public static void MergeChanges(ShortMessageAttachment from, ShortMessageAttachment to) { if (to.IsPersisted) { if (from.IsCompletedSizeModified && !to.IsCompletedSizeModified) { to.CompletedSize = from.CompletedSize; to.IsCompletedSizeModified = true; } if (from.IsDataMimeTypeModified && !to.IsDataMimeTypeModified) { to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = true; } if (from.IsFileNameModified && !to.IsFileNameModified) { to.FileName = from.FileName; to.IsFileNameModified = true; } if (from.IsContentSizeModified && !to.IsContentSizeModified) { to.ContentSize = from.ContentSize; to.IsContentSizeModified = true; } if (from.IsDataLastModifiedModified && !to.IsDataLastModifiedModified) { to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = true; } if (from.IsDataLinkModified && !to.IsDataLinkModified) { to.DataLink = from.DataLink; to.IsDataLinkModified = true; } if (from.IsRelativePathModified && !to.IsRelativePathModified) { to.RelativePath = from.RelativePath; to.IsRelativePathModified = true; } } else { to.IsPersisted = from.IsPersisted; to.ID = from.ID; to.ContentBlockSize = from.ContentBlockSize; to.DataCreateDate = from.DataCreateDate; to.IsDataVirtual = from.IsDataVirtual; to.CompletedSize = from.CompletedSize; to.IsCompletedSizeModified = from.IsCompletedSizeModified; to.DataMimeType = from.DataMimeType; to.IsDataMimeTypeModified = from.IsDataMimeTypeModified; to.FileName = from.FileName; to.IsFileNameModified = from.IsFileNameModified; to.ContentSize = from.ContentSize; to.IsContentSizeModified = from.IsContentSizeModified; to.DataLastModified = from.DataLastModified; to.IsDataLastModifiedModified = from.IsDataLastModifiedModified; to.DataLink = from.DataLink; to.IsDataLinkModified = from.IsDataLinkModified; to.RelativePath = from.RelativePath; to.IsRelativePathModified = from.IsRelativePathModified; to.MessageID = from.MessageID; } }