private void UpdatePartnersComboBox() { EnumerablePartners = SourceFamily.GetEnumerableMembers().Where( m => m.Id != SourceMember.Id && m.BirthDate <= SinceDateTime && (m.DeathDate == null || SinceDateTime <= m.DeathDate) && !m.Refs.PartnerId.Value(SinceDateTime).HasValue ).OrderBy(m => m.BirthDate - SourceMember.BirthDate); PartnersComboBox.Items.Clear(); if (SourceMember.HadPartner(SinceDateTime)) { PartnersComboBox.Items.Add("The partner that time"); } else { PartnersComboBox.Items.Add("No partner selected"); } PartnersComboBox.SelectedIndex = 0; foreach (Member member in EnumerablePartners) { PartnersComboBox.Items.Add(member); } }
private void WithPartnerBtnOnClick(object sender, EventArgs e) { if (PartnersComboBox.SelectedIndex < 1) { PartnersComboBox.Focus(); return; } try { SourceMember.WithPartner( EnumerablePartners.ElementAt(PartnersComboBox.SelectedIndex - 1), SinceDateTimePicker.Value ); UpdatePartnersListBox(); UpdatePartnersComboBox(); UpdateButtons(); SinceDateTimePicker.Focus(); } catch (Exception ex) { if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK) { PartnersComboBox.Focus(); } } }
private void GotMarriedBtnOnClick(object sender, EventArgs e) { if (PartnersComboBox.SelectedIndex == -1 || ( PartnersComboBox.SelectedIndex == 0 && !SourceMember.HadPartner(SinceDateTime) )) { PartnersComboBox.Focus(); return; } try { SourceMember.GotMarried( SinceDateTimePicker.Value, PartnersComboBox.SelectedIndex > 0 ? EnumerablePartners.ElementAt(PartnersComboBox.SelectedIndex - 1) : null ); UpdatePartnersListBox(); UpdateStatusesListBox(); UpdatePartnersComboBox(); UpdateButtons(); SinceDateTimePicker.Focus(); } catch (Exception ex) { if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK) { PartnersComboBox.Focus(); } } }
private Expression GetCondition(Expression nestedAccessChecks, IMemberMapperData mapperData) { if (nestedAccessChecks == null) { return(null); } if (IsNotOptionalEntityMemberId(mapperData)) { return(nestedAccessChecks); } var sourceMemberValue = SourceMember.GetQualifiedAccess(mapperData); var sourceValueType = sourceMemberValue.Type.GetNonNullableType(); if (!sourceValueType.IsNumeric()) { return(nestedAccessChecks); } if (sourceMemberValue.Type.IsNullableType()) { sourceMemberValue = sourceMemberValue.GetNullableValueAccess(); } var zero = 0.ToConstantExpression(sourceValueType); var sourceValueNonZero = Expression.NotEqual(sourceMemberValue, zero); return(Expression.AndAlso(nestedAccessChecks, sourceValueNonZero)); }
public IParameter[] GetParameters() { if (_parameters == null) { _parameters = GenericMapping.MapParameters(SourceMember.GetParameters()); } return(_parameters); }
private void UpdateButtons() { WithoutPartnerBtn.Enabled = SourceMember.HadPartner(SinceDateTime); GotUnmarriedBtn.Enabled = SourceMember.WasMarried(SinceDateTime); GotMarriedBtn.Enabled = !GotUnmarriedBtn.Enabled && ( EnumerablePartners.Any() || SourceMember.HadPartner(SinceDateTime) ); WithPartnerBtn.Enabled = !WithoutPartnerBtn.Enabled && EnumerablePartners.Any(); ClearPartnersHistoryBtn.Enabled = EnumerablePartnersHistory.Count() > 1; RemoveSelectedFullNameBtn.Enabled = FullNamesListBox.SelectedIndex > 0; }
private void Initialize() { SinceDateTime = DateTime.Now; SinceDateTimePicker.MinDate = SourceMember.BirthDate; SinceDateTimePicker.MaxDate = SinceDateTime; MemberTitle.Text = SourceMember.ToString(); UpdatePartnersComboBox(); UpdatePartnersListBox(); UpdateStatusesListBox(); UpdateFullNamesListBox(); UpdateChooseChildren(); UpdateButtons(); }
private void ChangedFullNameBtnOnClick(object sender, EventArgs e) { if (string.IsNullOrEmpty(FullNameTxtBox.Text)) { FullNameTxtBox.Focus(); return; } SourceMember.ChangedFullName( FullNameTxtBox.Text, SinceDateTimePicker.Value ); UpdateFullNamesListBox(); SinceDateTimePicker.Focus(); }
public IDataSource CreateDataSource() { var mapperData = ContextMappingData.MapperData; var sourceMemberValue = SourceMember .GetRelativeQualifiedAccess(mapperData, out var relativeSourceMember) .GetConversionTo(relativeSourceMember.Type); var sourceMemberDataSource = new SourceMemberDataSource( relativeSourceMember, sourceMemberValue, Condition, mapperData); return(sourceMemberDataSource); }
public static void ObjectToConfiguration(Object Source, Object Configuration) { foreach (var SourceMember in Source.GetType().GetFields()) { foreach (var FieldMappingAttribute in SourceMember.GetCustomAttributes(typeof(FieldMapping), true).Cast <FieldMapping>()) { ObjectFieldSet( Configuration, FieldMappingAttribute.ConfigurationField, ObjectFieldGet( ObjectFieldGet(Source, SourceMember.Name), FieldMappingAttribute.ThisField ) ); } } }
private void WithoutPartnerBtnOnClick(object sender, EventArgs e) { try { SourceMember.WithoutPartner(SinceDateTimePicker.Value); UpdatePartnersListBox(); UpdateStatusesListBox(); UpdatePartnersComboBox(); UpdateButtons(); } catch (Exception ex) { if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK) { SinceDateTimePicker.Focus(); } } }
private void ChooseChildrenSaveChangesBtnOnClick(object sender, EventArgs e) { if (EnumerableChildren.Any() || EnumerableOwnChildren.Any()) { EnumerableOwnChildren = EnumerableOwnChildren.ToArray(); for (int i = 0; i < EnumerableOwnChildren.Count(); i++) { if (!ChooseChildren.CheckedIndices.Contains(i)) { SourceMember.Refs.RemoveChild(EnumerableOwnChildren.ElementAt(i)); } } try { EnumerableChildren = EnumerableChildren.ToArray(); foreach (int i in ChooseChildren.CheckedIndices) { if (i >= EnumerableOwnChildren.Count()) { SourceMember.HadChild(EnumerableChildren.ElementAt( i - EnumerableOwnChildren.Count() )); } } } catch (Exception ex) { if (new ValidationFailedDialog(ex.Message).ShowDialog() == DialogResult.OK) { } } } UpdateChooseChildren(); ChooseChildrenSaveChangesBtn.Enabled = false; }
public IMethod GetRaiseMethod() { return(GenericMapping.Map(SourceMember.GetRemoveMethod())); }
public IMethod GetAddMethod() { return(GenericMapping.Map(SourceMember.GetAddMethod())); }
public IParameter[] GetParameters() { return(_parameters ?? (_parameters = GenericMapping.MapParameters(SourceMember.GetParameters()))); }