public List <ModifiedFields> GetModifiedFields(LmsPerson lmsPerson) { List <ModifiedFields> modifiedFieldsList = null; ModifiedFields modifiedFields = null; modifiedFields = GetPersonField(modifiedFields, lmsPerson); if (modifiedFields != null) { (modifiedFieldsList ?? (modifiedFieldsList = new List <ModifiedFields>())).Add(modifiedFields); } modifiedFields = GetAddressField(modifiedFields, lmsPerson); if (modifiedFields != null) { (modifiedFieldsList ?? (modifiedFieldsList = new List <ModifiedFields>())).Add(modifiedFields); } modifiedFields = GetEmailField(modifiedFields, lmsPerson); if (modifiedFields != null) { (modifiedFieldsList ?? (modifiedFieldsList = new List <ModifiedFields>())).Add(modifiedFields); } modifiedFields = GetPhoneField(modifiedFields, lmsPerson); if (modifiedFields != null) { (modifiedFieldsList ?? (modifiedFieldsList = new List <ModifiedFields>())).Add(modifiedFields); } return(modifiedFieldsList); }
/// <summary> /// Manually creates a collection of AccountFields that will be added as a property of ModifiedFields. /// Ensures that "CreditLimit" AccountField is always added. /// When a host value is added to the Account collection, remove that host value from the application entity from which it was defined. /// </summary> /// <param name="modifiedFields"></param> /// <param name="primaryApplicant"></param> /// <remarks> /// This method already has access to application-level host values. /// Optionally giving it the ability to access applicant-level host values. /// </remarks> /// <returns></returns> public ModifiedFields GetAccountField(ModifiedFields modifiedFields, Applicant primaryApplicant) { var accountFieldHVs = _app.HostValues.Where ( hv => hv.Field1.Contains("UpdateAccount.Message.DataUpdate.ModifiedFields.AccountField") ); if (accountFieldHVs.Any()) { var accountFields = new List <string>(); // Add AccountField host values to Dto foreach (var accountFieldHV in accountFieldHVs.ToList()) { accountFields.Add(accountFieldHV.Value); // Remove this host value from the application entity since it was already manually added // and doesn't need to be "re-added" by the host value translator. _app.HostValues.Remove(accountFieldHV); } modifiedFields.AccountField = accountFields; } // Determine if direct-mapped UpdateAccount.Message.DataUpdate.ModifiedFields.AccountField = CreditLimit needs to be added var containsAccountFieldCreditLimit = modifiedFields.AccountField?.Contains("CreditLimit"); if (!containsAccountFieldCreditLimit.GetValueOrDefault()) { (modifiedFields.AccountField ?? (modifiedFields.AccountField = new List <string>())).Add("CreditLimit"); } return(modifiedFields); }
public ModifiedFields GetPhoneField(ModifiedFields modifiedFields, LmsPerson lmsPerson) { var addressFieldHVs = _app.HostValues.Where ( hv => hv.Field1.Contains("UpdatePerson.Message.DataUpdate.ModifiedFields.AddressField") ); if (addressFieldHVs.Any()) { if (modifiedFields == null) { modifiedFields = new ModifiedFields(); } var addressFields = new List <string>(); // Add AddressField host values to Dto foreach (var addressFieldHV in addressFieldHVs.ToList()) { addressFields.Add(addressFieldHV.Value); // Remove this host value from the application entity since it was already manually added // and doesn't need to be "re-added" by the host value translator. _app.HostValues.Remove(addressFieldHV); } modifiedFields.AddressField = addressFields; } return(modifiedFields); }
public EntityStateModel(EntityEntry entityEntry) { Entity = entityEntry.Entity; State = entityEntry.State; TempFieldNames = entityEntry.Properties.Where(x => x.IsTemporary).Select(x => x.Metadata.Name).ToList(); var modifiedProperties = entityEntry.Properties.Where(x => x.IsModified).ToList(); foreach (var modifiedProperty in modifiedProperties) { if (ModifiedFields.ContainsKey(modifiedProperty.Metadata.Name)) { continue; } var property = entityEntry.Entity.GetType().GetProperty(modifiedProperty.Metadata.Name); if (property == null) { continue; } var propertyName = property.Name; var propertyValue = property.GetValue(entityEntry.Entity, null); ModifiedFields.Add(propertyName, propertyValue); } }
//public void RaisePropertyChanged(string propertyName) //{ // if (PropertyChanged != null) // PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); // // Call extension point // OnPropertyChanged(propertyName); //} //public void RaisePropertyChanged<T>(Expression<Func<T>> property) //{ // if (PropertyChanged != null) // PropertyChanged(this, new PropertyChangedEventArgs(property.Name)); // // Call extension point // OnPropertyChanged(property.Body.ToString()); //} public void OnPropertyChanged(string propertyName) { if (!ModifiedFields.Contains(propertyName)) { ModifiedFields.Add(propertyName); } }
void RefreshNewExtentPrefix() { CLFS_MGMT_POLICY_NEWCONTAINERPREFIX policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); this.newExtentPrefix = policy.PrefixString; this.modifiedFields &= ~ModifiedFields.NewExtentPrefix; }
void RefreshNextExtentSuffix() { CLFS_MGMT_POLICY_NEXTCONTAINERSUFFIX policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); this.nextExtentSuffix = (long)policy.NextContainerSuffix; this.modifiedFields &= ~ModifiedFields.NextExtentSuffix; }
void RefreshMinimumSize() { CLFS_MGMT_POLICY_MINIMUMSIZE policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); this.minimumExtentCount = (int)policy.Containers; this.modifiedFields &= ~ModifiedFields.MinimumExtentCount; }
void RefreshAutoShrinkPercentage() { CLFS_MGMT_POLICY_AUTOSHRINK policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); this.autoShrinkPercentage = (int)policy.Percentage; this.modifiedFields &= ~ModifiedFields.AutoShrinkPercentage; }
void RefreshAutoGrow() { CLFS_MGMT_POLICY_AUTOGROW policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); this.autoGrow = (policy.Enabled != 0); this.modifiedFields &= ~ModifiedFields.AutoGrow; }
/// <summary> /// Manually creates a collection of ModifieldFields. /// </summary> /// <param name="primaryApplicant"></param> /// <remarks> /// ModifiedFields is needed for all UpdateAccount calls. /// Optionally giving it the ability to access applicant-level host values. /// </remarks> /// <returns></returns> public List <ModifiedFields> GetModifiedFields(Applicant primaryApplicant) { List <ModifiedFields> modifiedFieldsList = new List <ModifiedFields>(); ModifiedFields modifiedFieldsAccountFields = new ModifiedFields(); modifiedFieldsAccountFields = GetAccountField(modifiedFieldsAccountFields, primaryApplicant); modifiedFieldsList.Add(modifiedFieldsAccountFields); return(modifiedFieldsList); }
void CommitAutoGrow() { if (0 != (this.modifiedFields & ModifiedFields.AutoGrow)) { CLFS_MGMT_POLICY_AUTOGROW policy; policy = new CLFS_MGMT_POLICY_AUTOGROW( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); policy.Enabled = (uint)(this.autoGrow ? 1 : 0); UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.AutoGrow; } }
void CommitNextExtentSuffix() { if (0 != (this.modifiedFields & ModifiedFields.NextExtentSuffix)) { CLFS_MGMT_POLICY_NEXTCONTAINERSUFFIX policy; policy = new CLFS_MGMT_POLICY_NEXTCONTAINERSUFFIX( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); policy.NextContainerSuffix = (ulong)this.nextExtentSuffix; UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.NextExtentSuffix; } }
void CommitAutoShrinkPercentage() { if (0 != (this.modifiedFields & ModifiedFields.AutoShrinkPercentage)) { CLFS_MGMT_POLICY_AUTOSHRINK policy; policy = new CLFS_MGMT_POLICY_AUTOSHRINK( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); policy.Percentage = (uint)this.autoShrinkPercentage; UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.AutoShrinkPercentage; } }
void CommitMinimumSize() { if (0 != (this.modifiedFields & ModifiedFields.MinimumExtentCount)) { CLFS_MGMT_POLICY_MINIMUMSIZE policy; policy = new CLFS_MGMT_POLICY_MINIMUMSIZE( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); policy.Containers = (uint)this.minimumExtentCount; UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.MinimumExtentCount; } }
/// <summary> /// Manually creates a collection of ModifieldFields. /// </summary> /// <param name="lmsPerson"></param> /// <remarks> /// Optionally giving it the ability to access applicant-level host values. /// </remarks> /// <returns></returns> public List <ModifiedFields> GetModifiedFields(LmsPerson lmsPerson) { List <ModifiedFields> modifiedFieldsList = new List <ModifiedFields>(); ModifiedFields modifiedFields = new ModifiedFields() { AddressField = new List <string>() }; modifiedFields = GetAddressField(modifiedFields, lmsPerson); modifiedFieldsList.Add(modifiedFields); return(modifiedFieldsList); }
void RefreshPinnedTailThreshold() { CLFS_MGMT_POLICY_LOGTAIL policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); if (policy.MinimumAvailablePercentage != 0) { this.pinnedTailThreshold = PolicyUnit.Percentage( (int)policy.MinimumAvailablePercentage); } else { this.pinnedTailThreshold = PolicyUnit.Extents( (int)policy.MinimumAvailableContainers); } this.modifiedFields &= ~ModifiedFields.PinnedTailThreshold; }
void RefreshGrowthRate() { CLFS_MGMT_POLICY_GROWTHRATE policy; UnsafeNativeMethods.QueryLogPolicy(this.store.Handle, out policy); if (policy.AbsoluteGrowthInContainers != 0) { this.growthRate = PolicyUnit.Extents( (int)policy.AbsoluteGrowthInContainers); } else { this.growthRate = PolicyUnit.Percentage( (int)policy.RelativeGrowthPercentage); } this.modifiedFields &= ~ModifiedFields.GrowthRate; }
void CommitNewExtentPrefix() { if (0 != (this.modifiedFields & ModifiedFields.NewExtentPrefix)) { CLFS_MGMT_POLICY_NEWCONTAINERPREFIX policy; policy = new CLFS_MGMT_POLICY_NEWCONTAINERPREFIX( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); // The prefix length should not include the NULL terminator. // Including NULL terminator will cause the CLFS container // name to have embedded NULL and container creation will fail. policy.PrefixLengthInBytes = (ushort)((this.newExtentPrefix.Length) * 2); policy.PrefixString = this.newExtentPrefix; UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.NewExtentPrefix; } }
void CommitGrowthRate() { if (0 != (this.modifiedFields & ModifiedFields.GrowthRate)) { CLFS_MGMT_POLICY_GROWTHRATE policy; policy = new CLFS_MGMT_POLICY_GROWTHRATE( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); if (this.growthRate.Type == PolicyUnitType.Extents) { policy.AbsoluteGrowthInContainers = (uint)this.growthRate.Value; policy.RelativeGrowthPercentage = 0; } else { policy.RelativeGrowthPercentage = (uint)this.growthRate.Value; policy.AbsoluteGrowthInContainers = 0; } UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.GrowthRate; } }
void CommitPinnedTailThreshold() { if (0 != (this.modifiedFields & ModifiedFields.PinnedTailThreshold)) { CLFS_MGMT_POLICY_LOGTAIL policy; policy = new CLFS_MGMT_POLICY_LOGTAIL( Const.LOG_POLICY_OVERWRITE | Const.LOG_POLICY_PERSIST); if (this.pinnedTailThreshold.Type == PolicyUnitType.Extents) { policy.MinimumAvailableContainers = (uint)this.pinnedTailThreshold.Value; policy.MinimumAvailablePercentage = 0; } else { policy.MinimumAvailablePercentage = (uint)this.pinnedTailThreshold.Value; policy.MinimumAvailableContainers = 0; } UnsafeNativeMethods.InstallLogPolicy(this.store.Handle, ref policy); this.modifiedFields &= ~ModifiedFields.PinnedTailThreshold; } }
/// <summary> /// Manually creates a collection of AddressFields that will be added as a property of ModifiedFields. /// </summary> /// <param name="modifiedFields"></param> /// <param name="lmsPerson"></param> /// <remarks> /// This method already has access to application-level host values. /// Optionally giving it the ability to access applicant-level or authorized user-level host values. /// </remarks> /// <returns></returns> public static ModifiedFields GetAddressField(ModifiedFields modifiedFields, LmsPerson lmsPerson) { modifiedFields.AddressField.Add(ADDRESS_FIELD); return(modifiedFields); }