private static Parameter GetStringValueFromElementBase(ElementId elementId, string propertyName, bool allowUnset, out string propertyValue) { if (elementId == ElementId.InvalidElementId) { throw new ArgumentNullException("element"); } if (String.IsNullOrEmpty(propertyName)) { throw new ArgumentException("It is null or empty.", "propertyName"); } propertyValue = string.Empty; Parameter parameter = GetParameterFromName(elementId, null, propertyName); if (parameter != null) { StorageType storageType = parameter.StorageType; if (storageType != StorageType.String && storageType != StorageType.ElementId) { return(null); } if (parameter.HasValue) { if (parameter.AsString() != null) { propertyValue = parameter.AsString(); return(parameter); } else if (parameter.AsElementId() != null) { propertyValue = PropertyUtil.ElementIdParameterAsString(parameter); return(parameter); } } if (allowUnset) { propertyValue = null; return(parameter); } } return(null); }
private void method_1() { this.lblVersion.Text = PropertyUtil.GetValue("MAIN_VER", ""); TaxCard card = TaxCardFactory.CreateTaxCard(); this.lblTaxCode.Text = card.TaxCode.ToString(); this.lblCorpName.Text = card.Corporation; this.lblProName.Text = ProductName; string productName = ProductName; //TODO 此处的修改显示和原来不同了,然而这个是在About里面并没有什么影响 if ((card.TaxCode.Length == 15) && (card.TaxCode.Substring(8, 2).ToUpper() == "DK")) { productName = ((productName + Environment.NewLine) + " 总局发布版本号:" + ProductVersion + Environment.NewLine) + " 内部版本号:" + ProductVersion + Environment.NewLine; } else { productName = ((productName + Environment.NewLine) + " 总局发布版本号:" + ProductVersion + Environment.NewLine) + " 内部版本号:" + ProductVersion + Environment.NewLine; } this.rtbSetup.Text = ""; this.rtbSetup.AppendText(productName); string path = Path.Combine(PropertyUtil.GetValue("MAIN_PATH"), @"Automation\Config.ini"); if (File.Exists(path)) { List <IniFileUtil.SetupFile> list = IniFileUtil.ReadSetupConfig(path); foreach (RegFileInfo info in RegisterManager.SetupRegFile().NormalRegFiles) { using (List <IniFileUtil.SetupFile> .Enumerator enumerator2 = list.GetEnumerator()) { IniFileUtil.SetupFile current; while (enumerator2.MoveNext()) { current = enumerator2.Current; if (current.Kind.ToUpper() == info.VerFlag.ToUpper()) { goto Label_01A1; } } continue; Label_01A1: current.bNormal = true; this.rtbSetup.AppendText(string.Format("{0} {1}", current.Name.Replace("文本接口", "单据管理").Replace("组件接口", "集成开票"), current.Ver) + Environment.NewLine); } } } }
/// <summary> /// Creates and adds a New Collection Property Rule to the Collection. /// </summary> /// <typeparam name="TProperty">Type of property the rule will be set to. Must be <see cref="ICollectionPropertyRule"/></typeparam> /// <param name="propertyExpression">Expression to property rule will be set to.</param> /// <returns>A <see cref="ICollectionPropertyRuleBuilderInitializer{TContext,TSubject}"/></returns> public ICollectionPropertyRuleBuilderInitializer <RuleEngineContext <TSubject>, TSubject> NewCollectionPropertyRule <TProperty> ( Expression <Func <TProperty> > propertyExpression) where TProperty : ICollectionPropertyRule { Check.IsNotNull(propertyExpression, "propertyExpression is required."); var name = PropertyUtil.ExtractPropertyName(propertyExpression); return(new CollectionPropertyRuleBuilderInitializer <RuleEngineContext <TSubject>, TSubject> ( name, rule => { if (_shouldRunClauseToAdd != null) { rule.AddShouldRunClause(_shouldRunClauseToAdd); } AddRule(rule); })); }
/// <summary> /// Brings the into view for scroll viewer. /// </summary> /// <param name="frameworkElement">The framework element.</param> /// <param name="scrollViewer">The scroll viewer.</param> /// <param name="animate">If set to <c>true</c> [animate].</param> public static void BringIntoViewForScrollViewer(this FrameworkElement frameworkElement, ScrollViewer scrollViewer, bool animate) { var transform = frameworkElement.TransformToVisual(scrollViewer); var topPositionInScrollViewer = transform.Transform(new Point(0, 0)); var bottomPositionInScrollViewer = transform.Transform(new Point(0, frameworkElement.ActualHeight)); double offsetToScrollTo = -1; if (topPositionInScrollViewer.Y < 0) { offsetToScrollTo = scrollViewer.VerticalOffset + topPositionInScrollViewer.Y - ScrollPadding; } else if (bottomPositionInScrollViewer.Y > scrollViewer.ViewportHeight) { offsetToScrollTo = scrollViewer.VerticalOffset + bottomPositionInScrollViewer.Y - scrollViewer.ViewportHeight + ScrollPadding; } if (offsetToScrollTo > 0) { if (animate) { var storyboard = new Storyboard(); storyboard.Children.Add( new DoubleAnimation { From = scrollViewer.VerticalOffset, To = offsetToScrollTo, Duration = new Duration(new TimeSpan(0, 0, 1)), EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut } }); var animationHelper = new ScrollViewerAnimationHelper { ScrollViewer = scrollViewer }; Storyboard.SetTarget(storyboard.Children[0], animationHelper); Storyboard.SetTargetProperty( storyboard.Children[0], new PropertyPath(PropertyUtil.ExtractPropertyName(() => animationHelper.VerticalOffset))); storyboard.Begin(); } else { scrollViewer.ScrollToVerticalOffset(offsetToScrollTo); } } }
/// <summary> /// Builds the specified owner. /// </summary> /// <typeparam name="TCommand">The type of the command.</typeparam> /// <typeparam name="TOwner">The type of the owner.</typeparam> /// <typeparam name="TParameter">The type of the parameter.</typeparam> /// <param name="owner">The owner.</param> /// <param name="propertyExpression">The property expression.</param> /// <param name="executeMethod">The execute method.</param> /// <param name="canExecuteMethod">The can execute method.</param> /// <returns>Built command.</returns> public TCommand Build <TCommand, TOwner, TParameter> ( TOwner owner, Expression <Func <ICommand> > propertyExpression, Action <TParameter> executeMethod, Func <TParameter, bool> canExecuteMethod = null) where TCommand : class, ICommand { var commandName = PropertyUtil.ExtractPropertyName(propertyExpression); var frameworkCommandInfo = new FrameworkCommandInfo(owner, commandName); return(canExecuteMethod != null ? Build <TCommand, TOwner> ( frameworkCommandInfo, Activator.CreateInstance ( typeof(TCommand), executeMethod, canExecuteMethod ) as TCommand) : Build <TCommand, TOwner> ( frameworkCommandInfo, Activator.CreateInstance(typeof(TCommand), executeMethod) as TCommand)); }
private void HandleNonResponseDtoPropertyChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == PropertyUtil.ExtractPropertyName(() => NonResponseDto.ValueObject)) { if (NonResponseDto.ValueObject != null) { NonResponseDto.NonResponse = null; } } else if (e.PropertyName == PropertyUtil.ExtractPropertyName(() => NonResponseDto.NonResponse)) { if (NonResponseDto.NonResponse != null) { NonResponseDto.ValueObject = NonResponseDto.IsNullable ? null : NonResponseDto.ValueObject.GetType().GetDefault(); } } }
/// <summary> /// Initializes a new instance of the <see cref="PatientReminderViewModelRuleCollection"/> class. /// </summary> public PatientReminderViewModelRuleCollection() { AutoValidatePropertyRules = true; var ageRageDataError = new DataErrorInfo( "Age must be between 0 and 200.", ErrorLevel.Error, PropertyUtil.ExtractPropertyName <PatientReminderCriteriaDto, int?> (dto => dto.Age)); NewPropertyRule(() => AgeInRange) .WithProperty(s => s.PatientReminderCriteria.Age) .InclusiveBetweenOrNull(0, 200) .ElseThen((s, ctx) => s.PatientReminderCriteria.TryAddDataErrorInfo(ageRageDataError)) .Then(s => s.PatientReminderCriteria.RemoveDataErrorInfo(ageRageDataError)); NewRuleSet(() => SearchCommandRuleSet, AgeInRange); }
private bool checkCaPassword1(string password, string CA) { bool flag = true; if ((CA.Length == 0) || (password.Length == 0)) { return(false); } try { if (DigitalEnvelop.DigEnvInit(false, true, true) == 0) { try { string str = PropertyUtil.GetValue("MAIN_PATH") + @"\bin\server.pfx"; string currentDirectory = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(PropertyUtil.GetValue("MAIN_PATH") + @"\bin\"); int num = DigitalEnvelop.SetCaCertAndCrlByPfx(CA, password, ""); this.loger.Info("GetCurrentDirectory :" + currentDirectory); this.loger.Info("m_strPfxPath :" + str); this.loger.Info(" DigitalEnvelop.SetCaCertAndCrlByPfx ret :" + num.ToString()); Directory.SetCurrentDirectory(currentDirectory); if ((num != 0) && (num == 2)) { flag = false; } } catch (Exception exception) { this.loger.Error("校验证书密码发生异常:" + exception.ToString()); string[] textArray1 = new string[] { exception.ToString() }; MessageManager.ShowMsgBox("SWDK-0061", textArray1); return(false); } } DigitalEnvelop.DigEnvClose(); } catch (Exception exception2) { this.loger.Error("校验证书密码发生异常:" + exception2.ToString()); string[] textArray2 = new string[] { exception2.ToString() }; MessageManager.ShowMsgBox("SWDK-0061", textArray2); return(false); } return(flag); }
/// <summary> /// Initializes a new instance of the <see cref="PayorTypeEditorViewModelRuleCollection"/> class. /// </summary> public PayorTypeEditorViewModelRuleCollection() { AutoValidatePropertyRules = true; var nameError = new DataErrorInfo( "Name is required.", ErrorLevel.Error, PropertyUtil.ExtractPropertyName <PayorTypeDto, object> (dto => dto.Name)); NewPropertyRule(() => NameRequired) .WithProperty(s => s.EditingDto.Name) .NotEmpty() .ElseThen( (s, ctx) => { if (!(ctx.RuleSelector is SelectAllRuleSelector)) { s.EditingDto.TryAddDataErrorInfo(nameError); } }) .Then(s => s.EditingDto.RemoveDataErrorInfo(nameError)); var regex = new Regex(@"^ftp\://[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM|ORG|NET|MIL|EDU)$"); var ftpAddressInvalidError = new DataErrorInfo( "FTP address is not valid.", ErrorLevel.Error, PropertyUtil.ExtractPropertyName <PayorTypeDto, object> (dto => dto.FtpAddress)); NewRule(() => FtpAddressInvalid) .RunForProperty(s => s.EditingDto.FtpAddress) .When( s => { if (s.EditingDto.FtpAddress != null && !regex.IsMatch(s.EditingDto.FtpAddress)) { return(true); } return(false); }) .ThenReportRuleViolation(ftpAddressInvalidError.Message) .Then(s => s.EditingDto.TryAddDataErrorInfo(ftpAddressInvalidError)) .ElseThen(s => s.EditingDto.RemoveDataErrorInfo(ftpAddressInvalidError)); BuildHealthCareClaim837ProfessionalRules(); BuildAddressRules(); }
private IEnumerable <string> GetNonResponseLookupWellKnownNames <TProperty>(Expression <Func <TProperty> > propertyExpression) { IEnumerable <string> wellKnownNames = TedsAdmissionInterview.DefaultNonResponseLookupWellKnownNames; var wellKnownNamesForMostProperties = new List <string> { WellKnownNames.TedsModule.TedsNonResponse.NotApplicable, WellKnownNames.TedsModule.TedsNonResponse.Unknown }; string propertyName = PropertyUtil.ExtractPropertyName(propertyExpression); if (propertyName == PropertyUtil.ExtractPropertyName(() => this.DetailedNotInLaborForce)) { wellKnownNames = wellKnownNamesForMostProperties; } return(wellKnownNames); }
/// <summary> /// Builds the specified command factory. /// </summary> /// <typeparam name="TCommand">The type of the command.</typeparam> /// <typeparam name="TOwner">The type of the owner.</typeparam> /// <typeparam name="TParameter">The type of the parameter.</typeparam> /// <param name="commandFactory">The command factory.</param> /// <param name="owner">The owner.</param> /// <param name="comandPropertyExpression">The comand property expression.</param> /// <param name="memberNameFunc">The member name func.</param> /// <param name="executeMethod">The execute method.</param> /// <param name="canExecuteMethod">The can execute method.</param> /// <returns> /// The build command. /// </returns> public static TCommand Build <TCommand, TOwner, TParameter>(this ICommandFactory commandFactory, TOwner owner, Expression <Func <ICommand> > comandPropertyExpression, Func <TParameter, string> memberNameFunc, Action <TParameter> executeMethod, Func <TParameter, bool> canExecuteMethod = null) where TCommand : class, ICommand { var commandName = PropertyUtil.ExtractPropertyName(comandPropertyExpression); var ruleCommandInfo = new RuleCommandInfo( owner, commandName, new PropertyChainContainsMemberRuleSelector <TParameter> (memberNameFunc)); return(canExecuteMethod != null? commandFactory.Build <TCommand, TOwner>(ruleCommandInfo, Activator.CreateInstance(typeof(TCommand), executeMethod, canExecuteMethod) as TCommand) : commandFactory.Build <TCommand, TOwner>(ruleCommandInfo, Activator.CreateInstance(typeof(TCommand), executeMethod) as TCommand)); }
/// <summary> /// Binds a control already bound to a property to a setting property. A property change event will be simulated on setting change. /// </summary> /// <param name="control">The control to bind.</param> /// <param name="settingProperty">The name of the setting property to listen. Should be relative to the root of EditorSettings.</param> /// <exception cref="ArgumentException">If the given control has not been bound to a property.</exception> public void BindControlToSettingChange(Control control, string settingProperty) { if (!controlBinds.ContainsKey(control)) { throw new ArgumentException("Control '" + control.Name + "' has not been bound to a property."); } ControlBind thisBind = controlBinds[control]; string listenedPropertyName = thisBind.Property; this.state.SettingChanged += (object sender, PropertyChangeEventArgs e) => { if (PropertyUtil.IsAncestralProperty(settingProperty, e.PropertyName)) { RefreshBind(thisBind); } }; }
/// <summary> /// Создает класс описания удаления на основе свойства в родителе. /// </summary> /// <param name="propertyRefExpr">Лямда функция указывающая на свойство, пример (e => e.Name)</param> /// <typeparam name="TObject">Тип объекта доменной модели</typeparam> public static DeleteDependenceInfo CreateFromParentPropery <TObject> (Expression <Func <TObject, object> > propertyRefExpr) { string propName = PropertyUtil.GetName(propertyRefExpr); var parentMap = OrmConfig.NhConfig.GetClassMapping(typeof(TObject)); var propertyMap = OrmConfig.NhConfig.GetClassMapping(typeof(TObject)).GetProperty(propName).Value as ManyToOne; Type itemType = propertyMap.Type.ReturnedClass; var itemMap = OrmConfig.NhConfig.GetClassMapping(itemType); var parentTable = parentMap.Table.Name; string fieldName = propertyMap.ColumnIterator.First().Text; return(new DeleteDependenceInfo { IsCascade = true, ParentPropertyName = propName, ObjectClass = itemType, WhereStatment = String.Format("WHERE {0}.id = (SELECT {1} FROM {2} WHERE id = @id)", itemMap.Table.Name, fieldName, parentTable) }); }
/// <summary> /// Uns the filter LKP. /// </summary> /// <typeparam name="TProvider">The type of the provider.</typeparam> /// <typeparam name="TProperty">The type of the property.</typeparam> /// <param name="metadataProvider">The metadata provider.</param> /// <param name="propertyExpression">The property expression.</param> /// <returns>A <see cref="System.Boolean"/></returns> public static bool UnFilterLkp <TProvider, TProperty> ( this TProvider metadataProvider, Expression <Func <TProvider, TProperty> > propertyExpression) where TProvider : IMetadataProvider { if (typeof(IMetadataProvider).IsAssignableFrom(typeof(TProperty))) { var metaDataProvider = propertyExpression.Compile().Invoke(metadataProvider) as IMetadataProvider; if (metaDataProvider == null) { return(false); } return(UnFilterLkp(metaDataProvider)); } var propertyName = PropertyUtil.ExtractPropertyName(propertyExpression); return(HandleMetadataItemDto <FilterLookupMetadataItemDto> (metadataProvider.MetadataDto, propertyName, false, null)); }
/// <summary> /// Handles the specified request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> protected override void Handle(UpdateStaffRequest request, DtoResponse <StaffDto> response) { var staff = _staffRepository.GetByKey(request.StaffKey); DataErrorInfo dataErrorInfo = null; switch (request.UpdateType) { case UpdateStaffRequest.StaffUpdateType.Name: staff.ReviseName((PersonName)request.Value); break; case UpdateStaffRequest.StaffUpdateType.Email: Email newEmail = null; try { if (!string.IsNullOrWhiteSpace((string)request.Value)) { newEmail = new Email((string)request.Value); } } catch (ArgumentException ae) { if (!ae.Message.Contains("email address", StringComparison.OrdinalIgnoreCase)) { throw; } dataErrorInfo = new DataErrorInfo(ae.Message, ErrorLevel.Error, PropertyUtil.ExtractPropertyName <StaffDto, string> (s => s.Email)); } staff.ReviseEmail(string.IsNullOrWhiteSpace((string)request.Value) ? null : newEmail); break; case UpdateStaffRequest.StaffUpdateType.Location: staff.ReviseLocation((string)request.Value); break; case UpdateStaffRequest.StaffUpdateType.NPI: staff.ReviseNpi((string)request.Value); break; } response.DataTransferObject = Mapper.Map <Staff, StaffDto> (staff); if (dataErrorInfo != null) { response.DataTransferObject.AddDataErrorInfo(dataErrorInfo); } }
private void method_1() { try { this.textRegex_ReceEmail_POP3.Text = PropertyUtil.GetValue("POP3_SERVER").Trim(); int result = 110; string s = PropertyUtil.GetValue("POP3_PORT").Trim(); if (!int.TryParse(s, out result) || (result <= 0)) { s = "110"; } this.textRegex_ReceEmail_POP3_GJ.Text = s; this.textRegex_SendEmail_SMTP.Text = PropertyUtil.GetValue("SMTP_SERVER").Trim(); int num2 = 0x19; string str2 = PropertyUtil.GetValue("SMTP_PORT").Trim(); if (!int.TryParse(str2, out num2) || (num2 <= 0)) { str2 = "25"; } this.textRegex_SendEmail_SMPT_GJ.Text = str2; this.textRegex_ZhangHuMing_Rece.Text = PropertyUtil.GetValue("POP3_USER").Trim(); this.textRegex_PassWord_Rece.Text = (PropertyUtil.GetValue("POP3_PASS").Length == 0) ? "" : Encoding.Default.GetString(AES_Crypt.Decrypt(Convert.FromBase64String(PropertyUtil.GetValue("POP3_PASS").Trim()), byte_0, byte_1, null)); string str3 = PropertyUtil.GetValue("SMTP_AUTH").Trim(); this.chkBox_MyServerYanZheng_Send.Checked = string.IsNullOrEmpty(str3) || (str3 != "0"); this.textRegex_ZhangHuMing_Send.Text = PropertyUtil.GetValue("SMTP_USER").Trim(); this.textRegex_PassWord_Send.Text = (PropertyUtil.GetValue("SMTP_PASS").Length == 0) ? "" : Encoding.Default.GetString(AES_Crypt.Decrypt(Convert.FromBase64String(PropertyUtil.GetValue("SMTP_PASS").Trim()), byte_0, byte_1, null)); string str4 = PropertyUtil.GetValue("MAIL_ALL_CONFIG").Trim(); this.chkBox_SendItemSet_CG.Checked = string.IsNullOrEmpty(str4) || (str4 != "0"); string str5 = PropertyUtil.GetValue("MAIL_ALL_SEND").Trim(); this.chkBox_ZhiJieSend_CG.Checked = string.IsNullOrEmpty(str5) || (str5 != "0"); string str6 = PropertyUtil.GetValue("MAIL_DEL").Trim(); this.chkBox_ServerDeleteEmail_GJ.Checked = !string.IsNullOrEmpty(str6) && (str6 != "0"); this.chkBox_MyServerYanZheng_Send_Click(this.chkBox_MyServerYanZheng_Send, null); } catch (BaseException exception) { this.ilog_0.Error(exception.Message); ExceptionHandler.HandleError(exception); } catch (Exception exception2) { this.ilog_0.Error(exception2.Message); ExceptionHandler.HandleError(exception2); } }
private static void GetValueRunCopy() { try { SetDefaultPathCopy(); if (string.IsNullOrEmpty(PropertyUtil.GetValue(ZhiFuChuan.strBeginningMonthCopy))) { PropertyUtil.SetValue(ZhiFuChuan.strBeginningMonthCopy, ZhiFuChuan.strRight); } if (string.IsNullOrEmpty(PropertyUtil.GetValue(ZhiFuChuan.strEndRunCopy))) { PropertyUtil.SetValue(ZhiFuChuan.strEndRunCopy, ZhiFuChuan.strWrong); } SetDefaultIntervalTime(); string s = PropertyUtil.GetValue(ZhiFuChuan.strIntervalTimeNum); int result = 0; int.TryParse(s, out result); s = result.ToString(); if (string.IsNullOrEmpty(PropertyUtil.GetValue(ZhiFuChuan.strIntervalTimeType))) { string str5 = ZhiFuChuan.strIntervalTimeTypeValue[0]; PropertyUtil.SetValue(ZhiFuChuan.strIntervalTimeType, str5); } string strDefaultPathCopy = PropertyUtil.GetValue(ZhiFuChuan.strPathCopy); if (!string.IsNullOrEmpty(strDefaultPathCopy) && !Directory.Exists(strDefaultPathCopy)) { Directory.CreateDirectory(strDefaultPathCopy); } if (string.IsNullOrEmpty(strDefaultPathCopy) || !Directory.Exists(strDefaultPathCopy)) { strDefaultPathCopy = ZhiFuChuan.strDefaultPathCopy; PropertyUtil.SetValue(ZhiFuChuan.strPathCopy, strDefaultPathCopy); } } catch (BaseException exception) { _Loger.Error(exception.Message); ExceptionHandler.HandleError(exception); } catch (Exception exception2) { _Loger.Error(exception2.Message); ExceptionHandler.HandleError(exception2); } }
public void LoadAssessment_WithOtherSedatives_HasOtherSedativesSubstanceRelatedSectionRoutesCreated() { var assessment = CreateAssessment(); assessment.DrugAndAlcoholSection.UsedSubstances.ReviseProperty(assessmentId, PropertyUtil.ExtractPropertyName(() => assessment.DrugAndAlcoholSection.UsedSubstances.SubstanceHasEverUsed), new List <SubstanceCategory> { SubstanceCategory.OtherSedatives }); var mockAssessmentRepository = new Mock <IAssessmentRepository>(); mockAssessmentRepository.Setup(r => r.GetByKey(It.IsAny <long>())).Returns(assessment); var asamRouteNavigationService = new AsamRouteNavigationService(mockAssessmentRepository.Object); asamRouteNavigationService.LoadAssessment(assessmentId); var expectedSubSections = new List <string> { "OtherSedativeUse", "DrugConsequences", "CiwaScale", "AddictionTreatmentHistory", "AdditionalAddictionAndTreatmentItems", "AlcoholAndDrugInterviewerRating" }; var sectionsExpectedFound = asamRouteNavigationService.OrderedRouteInfoList.Where( route => route.Section == "DrugAndAlcoholSection" && expectedSubSections.Contains(route.SubSection)); var otherSections = asamRouteNavigationService.OrderedRouteInfoList.Where( route => route.Section == "DrugAndAlcoholSection" && route.SubSection != "UsedSubstances" && !expectedSubSections.Contains(route.SubSection)); Assert.IsTrue(sectionsExpectedFound.Count() == expectedSubSections.Count && !otherSections.Any()); }
/// <summary> /// Calculates the order diff. /// </summary> /// <param name="oldOrder">The old order.</param> /// <param name="newOrder">The new order.</param> /// <param name="addedFields">The added fields.</param> /// <param name="removedFields">The removed fields.</param> /// <param name="changedFields">The changed fields.</param> protected virtual void CalculateOrderDiff([NotNull] Order oldOrder, [NotNull] Order newOrder, [CanBeNull] out IEnumerable <string> addedFields, [CanBeNull] out IEnumerable <string> removedFields, [CanBeNull] out IEnumerable <string> changedFields) { Assert.ArgumentNotNull(oldOrder, "oldOrder"); Assert.ArgumentNotNull(newOrder, "newOrder"); var overrides = new KeyValuePair <KeyValuePair <Type, Type>, Func <object, object, IEnumerable <string> > >(new KeyValuePair <Type, Type>(typeof(DateTime), typeof(DateTime)), this.DateTimeComparator); IEnumerable <string> differentFields = PropertyUtil.GetDifferentFields(oldOrder, newOrder, true, overrides); addedFields = this.GetAddedEntityFields(oldOrder, newOrder, differentFields); var diffForRemoved = differentFields.Except(addedFields); removedFields = this.GetAddedEntityFields(newOrder, oldOrder, diffForRemoved); var diffForChanged = diffForRemoved.Except(removedFields).Where(f => !f.EndsWith(".Alias")); changedFields = this.FilterChangedFields(oldOrder, newOrder, diffForChanged); }
/// <summary> /// Gets the name of the column. /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="entityPropertyType">Type of the entity property.</param> /// <param name="entityPropertyName">Name of the entity property.</param> /// <param name="valueObjectType">Type of the value object.</param> /// <param name="valueObjectPropertyType">Type of the value object property.</param> /// <param name="valueObjectPropertyName">Name of the value object property.</param> /// <param name="shortNameIndicator">If set to <c>true</c> [short name indicator].</param> /// <returns>The column name.</returns> public virtual string GetColumnName( Type entityType, Type entityPropertyType, string entityPropertyName, Type valueObjectType, Type valueObjectPropertyType, string valueObjectPropertyName, bool shortNameIndicator = false) { var name = entityPropertyName; if (valueObjectPropertyName != PropertyUtil.ExtractPropertyName <EmailAddress, string> (p => p.Address)) { name += valueObjectPropertyName; } return(name); }
protected override void OnAssetDataLoaded(SocialImportanceAsset asset) { attributionRules = new BindingListView <AttributionRuleDTO>((IList)null); dataGridViewAttributionRules.DataSource = this.attributionRules; _attRuleConditionSetEditor.View = conditions; conditions = new ConditionSetView(); _attRuleConditionSetEditor.View = conditions; conditions.OnDataChanged += ConditionSetView_OnDataChanged; attributionRules.DataSource = LoadedAsset.GetAttributionRules().ToList(); EditorTools.HideColumns(dataGridViewAttributionRules, new[] { PropertyUtil.GetPropertyName <AttributionRuleDTO>(o => o.Id), PropertyUtil.GetPropertyName <AttributionRuleDTO>(o => o.Conditions) }); _wasModified = false; }
/// <summary> /// Handles the specified message. /// </summary> /// <param name="message">The message.</param> public void Handle(StaffChangedEvent message) { if (message.Property == PropertyUtil.ExtractPropertyName <Staff, PersonName> (s => s.Name)) { var name = message.Value as PersonName; using (var connection = _connectionFactory.CreateConnection()) { connection.Execute( "UPDATE OrganizationModule.TeamStaff SET FirstName = @FirstName, LastName = @LastName WHERE StaffKey = @StaffKey", new { StaffKey = message.Key, name.FirstName, name.LastName }); } } }
/// <summary> /// Handles the specified message. /// </summary> /// <param name="message">The message.</param> public void Handle(PatientChangedEvent message) { if (message.Property == PropertyUtil.ExtractPropertyName <Patient, PersonName> (patient => patient.Name)) { var name = message.Value as PersonName; using (var connection = _connectionFactory.CreateConnection()) { connection.Execute( "UPDATE OrganizationModule.TeamPatient SET FirstName = @FirstName, LastName = @LastName WHERE PatientKey = @PatientKey", new { PatientKey = message.Key, name.FirstName, name.LastName }); } } }
/// <summary> /// Builds the command. /// </summary> /// <param name="propertyExpression">The property expression.</param> /// <param name="navigateTo">The navigate to.</param> /// <param name="canNavigateTo">The can navigate to.</param> /// <returns>A <see cref="Rem.Ria.Infrastructure.Navigation.INavigationCommand"/></returns> public INavigationCommand BuildCommand( Expression <Func <object> > propertyExpression, Action <KeyValuePair <string, string>[]> navigateTo, Func <KeyValuePair <string, string>[], bool> canNavigateTo = null) { var commandName = PropertyUtil.ExtractPropertyName(propertyExpression); var navigationCommand = new NavigationCommand(navigateTo, canNavigateTo); if (_commandList.ContainsKey(commandName)) { _commandList[commandName] = navigationCommand; } else { _commandList.Add(commandName, navigationCommand); } return(navigationCommand); }
public void TestSetProperties() { Options options = new Options(); var properties = new StringDictionary { { "firstName", "foo" }, { "lastName", "bar" }, { "numberValue", "5" }, { "booleanValue", "true" }, }; PropertyUtil.SetProperties(options, properties); Assert.AreEqual("foo", options.FirstName); Assert.AreEqual("bar", options.LastName); Assert.AreEqual(5, options.NumberValue); Assert.AreEqual(true, options.BooleanValue); }
public async Task <ActionResult <QueryResultResource <ReadEventResource> > > GetUserAttendingEvents([FromQuery] FilterEventResource filter) { var userId = Guid.Parse(HttpContext.User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value); var eventQuery = Mapper.Map <FilterEventResource, EventQuery>(filter); if (string.IsNullOrEmpty(eventQuery.SortBy)) { Expression <Func <Attendance, DateTime> > sortingExpression = a => a.Event.StartDate; eventQuery.SortBy = PropertyUtil.GetFullPropertyName(sortingExpression); } var attendances = await UnitOfWork.Attendances.GetUserAttendances(userId, eventQuery); var result = Mapper.Map <QueryResult <Attendance>, QueryResultResource <ReadAttendanceEventResource> >(attendances); return(Ok(result)); }
private void InitializeGroupingDescriptions() { _pagedCollectionViewWrapper.GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <ProgramDto, object> (p => p.ProgramCategory), "Program Category")); _pagedCollectionViewWrapper.GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <ProgramDto, object> (p => p.GenderSpecification), "Gender Specification")); _pagedCollectionViewWrapper.GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <ProgramDto, object> (p => p.AgeGroup), "Age Group")); _pagedCollectionViewWrapper.GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <ProgramDto, object> (p => p.TreatmentApproach), "Approach")); }
public void InitializeNulls_EmptyAssessment_NoPropertyNull() { var intializer = new AssessmentNullPropertyInitializer(); var assessment = new Assessment(new Patient(new Organization("Test"), new PersonName("Fred", "Smith"), null, Gender.Male)); intializer.InitializeNulls(assessment); var propertyNames = new List <string> (); RecurseHelper(assessment, propertyNames); propertyNames.Remove(PropertyUtil.ExtractPropertyName(() => assessment.Key)); propertyNames.Remove(PropertyUtil.ExtractPropertyName(() => assessment.CreatedSystemAccount)); propertyNames.Remove(PropertyUtil.ExtractPropertyName(() => assessment.UpdatedSystemAccount)); Assert.IsFalse(propertyNames.Any()); }
/// <summary> /// Hides the specified metadata provider. /// </summary> /// <typeparam name="TProvider">The type of the provider.</typeparam> /// <typeparam name="TProperty">The type of the property.</typeparam> /// <param name="metadataProvider">The metadata provider.</param> /// <param name="propertyExpression">The property expression.</param> /// <returns>A <see cref="System.Boolean"/></returns> public static bool Hide <TProvider, TProperty> (this TProvider metadataProvider, Expression <Func <TProvider, TProperty> > propertyExpression) where TProvider : IMetadataProvider { if (typeof(IMetadataProvider).IsAssignableFrom(typeof(TProperty))) { var metaDataProvider = propertyExpression.Compile().Invoke(metadataProvider) as IMetadataProvider; if (metaDataProvider == null) { return(false); } return(Hide(metaDataProvider)); } var propertyName = PropertyUtil.ExtractPropertyName(propertyExpression); return(HandleMetadataItemDto(metadataProvider.MetadataDto, propertyName, true, new HiddenMetadataItemDto { IsHidden = true })); }
private void InitializeGroupingDescriptions() { GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <PatientAccessEventDto, object> ( p => p.PatientName), "Patient Name")); GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <PatientAccessEventDto, object> ( p => p.UserName), "User Name")); GroupingDescriptions.Add( new CustomPropertyGroupDescription( PropertyUtil.ExtractPropertyName <PatientAccessEventDto, object> ( p => p.PatientAccessEventTypeName), "Access Type")); }