using System; using System.ComponentModel; using System.Windows.Media; using BS.Shared.Translation; namespace BS.Shared.DataContracts { public class FlatSupportConceptTreeNodeDC : INotifyPropertyChanged { private string _CustomerWarning; private string _EmployeeWarning; private bool _IsCustomerWarningActive; private bool _IsEmployeeWarningActive; public event PropertyChangedEventHandler PropertyChanged; public string CostBearerName { get { if (this.SupportConceptTreeNodeDC == null) { return string.Empty; } if (this.SupportConceptTreeNodeDC.CostBearer != null) { String cb = this.SupportConceptTreeNodeDC.CostBearer.ToString(); if (this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC != null && this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.Status != CostBearer2SupportConceptStatus.Approved) { cb = String.Format("{0} (nicht bewilligt)", cb); } return cb; } return string.Empty; } } public string CustomerName { get { if (this.SupportConceptTreeNodeDC == null) { return Translator.Translate(""); } if (this.SupportConceptTreeNodeDC.Customer != null) { return this.SupportConceptTreeNodeDC.Customer.ToString(); } return string.Empty; } } public string CustomerWarning { get { return this._CustomerWarning; } set { this._CustomerWarning = value; this.RaisePropertyChanged("CustomerWarning"); } } public string EmployeeWarning { get { return this._EmployeeWarning; } set { this._EmployeeWarning = value; this.RaisePropertyChanged("EmployeeWarning"); } } public bool ExpiresIn3MonthOrLess { get { if (this.SupportConceptTreeNodeDC != null) { return this.SupportConceptTreeNodeDC.ExpiresIn3MonthOrLess; } return false; } } public bool IsAboutToExpire { get { if (this.SupportConceptTreeNodeDC != null) { return this.SupportConceptTreeNodeDC.IsAboutToExpire; } return false; } } public bool IsCustomerWarningActive { get { return this._IsCustomerWarningActive; } set { this._IsCustomerWarningActive = value; this.RaisePropertyChanged("IsCustomerWarningActive"); } } public bool IsEmployeeWarningActive { get { return this._IsEmployeeWarningActive; } set { this._IsEmployeeWarningActive = value; this.RaisePropertyChanged("IsEmployeeWarningActive"); } } public Brush NodeForegroundBrush { get { if (this.IsAboutToExpire) { return Brushes.Red; } else if (this.ExpiresIn3MonthOrLess) { return Brushes.Yellow; } else { return new SolidColorBrush(Color.FromRgb(160, 160, 160)); } } } public string SupportConceptName { get { if (this.SupportConceptTreeNodeDC == null) { return string.Empty; } // if (this.SupportConceptTreeNodeDC.SupportConcept != null) // return "Plan vom " + this.SupportConceptTreeNodeDC.SupportConcept.ToString(); if (this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC != null) { if ( !string.IsNullOrEmpty( this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.AuswahlBezeichnung)) { return String.Format("{0} {1}", this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.AuswahlBezeichnung, this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.DateRangeString); } return this.SupportConceptTreeNodeDC.SupportConceptCostBearerRelDC.DateRangeString; } return string.Empty; } } public SupportConceptTreeNodeDC SupportConceptTreeNodeDC { get; set; } protected void RaisePropertyChanged(string propertyName) { PropertyChangedEventHandler propertyChanged = this.PropertyChanged; if (propertyChanged != null) { propertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } } }