using Sarand.BusinessMgr.Net.Standard.Base.App; using Sarand.Net.Standard.Base.Bus; using Sarand.Net.Standard.Base.ReferenceData; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Sarand.BusinessMgr.Net.Standard.Base.Data { //======================================================================= /// /// Organisation and User info for Repository initialisation. /// public class SbmRepositoryPopulationData { //------------------------------------------------------------------- public SbmRepositoryPopulationData() { } //------------------------------------------------------------------- // Definitions. // Repository configuration public class RepositoryConfigurationData { } // Owner Organisation configuration public class OwnerConfigurationData { } // User Account. public class UserAccount { public SysId AffiliateIdOwner { get; set; } public String FirstName { get; set; } public String LastName { get; set; } public String Email { get; set; } public String MemberCode { get; set; } /// /// User (security) code defaults to Email if not specified. /// public String UserCode { get; set; } public String Password { get; set; } public String SecurityGroupCode { get; set; } } // Contacts. public class AffiliateData { protected AffiliateData(Sbm.AffiliateType type) { this.Type = type; } public Sbm.AffiliateType Type { get; } // Addresses. public List Addresses { get; } = new List(); // Associations - Customer. public CustomerData Customer { get; private set; } public void SetCustomer(String code) { Customer = new CustomerData() { Code = code }; } public void ClearCustomer() { Customer = null; } // Associations - Supplier. public SupplierData Supplier { get; private set; } public void SetSupplier(String code) { Supplier = new SupplierData() { Code = code }; } public void ClearSupplier() { Supplier = null; } // Associations - Member. public MemberData Member { get; private set; } public void SetMember(String code, String role) { Member = new MemberData() { Code = code, Role = role }; } public void ClearMember() { Member = null; } } public class IndividualData : AffiliateData { public IndividualData() : base(Sbm.AffiliateType.Individual) { } public String Title { get; set; } public String Initials { get; set; } public String FirstName { get; set; } public String LastName { get; set; } public String Email { get; set; } public String PhoneMain { get; set; } public String PhoneMobile { get; set; } } public class OrganisationData : AffiliateData { protected OrganisationData(Sbm.AffiliateType type) : base(type) { } public String Name { get; set; } public String Abbr { get; set; } public String Nature { get; set; } public String Contact { get; set; } public String PhoneMain { get; set; } public String PhoneAlt { get; set; } public String VatReg { get; set; } public String CompanyNo { get; set; } public String Website { get; set; } } public class CommercialOrganisationData : OrganisationData { public CommercialOrganisationData() : base(Sbm.AffiliateType.Commercial) { } } public class CharityOrganisationData : OrganisationData { public CharityOrganisationData() : base(Sbm.AffiliateType.Charity) { } } // Addresses. public class AddressData { protected AddressData(Sbm.AddressType type) { this.Type = type; } public Sbm.AddressType Type { get; } public String Line1 { get; set; } public String Line2 { get; set; } public String Line3 { get; set; } public String City { get; set; } public String Province { get; set; } public String Postcode { get; set; } public String Country { get; set; } } // Associations. public class AssociationData { protected AssociationData(Sbm.AssociationType type) { this.Type = type; } public Sbm.AssociationType Type { get; } public String Code { get; set; } public String Location { get; set; } public String Role { get; set; } public String PhoneMain { get; set; } } public class CustomerData : AssociationData { public CustomerData() : base(Sbm.AssociationType.Customer) { } } public class SupplierData : AssociationData { public SupplierData() : base(Sbm.AssociationType.Supplier) { } } public class MemberData : AssociationData { public MemberData() : base(Sbm.AssociationType.Member) { } } // Commodities. public class CommodityData { protected CommodityData(Sbm.CommodityType type) { this.Type = type; } public Sbm.CommodityType Type { get; } public String Code { get; set; } public String Caption { get; set; } public decimal SalePrice { get; set; } public SaUomType SaleUnitType { get; set; } = SaUomType.Pack_Each; } public class StockCommodityData : CommodityData { public StockCommodityData() : base(Sbm.CommodityType.Stock) { } } public class NonStockCommodityData : CommodityData { public NonStockCommodityData() : base(Sbm.CommodityType.NonStock) { } } public class ServiceCommodityData : CommodityData { public ServiceCommodityData() : base(Sbm.CommodityType.Service) { SaleUnitType = SaUomType.Time_Hour; } } //------------------------------------------------------------------- // Properties. /// Repository initialisation data. public SbmRepositoryInitialisationData InitData { get; } = new SbmRepositoryInitialisationData(); public SysId AffiliateIdOrganisation { get { return InitData.Organisation.AffiliateId; } } /// Repository congiruation options. public RepositoryConfigurationData RepositoryConfiguration { get; } = new RepositoryConfigurationData(); /// Owner configuration options. public OwnerConfigurationData OwnerConfiguration { get; } = new OwnerConfigurationData(); /// Individuals. public List Individuals { get; } = new List(); /// Organisations. public List Organisations { get; } = new List(); /// Commodities. public List Commodities { get; } = new List(); //------------------------------------------------------------------- } //======================================================================= }