// -- FILE ------------------------------------------------------------------
// name : CustomerModel.cs
// project : Itenso Community
// created : Jani Giannoudis - 2012.05.05
// language : c#
// environment: .NET 4.0
// copyright : (c) 2004-2012 by Itenso GmbH, Switzerland
// --------------------------------------------------------------------------
using System;
using System.Windows;
using Itenso.Community.XamlPatterns.Presentation.Dependency;
namespace Itenso.Community.XamlPatterns.Program.Presentation.ViewModel.Dependency
{
// ------------------------------------------------------------------------
public class CustomerModel : ItemModel, ICustomerModel
{
// ----------------------------------------------------------------------
public static readonly DependencyProperty FirstNameProperty = DependencyProperty.Register(
"FirstName",
typeof( string ),
typeof( CustomerModel ),
null );
// ----------------------------------------------------------------------
public static readonly DependencyProperty LastNameProperty = DependencyProperty.Register(
"LastName",
typeof( string ),
typeof( CustomerModel ),
null );
// ----------------------------------------------------------------------
public static readonly DependencyProperty AddressProperty = DependencyProperty.Register(
"Address",
typeof( string ),
typeof( CustomerModel ),
null );
// ----------------------------------------------------------------------
public static readonly DependencyProperty IsNewProperty = DependencyProperty.Register(
"IsNew",
typeof( bool ),
typeof( CustomerModel ),
null );
// ----------------------------------------------------------------------
public static readonly DependencyProperty IsSubscribedProperty = DependencyProperty.Register(
"IsSubscribed",
typeof( bool? ),
typeof( CustomerModel ),
null );
// ----------------------------------------------------------------------
public static readonly DependencyProperty LastModifiedProperty = DependencyProperty.Register(
"LastModified",
typeof( DateTime ),
typeof( CustomerModel ),
null );
// ----------------------------------------------------------------------
public CustomerModel()
{
LastModified = DateTime.Now;
} // CustomerModel
// ----------------------------------------------------------------------
public CustomerModel( string firstName, string lastName, string address,
bool isNew, bool? isSubscribed )
{
FirstName = firstName;
LastName = lastName;
Address = address;
IsNew = isNew;
IsSubscribed = isSubscribed;
LastModified = DateTime.Now;
} // CustomerModel
// ----------------------------------------------------------------------
public string FirstName
{
get { return (string)GetValue( FirstNameProperty ); }
set { SetValue( FirstNameProperty, value ); }
} // FirstName
// ----------------------------------------------------------------------
public string LastName
{
get { return (string)GetValue( LastNameProperty ); }
set { SetValue( LastNameProperty, value ); }
} // LastName
// ----------------------------------------------------------------------
public string FullName
{
get { return FirstName + " " + LastName; }
} // FullName
// ----------------------------------------------------------------------
public string Address
{
get { return (string)GetValue( AddressProperty ); }
set { SetValue( AddressProperty, value ); }
} // Address
// ----------------------------------------------------------------------
public bool IsNew
{
get { return (bool)GetValue( IsNewProperty ); }
set { SetValue( IsNewProperty, value ); }
} // IsNew
// ----------------------------------------------------------------------
public bool? IsSubscribed
{
get { return (bool?)GetValue( IsSubscribedProperty ); }
set { SetValue( IsSubscribedProperty, value ); }
} // IsSubscribed
// ----------------------------------------------------------------------
public DateTime LastModified
{
get { return (DateTime)GetValue( LastModifiedProperty ); }
set { SetValue( LastModifiedProperty, value ); }
} // LastModified
// ----------------------------------------------------------------------
public int CompareTo( object obj )
{
CustomerModel compare = obj as CustomerModel;
return compare == null ? 0 : String.CompareOrdinal( FullName, compare.FullName );
} // CompareTo
// ----------------------------------------------------------------------
public override string ToString()
{
return FullName;
} // ToString
} // class CustomerModel
} // namespace Itenso.Community.XamlPatterns.Program.Presentation.ViewModel.Dependency
// -- EOF -------------------------------------------------------------------