//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Tango Observables Generator
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated. Do not modify!
//
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
using Newtonsoft.Json;
using System.Linq;
using Tango.DAL.Remote.DB;
using Tango.Core;
using System.ComponentModel;
using Tango.Core.CustomAttributes;
namespace Tango.BL.Entities
{
[Table("CUSTOMERS")]
public abstract class CustomerBase : ObservableEntity
{
public event EventHandler NameChanged;
public event EventHandler OrganizationChanged;
public event EventHandler> JobsChanged;
protected String _organizationguid;
///
/// Gets or sets the customerbase organization guid.
///
[Column("ORGANIZATION_GUID")]
[ForeignKey("Organization")]
public String OrganizationGuid
{
get
{
return _organizationguid;
}
set
{
if (_organizationguid != value)
{
_organizationguid = value;
}
}
}
protected String _name;
///
/// Gets or sets the customerbase name.
///
[Column("NAME")]
public String Name
{
get
{
return _name;
}
set
{
if (_name != value)
{
_name = value;
OnNameChanged(value);
}
}
}
protected Organization _organization;
///
/// Gets or sets the customerbase organization.
///
[XmlIgnore]
[JsonIgnore]
public virtual Organization Organization
{
get
{
return _organization;
}
set
{
if (_organization != value)
{
_organization = value;
if (Organization != null)
{
OrganizationGuid = Organization.Guid;
}
OnOrganizationChanged(value);
}
}
}
protected SynchronizedObservableCollection _jobs;
///
/// Gets or sets the customerbase jobs.
///
public virtual SynchronizedObservableCollection Jobs
{
get
{
return _jobs;
}
set
{
if (_jobs != value)
{
_jobs = value;
OnJobsChanged(value);
}
}
}
///
/// Called when the Name has changed.
///
protected virtual void OnNameChanged(String name)
{
NameChanged?.Invoke(this, name);
RaisePropertyChanged(nameof(Name));
}
///
/// Called when the Organization has changed.
///
protected virtual void OnOrganizationChanged(Organization organization)
{
OrganizationChanged?.Invoke(this, organization);
RaisePropertyChanged(nameof(Organization));
}
///
/// Called when the Jobs has changed.
///
protected virtual void OnJobsChanged(SynchronizedObservableCollection jobs)
{
JobsChanged?.Invoke(this, jobs);
RaisePropertyChanged(nameof(Jobs));
}
///
/// Initializes a new instance of the class.
///
public CustomerBase() : base()
{
Jobs = new SynchronizedObservableCollection();
}
}
}