Esempio n. 1
0
        /// <summary>
        /// Internal use
        /// </summary>
        public UserDetail ShallowCopy(bool allData = false)
        {
            UserDetail e = new UserDetail();

            e.IsInitializing    = true;
            e.ApplicationID     = ApplicationID;
            e.UserID            = UserID;
            e.CreateDate        = CreateDate;
            e.BirthDate         = BirthDate;
            e.Gender            = Gender;
            e.LastModified      = LastModified;
            e.PhotoLastModified = PhotoLastModified;
            e.PhotoMime         = PhotoMime;
            if (allData)
            {
                e.Description = Description;
                e.Photo       = Photo;
            }
            e.DistinctString  = GetDistinctString(true);
            e.IsPersisted     = true;
            e.IsEntityChanged = false;
            e.IsInitializing  = false;
            return(e);
        }
Esempio n. 2
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(UserDetail from, UserDetail to)
 {
     if (to.IsPersisted)
     {
         if (from.IsBirthDateModified && !to.IsBirthDateModified)
         {
             to.BirthDate           = from.BirthDate;
             to.IsBirthDateModified = true;
         }
         if (from.IsDescriptionModified && !to.IsDescriptionModified)
         {
             to.Description           = from.Description;
             to.IsDescriptionModified = true;
         }
         if (from.IsGenderModified && !to.IsGenderModified)
         {
             to.Gender           = from.Gender;
             to.IsGenderModified = true;
         }
         if (from.IsLastModifiedModified && !to.IsLastModifiedModified)
         {
             to.LastModified           = from.LastModified;
             to.IsLastModifiedModified = true;
         }
         if (from.IsPhotoModified && !to.IsPhotoModified)
         {
             to.Photo           = from.Photo;
             to.IsPhotoModified = true;
         }
         if (from.IsPhotoLastModifiedModified && !to.IsPhotoLastModifiedModified)
         {
             to.PhotoLastModified           = from.PhotoLastModified;
             to.IsPhotoLastModifiedModified = true;
         }
         if (from.IsPhotoMimeModified && !to.IsPhotoMimeModified)
         {
             to.PhotoMime           = from.PhotoMime;
             to.IsPhotoMimeModified = true;
         }
         if (from.IsWebsiteUrlModified && !to.IsWebsiteUrlModified)
         {
             to.WebsiteUrl           = from.WebsiteUrl;
             to.IsWebsiteUrlModified = true;
         }
     }
     else
     {
         to.IsPersisted                 = from.IsPersisted;
         to.ID                          = from.ID;
         to.CreateDate                  = from.CreateDate;
         to.BirthDate                   = from.BirthDate;
         to.IsBirthDateModified         = from.IsBirthDateModified;
         to.Description                 = from.Description;
         to.IsDescriptionModified       = from.IsDescriptionModified;
         to.Gender                      = from.Gender;
         to.IsGenderModified            = from.IsGenderModified;
         to.LastModified                = from.LastModified;
         to.IsLastModifiedModified      = from.IsLastModifiedModified;
         to.Photo                       = from.Photo;
         to.IsPhotoModified             = from.IsPhotoModified;
         to.PhotoLastModified           = from.PhotoLastModified;
         to.IsPhotoLastModifiedModified = from.IsPhotoLastModifiedModified;
         to.PhotoMime                   = from.PhotoMime;
         to.IsPhotoMimeModified         = from.IsPhotoMimeModified;
         to.WebsiteUrl                  = from.WebsiteUrl;
         to.IsWebsiteUrlModified        = from.IsWebsiteUrlModified;
         to.ApplicationID               = from.ApplicationID;
         to.UserID                      = from.UserID;
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Internal use
        /// </summary>
        public UserDetail ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
        {
            UserDetail e = new UserDetail();

            e.StartAutoUpdating = false;
            e.ID         = ID;
            e.CreateDate = CreateDate;
            e.BirthDate  = BirthDate;
            if (preserveState)
            {
                e.IsBirthDateModified = IsBirthDateModified;
            }
            else
            {
                e.IsBirthDateModified = false;
            }
            e.Gender = Gender;
            if (preserveState)
            {
                e.IsGenderModified = IsGenderModified;
            }
            else
            {
                e.IsGenderModified = false;
            }
            e.LastModified = LastModified;
            if (preserveState)
            {
                e.IsLastModifiedModified = IsLastModifiedModified;
            }
            else
            {
                e.IsLastModifiedModified = false;
            }
            e.PhotoLastModified = PhotoLastModified;
            if (preserveState)
            {
                e.IsPhotoLastModifiedModified = IsPhotoLastModifiedModified;
            }
            else
            {
                e.IsPhotoLastModifiedModified = false;
            }
            e.PhotoMime = PhotoMime;
            if (preserveState)
            {
                e.IsPhotoMimeModified = IsPhotoMimeModified;
            }
            else
            {
                e.IsPhotoMimeModified = false;
            }
            e.WebsiteUrl = WebsiteUrl;
            if (preserveState)
            {
                e.IsWebsiteUrlModified = IsWebsiteUrlModified;
            }
            else
            {
                e.IsWebsiteUrlModified = false;
            }
            e.ApplicationID = ApplicationID;
            e.UserID        = UserID;
            if (allData)
            {
                if (!checkLoadState || IsDescriptionLoaded)
                {
                    e.Description = Description;
                }
                if (preserveState)
                {
                    e.IsDescriptionModified = IsDescriptionModified;
                }
                else
                {
                    e.IsDescriptionModified = false;
                }
                e.IsDescriptionLoaded = IsDescriptionLoaded;
                if (!checkLoadState || IsPhotoLoaded)
                {
                    e.Photo = Photo;
                }
                if (preserveState)
                {
                    e.IsPhotoModified = IsPhotoModified;
                }
                else
                {
                    e.IsPhotoModified = false;
                }
                e.IsPhotoLoaded = IsPhotoLoaded;
            }
            e.DistinctString = GetDistinctString(true);
            e.IsPersisted    = IsPersisted;
            if (preserveState)
            {
                e.IsEntityChanged = IsEntityChanged;
            }
            else
            {
                e.IsEntityChanged = false;
            }
            e.StartAutoUpdating = true;
            return(e);
        }
Esempio n. 4
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(UserDetail newdata)
        {
            int cnt = 0;

            if (BirthDate != newdata.BirthDate)
            {
                BirthDate           = newdata.BirthDate;
                IsBirthDateModified = true;
                cnt++;
            }
            if (Description != newdata.Description)
            {
                Description           = newdata.Description;
                IsDescriptionModified = true;
                cnt++;
            }
            if (Gender != newdata.Gender)
            {
                Gender           = newdata.Gender;
                IsGenderModified = true;
                cnt++;
            }
            if (LastModified != newdata.LastModified)
            {
                LastModified           = newdata.LastModified;
                IsLastModifiedModified = true;
                cnt++;
            }
            bool bPhoto = Photo == null && newdata.Photo != null ||
                          Photo != null && newdata.Photo == null ||
                          Photo != null && newdata.Photo != null && Photo.Length != newdata.Photo.Length;

            if (!bPhoto && Photo != null)
            {
                for (int i = 0; i < Photo.Length; i++)
                {
                    bPhoto = Photo[i] != newdata.Photo[i];
                    if (bPhoto)
                    {
                        break;
                    }
                }
            }
            if (bPhoto)
            {
                Photo           = newdata.Photo;
                IsPhotoModified = true;
                cnt++;
            }
            if (PhotoLastModified != newdata.PhotoLastModified)
            {
                PhotoLastModified           = newdata.PhotoLastModified;
                IsPhotoLastModifiedModified = true;
                cnt++;
            }
            if (PhotoMime != newdata.PhotoMime)
            {
                PhotoMime           = newdata.PhotoMime;
                IsPhotoMimeModified = true;
                cnt++;
            }
            if (WebsiteUrl != newdata.WebsiteUrl)
            {
                WebsiteUrl           = newdata.WebsiteUrl;
                IsWebsiteUrlModified = 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(UserDetail newdata)
 {
     int cnt = 0;
     if (BirthDate != newdata.BirthDate)
     {
         BirthDate = newdata.BirthDate;
         IsBirthDateModified = true;
         cnt++;
     }
     if (Description != newdata.Description)
     {
         Description = newdata.Description;
         IsDescriptionModified = true;
         cnt++;
     }
     if (Gender != newdata.Gender)
     {
         Gender = newdata.Gender;
         IsGenderModified = true;
         cnt++;
     }
     if (LastModified != newdata.LastModified)
     {
         LastModified = newdata.LastModified;
         IsLastModifiedModified = true;
         cnt++;
     }
     bool bPhoto = Photo == null && newdata.Photo != null ||
                                                  Photo != null && newdata.Photo == null ||
                                                  Photo != null && newdata.Photo != null && Photo.Length != newdata.Photo.Length;
     if (!bPhoto && Photo != null)
     {
         for (int i = 0; i < Photo.Length; i++)
         {
             bPhoto = Photo[i] != newdata.Photo[i];
             if (bPhoto)
                 break;
         }
     }
     if (bPhoto)
     {
         Photo = newdata.Photo;
         IsPhotoModified = true;
         cnt++;
     }
     if (PhotoLastModified != newdata.PhotoLastModified)
     {
         PhotoLastModified = newdata.PhotoLastModified;
         IsPhotoLastModifiedModified = true;
         cnt++;
     }
     if (PhotoMime != newdata.PhotoMime)
     {
         PhotoMime = newdata.PhotoMime;
         IsPhotoMimeModified = true;
         cnt++;
     }
     if (WebsiteUrl != newdata.WebsiteUrl)
     {
         WebsiteUrl = newdata.WebsiteUrl;
         IsWebsiteUrlModified = 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(UserDetail from, UserDetail to)
 {
     if (to.IsPersisted)
     {
         if (from.IsBirthDateModified && !to.IsBirthDateModified)
         {
             to.BirthDate = from.BirthDate;
             to.IsBirthDateModified = true;
         }
         if (from.IsDescriptionModified && !to.IsDescriptionModified)
         {
             to.Description = from.Description;
             to.IsDescriptionModified = true;
         }
         if (from.IsGenderModified && !to.IsGenderModified)
         {
             to.Gender = from.Gender;
             to.IsGenderModified = true;
         }
         if (from.IsLastModifiedModified && !to.IsLastModifiedModified)
         {
             to.LastModified = from.LastModified;
             to.IsLastModifiedModified = true;
         }
         if (from.IsPhotoModified && !to.IsPhotoModified)
         {
             to.Photo = from.Photo;
             to.IsPhotoModified = true;
         }
         if (from.IsPhotoLastModifiedModified && !to.IsPhotoLastModifiedModified)
         {
             to.PhotoLastModified = from.PhotoLastModified;
             to.IsPhotoLastModifiedModified = true;
         }
         if (from.IsPhotoMimeModified && !to.IsPhotoMimeModified)
         {
             to.PhotoMime = from.PhotoMime;
             to.IsPhotoMimeModified = true;
         }
         if (from.IsWebsiteUrlModified && !to.IsWebsiteUrlModified)
         {
             to.WebsiteUrl = from.WebsiteUrl;
             to.IsWebsiteUrlModified = true;
         }
     }
     else
     {
         to.IsPersisted = from.IsPersisted;
         to.ID = from.ID;
         to.CreateDate = from.CreateDate;
         to.BirthDate = from.BirthDate;
         to.IsBirthDateModified = from.IsBirthDateModified;
         to.Description = from.Description;
         to.IsDescriptionModified = from.IsDescriptionModified;
         to.Gender = from.Gender;
         to.IsGenderModified = from.IsGenderModified;
         to.LastModified = from.LastModified;
         to.IsLastModifiedModified = from.IsLastModifiedModified;
         to.Photo = from.Photo;
         to.IsPhotoModified = from.IsPhotoModified;
         to.PhotoLastModified = from.PhotoLastModified;
         to.IsPhotoLastModifiedModified = from.IsPhotoLastModifiedModified;
         to.PhotoMime = from.PhotoMime;
         to.IsPhotoMimeModified = from.IsPhotoMimeModified;
         to.WebsiteUrl = from.WebsiteUrl;
         to.IsWebsiteUrlModified = from.IsWebsiteUrlModified;
         to.ApplicationID = from.ApplicationID;
         to.UserID = from.UserID;
     }
 }
 /// <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(UserDetail other)
 {
     if (other == null)
         return false;
     else
         return ApplicationID == other.ApplicationID &&  UserID == other.UserID;
 }              
 /// <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(UserDetail other)
 {
     if (other == null)
         return false;
     if (ID != other.ID)
         return false;
     return true;
 }              
 /// <summary>
 /// Internal use
 /// </summary>
 public UserDetail ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false)
 {
     UserDetail e = new UserDetail();
     e.StartAutoUpdating = false;
     e.ID = ID;
     e.CreateDate = CreateDate;
     e.BirthDate = BirthDate;
     if (preserveState)
         e.IsBirthDateModified = IsBirthDateModified;
     else
         e.IsBirthDateModified = false;
     e.Gender = Gender;
     if (preserveState)
         e.IsGenderModified = IsGenderModified;
     else
         e.IsGenderModified = false;
     e.LastModified = LastModified;
     if (preserveState)
         e.IsLastModifiedModified = IsLastModifiedModified;
     else
         e.IsLastModifiedModified = false;
     e.PhotoLastModified = PhotoLastModified;
     if (preserveState)
         e.IsPhotoLastModifiedModified = IsPhotoLastModifiedModified;
     else
         e.IsPhotoLastModifiedModified = false;
     e.PhotoMime = PhotoMime;
     if (preserveState)
         e.IsPhotoMimeModified = IsPhotoMimeModified;
     else
         e.IsPhotoMimeModified = false;
     e.WebsiteUrl = WebsiteUrl;
     if (preserveState)
         e.IsWebsiteUrlModified = IsWebsiteUrlModified;
     else
         e.IsWebsiteUrlModified = false;
     e.ApplicationID = ApplicationID;
     e.UserID = UserID;
     if (allData)
     {
         if (!checkLoadState || IsDescriptionLoaded)
             e.Description = Description;
         if (preserveState)
             e.IsDescriptionModified = IsDescriptionModified;
         else
             e.IsDescriptionModified = false;
         e.IsDescriptionLoaded = IsDescriptionLoaded;
         if (!checkLoadState || IsPhotoLoaded)
             e.Photo = Photo;
         if (preserveState)
             e.IsPhotoModified = IsPhotoModified;
         else
             e.IsPhotoModified = false;
         e.IsPhotoLoaded = IsPhotoLoaded;
     }
     e.DistinctString = GetDistinctString(true);
     e.IsPersisted = IsPersisted;
     if (preserveState)
         e.IsEntityChanged = IsEntityChanged;
     else
         e.IsEntityChanged = false;
     e.StartAutoUpdating = true;
     return e;
 }
Esempio n. 10
0
 /// <summary>
 /// Internal use
 /// </summary>
 public UserDetail ShallowCopy(bool allData = false)
 {
     UserDetail e = new UserDetail();
     e.IsInitializing = true;
     e.ApplicationID = ApplicationID;
     e.UserID = UserID;
     e.CreateDate = CreateDate;
     e.BirthDate = BirthDate;
     e.Gender = Gender;
     e.LastModified = LastModified;
     e.PhotoLastModified = PhotoLastModified;
     e.PhotoMime = PhotoMime;
     if (allData)
     {
         e.Description = Description;
         e.Photo = Photo;
     }
     e.DistinctString = GetDistinctString(true);
     e.IsPersisted = true;
     e.IsEntityChanged = false;
     e.IsInitializing = false;
     return e;
 }
Esempio n. 11
0
 /// <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(UserDetail other)
 {
     if (other == null)
         return false;
     if (ApplicationID != other.ApplicationID)
         return false;
     if (UserID != other.UserID)
         return false;
     return true;
 }