/// <summary> /// Internal use /// </summary> public Application_ ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false) { Application_ e = new Application_(); e.StartAutoUpdating = false; e.ID = ID; e.Name = Name; e.DisplayName = DisplayName; if (preserveState) { e.IsDisplayNameModified = IsDisplayNameModified; } else { e.IsDisplayNameModified = 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="Communication.Application_Ref" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="Communication.DelLoadApplication_Ref" /> was setup /// before calling it. /// </summary> public void LoadApplication_Ref() { if (_Application_Ref != null) { return; } if (DelLoadApplication_Ref != null) { _Application_Ref = DelLoadApplication_Ref(); } }
/// <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(Application_ other) { if (other == null) { return(false); } else { return(Name == other.Name); } }
/// <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(Application_ 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(Application_ newdata) { int cnt = 0; if (DisplayName != newdata.DisplayName) { DisplayName = newdata.DisplayName; IsDisplayNameModified = true; cnt++; } IsEntityChanged = cnt > 0; }
/// <summary> /// Internal use /// </summary> public Application_ ShallowCopy(bool allData = false) { Application_ e = new Application_(); e.IsInitializing = true; e.ID = ID; e.Name = Name; e.DisplayName = DisplayName; e.DistinctString = GetDistinctString(true); e.IsPersisted = true; e.IsEntityChanged = false; e.IsInitializing = false; 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(Application_ from, Application_ to) { if (to.IsPersisted) { if (from.IsDisplayNameModified && !to.IsDisplayNameModified) { to.DisplayName = from.DisplayName; to.IsDisplayNameModified = true; } } else { to.IsPersisted = from.IsPersisted; to.ID = from.ID; to.Name = from.Name; to.DisplayName = from.DisplayName; to.IsDisplayNameModified = from.IsDisplayNameModified; } }
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864 public void ConfigureAuth(IAppBuilder app) { // Enable the application to use a cookie to store information for the signed in user app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login") }); MembershipPlusServiceProxy svc = new MembershipPlusServiceProxy(); if (ClientContext == null) ClientContext = svc.SignInService(new CallContext(), null); CallContext cctx = ClientContext.CreateCopy(); // Get encryption and decryption key information from the configuration Configuration cfg = WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath); var machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey"); if (machineKey.ValidationKey.Contains("AutoGenerate")) { throw new Exception("Hashed or Encrypted passwords " + "are not supported with auto-generated keys."); } string ApplicationName = ConfigurationManager.AppSettings["ApplicationName"]; try { cctx.DirectDataAccess = true; Application_ServiceProxy apprepo = new Application_ServiceProxy(); List<Application_> apps = apprepo.LoadEntityByNature(cctx, ApplicationName); if (apps == null || apps.Count == 0) { cctx.OverrideExisting = true; var tuple = apprepo.AddOrUpdateEntities(cctx, new Application_Set(), new Application_[] { new Application_ { Name = ApplicationName } }); App = tuple.ChangedEntities.Length == 1 && IsValidUpdate(tuple.ChangedEntities[0].OpStatus) ? tuple.ChangedEntities[0].UpdatedItem : null; cctx.OverrideExisting = false; } else App = apps[0]; MemberInitSuccess = true; } catch { } }
/// <summary> /// <see cref="Announcement.Application_Ref" /> is not initialized when the entity is created. Clients could call this method to load it provided a proper delegate <see cref="Announcement.DelLoadApplication_Ref" /> was setup /// before calling it. /// </summary> public void LoadApplication_Ref() { if (ApplicationID == null || _Application_Ref != null) return; if (DelLoadApplication_Ref != null) _Application_Ref = DelLoadApplication_Ref(); }
/// <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(Application_ other) { if (other == null) return false; else return Name == other.Name; }
/// <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(Application_ other) { if (other == null) return false; if (ID != other.ID) return false; return true; }
/// <summary> /// Internal use /// </summary> public Application_ ShallowCopy(bool allData = false, bool preserveState = false, bool checkLoadState = false) { Application_ e = new Application_(); e.StartAutoUpdating = false; e.ID = ID; e.Name = Name; e.DisplayName = DisplayName; if (preserveState) e.IsDisplayNameModified = IsDisplayNameModified; else e.IsDisplayNameModified = false; e.DistinctString = GetDistinctString(true); e.IsPersisted = IsPersisted; if (preserveState) e.IsEntityChanged = IsEntityChanged; else e.IsEntityChanged = false; e.StartAutoUpdating = true; return e; }
/// <summary> /// Internal use /// </summary> public Application_ ShallowCopy(bool allData = false) { Application_ e = new Application_(); e.IsInitializing = true; e.ID = ID; e.Name = Name; e.DisplayName = DisplayName; e.DistinctString = GetDistinctString(true); e.IsPersisted = true; e.IsEntityChanged = false; e.IsInitializing = false; return e; }