diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..8668dc7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,127 @@ +# Contributing + +Thanks for your interest in contributing! Please read carefully through our guidelines below to ensure that your contribution adheres to our project's standards. + +## Code of Conduct + +To hold a safe space for all contributors, we expect all project participants to adhere to our [Code of Conduct](https://talegen.com/open-source-code-of-conduct). Please do not skip reading this so that you can understand what actions will and will not be tolerated. + +## Issue Tracking + +For this Project, we use [GitHub Issues](https://github.com/Talegen/Talegen.Common.Models/issues) to track all tasks related to this project. + +## Style Guide + +We follow the [Talegen Style Guide for C#](https://talegen.com/c-programming-style-guide/). + +**We will not accept contributions with StyleCop errors.** + +## Build the project locally + +In order to contribute to a project on GitHub, you must first get a copy of the project running locally on your computer. This process is sometimes called a "build process", and every project's process will have different requirements. Some requirements are due to the project being hosted on GitHub, some are due to the programming language used, some are due to the project's dependencies. + +There are five steps to building this project: + +1. [Set up Git and Install Visual Stuido](#set-up-git-and-install-visualstudio) +1. [Fork the repository](#fork-the-repository) +1. [Clone your fork](#clone-your-fork) +1. [Install dependencies](#install-dependencies) +1. [Run the project](#run-the-project) + +Once you get the project built, see if you can fix some [issues](https://github.com/Talegen/Talegen.Common.Models/issues). + +### Set up Git and Install Visual Studio + +> **If you've never written C# before, don't sweat!** This exercise only requires fundamental language skills, you should be able to adapt from your favorite language. + +All GitHub projects are backed by a version control software called *Git*. You'll need to [set up Git](https://duckduckgo.com/?q=setting+up+git&atb=v134-1&ia=web) in order to contribute to *any* project on GitHub. + +This specific project is written in C# and was built with Visual Studio. You can use this IDE or Visual Studio Code. + +### Fork the repository + +A *fork* is a copy of a repository. Forking a repository lets you to make changes to your copy without affecting any of the original code. + +Click **Fork** (in the top-right corner of the page) to copy this repository to your GitHub account. + +### Clone your fork + +A *clone* is a downloaded version of a repository. Cloning our fork lets you download a copy of the repository to your computer. + +Use `git` to clone your fork + +``` +$ git clone https://github.com/YOUR-USERNAME/Talegen.Common.Models +``` + +### Install dependencies + +Did you know that the author usually does not write all of the code in a project? + +The beauty of open source is that you can install and use code that other people have written, allowing you to focus on the unique requirements of your project. Third-party code that your project installs is called a *dependency* because it is required to work. + +This project uses [nuget.org](https://www.nuget.org/), a package repository for .NET projects, to maintain third-party dependencies. + +Package retrieval should be automatic at build time. There is no need for commands to retrieve these dependencies. + +**Dependency version control will be handled by Talegen. Do not submit dependency changes without specific required changes.** + +### Run the project + +You should build the project with 0 warnings and 0 errors before submitting any changes. + +## Submit a Pull Request + +Remember how making changes on a *fork* doesn't affect the original code? Well, in order to fix an issue in the main project, you *want* to change the original code. A *pull request* is a GitHub feature that lets you do just that! + +There are three steps to submitting a pull request: +1. [Save your changes locally](#save-your-changes-locally) +2. [Send your changes to your fork](#send-your-changes-to-your-fork) +3. [Open a Pull Request](#open-a-pull-request) + +These instructions are designed to explain the bare minimum steps in a beginner-friendly way. If you find yourself hungry for more details (or get stuck), I applaud and encourage you to continue research on your own. You'll find no lack of amazing articles on this topic. + +### Save your changes locally + +First, get a list of all the files you have changed. +``` +$ git status +``` + +Next, *stage* the file you want to save. This will add the file to a new list that is ready to be saved. +``` +$ git add src/calculator.cs +``` + +Next, verify that the file has been staged correctly. Notice that the text color has changed, and your file is now in a list that says "Changes to be committed" instead of "Changes not staged for commit" +``` +$ git status +``` + +Finally, save your staged files. +``` +$ git commit -m "Implement _check" +``` + +You'll often hear this process called *committing* changes. It's the exact same thing. + +### Send your changes to your fork + +With one simple `git` command, you can send the changes you just committed locally to your *fork* on GitHub. + +``` +$ git push origin master +``` + +### Open a Pull Request + +1. Find the [New Pull Request](https://github.com/danthareja/contribute-to-open-source/compare/) button +2. Select the option to **compare across forks** +3. Select **your username** in the `head fork` option +4. Select **your username** in the `base` option +4. Click **Create Pull Request** + + + +## License +By contributing, you agree that your contributions will be licensed under its Apache 2.0 license. \ No newline at end of file diff --git a/README.md b/README.md index 6a24d4c..716e178 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ # Talegen.Common.Models -Talegen Common Models Used By many other Model libraries + +Talegen **Common** Model Library + +This repository ([Talegen.Common.Models](https://github.com/Talegen/Talegen.Common.Models)) is where we (Talegen) develop the Talegen Common Models library. The source code here is available to everyone under the standard [Apache 2.0 license](https://github.com/talegen/Talegen.PureBlue.Models/blob/main/LICENSE). + +The purpose of this library is to provide common/useful models typically used by applications created by Talegen. + +## Contributing + +There are many ways in which you can participate in the project, for example: + + - Submit bugs and feature requests, and help us verify as they are checked in. + - Review source code changes. + - Review the documentation and make pull requests for anything from typos to new content. + +If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute, which covers the following: + + - How to build and run from source + - The development workflow, including debugging and running tests. + - Coding and style guidelines + - Submitting code changes (pull requests) + - Contributing to translations + +## Feedback + + - Ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/Talegen) + - [Request a new feature](https://github.com/talegen/Talegen.Common.Models/blob/main/CONTRIBUTING.md). + - Up vote [popular feature requests](https://github.com/talegen/Talegen.Common.Models/issues?q=is:open%20is:issue%20label:feature-request%20sort:reactions-%2b1-desc). + - [File an issue](https://github.com/talegen/Talegen.Common.Models/issues). + - Follow [@TalegenInc](https://twitter.com/TalegenInc) and let us know what you think! + +## Related Projects + +Many projects and products rely on this Talegen Common Models library. Many of these projects live in their own repositories on GitHub. For example, the Talegen.Tenant.Models utilizes the common models. + +## Code of Conduct + +This project has adopted the [Talegen Open Source Code of Conduct](https://talegen.com/open-source-code-of-conduct/). For more information see the Code of Conduct FAQ or [contact us](https://talegen.com/contact/) with additional questions or comments. + +## License + +Copyright © Talegen, LLC. All rights reserved. \ No newline at end of file diff --git a/src/Assets/logo.ico b/src/Assets/logo.ico new file mode 100644 index 0000000..207046a Binary files /dev/null and b/src/Assets/logo.ico differ diff --git a/src/Assets/logo.png b/src/Assets/logo.png new file mode 100644 index 0000000..733f8e0 Binary files /dev/null and b/src/Assets/logo.png differ diff --git a/src/Constants.cs b/src/Constants.cs new file mode 100644 index 0000000..aca2975 --- /dev/null +++ b/src/Constants.cs @@ -0,0 +1,41 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models +{ + using System.Collections.Generic; + + /// + /// Contains a static set of common default values. + /// + public static class Defaults + { + /// + /// The default language code. English. + /// + public const string DefaultLanguageCode = "en"; + + /// + /// The default time zone offset. + /// + public const string DefaultTimeZone = "UTC"; + + /// + /// Available common titles. + /// + public static List CommonNamePrefixes => new List { "Dr.", "Miss", "Mr.", "Mrs.", "Ms.", "Prof.", "Sir" }; + } +} \ No newline at end of file diff --git a/src/Contacts/Address.cs b/src/Contacts/Address.cs new file mode 100644 index 0000000..40561da --- /dev/null +++ b/src/Contacts/Address.cs @@ -0,0 +1,124 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// Contains an enumerated list of address types. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum AddressTypes + { + /// + /// A home address. + /// + Home, + + /// + /// A work address. + /// + Work, + + /// + /// A business address. + /// + Business, + + /// + /// Other type of address. + /// + Other + } + + /// + /// Contains an enumerated list of commerce address types + /// + public enum CommerceAddressTypes + { + /// + /// The billing address. + /// + Billing, + + /// + /// The mailing address. + /// + Mailing + } + + /// + /// This class represents the basic postal address for an entity. + /// + public class Address + { + /// + /// Gets or sets the primary address street. + /// + /// The primary address street. + public string Street1 { get; set; } + + /// + /// Gets or sets the secondary address street. + /// + /// The secondary address street. + public string Street2 { get; set; } + + /// + /// Gets or sets the address city. + /// + /// The address city. + public string City { get; set; } + + /// + /// Gets or sets the address state/region. + /// + /// The state of the address state/region. + public string RegionState { get; set; } + + /// + /// Gets or sets the address postal/zip code. + /// + /// The state of the address postal/zip code. + public string PostalCode { get; set; } + + /// + /// Gets or sets the address country. + /// + /// The address country. + public string Country { get; set; } + + /// + /// Gets or sets the type. + /// + /// The type. + public AddressTypes Type { get; set; } + + /// + /// Gets or sets the type of the commerce. + /// + /// The type of the commerce. + public CommerceAddressTypes CommerceType { get; set; } + + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. + public bool Primary { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/Contact.cs b/src/Contacts/Contact.cs new file mode 100644 index 0000000..5dd90fb --- /dev/null +++ b/src/Contacts/Contact.cs @@ -0,0 +1,87 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using System; + using System.Collections.Generic; + + /// + /// This class represents a contact record. + /// + public class Contact + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public Guid Id { get; set; } + + /// + /// Gets or sets the name of the primary contact name. + /// + /// The name of the primary contact name. + public ContactName Names { get; set; } = new ContactName(); + + /// + /// Gets or sets the company. + /// + /// The company. + public ContactCompany Company { get; set; } = new ContactCompany(); + + /// + /// Gets or sets the phone numbers. + /// + /// The phone numbers. + public List PhoneNumbers { get; set; } = new List(); + + /// + /// Gets or sets the email addresses. + /// + /// The email addresses. + public List EmailAddresses { get; set; } = new List(); + + /// + /// Gets or sets the job title. + /// + /// The job title. + public string JobTitle { get; set; } + + /// + /// Gets or sets the website. + /// + /// The website. + public string Website { get; set; } + + /// + /// Gets or sets the instant messenger. + /// + /// The instant messenger. + public string IM { get; set; } + + /// + /// Gets or sets the notes. + /// + /// The notes. + public string Notes { get; set; } + + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. + public bool Primary { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/ContactCompany.cs b/src/Contacts/ContactCompany.cs new file mode 100644 index 0000000..541514f --- /dev/null +++ b/src/Contacts/ContactCompany.cs @@ -0,0 +1,69 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using System; + using System.Collections.Generic; + + /// + /// This class represents a minimum company contact record. + /// + public class ContactCompany + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public Guid Id { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the website. + /// + /// The website. + public string Website { get; set; } + + /// + /// Gets or sets the phone. + /// + /// The phone. + public Phone Phone { get; set; } + + /// + /// Gets or sets the email. + /// + /// The email. + public Email Email { get; set; } + + /// + /// Gets or sets the location. + /// + /// The location. + public List Locations { get; set; } = new List(); + + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. + public bool Primary { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/ContactDetails.cs b/src/Contacts/ContactDetails.cs new file mode 100644 index 0000000..65644dc --- /dev/null +++ b/src/Contacts/ContactDetails.cs @@ -0,0 +1,140 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using System; + using System.Collections.Generic; + using System.Text; + using Talegen.Common.Models.Metadata; + + /// + /// Contains an enumerated list of gender types. + /// + public enum GenderTypes + { + /// + /// No gender specified. + /// + None, + + /// + /// Male gender. + /// + Male, + + /// + /// Female gender. + /// + Female, + + /// + /// Non-biological identity. + /// + Other + } + + /// + /// Contains an extended set of contact details. + /// + /// + public class ContactDetails : Contact + { + /// + /// Gets or sets the customer identifier. + /// + /// The customer identifier. + public string CustomerId { get; set; } + + /// + /// Gets or sets the nickname. + /// + /// The nickname. + public string Nickname { get; set; } + + /// + /// Gets or sets the office. + /// + /// The office. + public string Office { get; set; } + + /// + /// Gets or sets the profession. + /// + /// The profession. + public string Profession { get; set; } + + /// + /// Gets or sets the name of the manager. + /// + /// The name of the manager. + public string ManagerName { get; set; } + + /// + /// Gets or sets the name of the assistant. + /// + /// The name of the assistant. + public string AssistantName { get; set; } + + /// + /// Gets or sets the name of the spouse partner. + /// + /// The name of the spouse partner. + public string SpousePartnerName { get; set; } + + /// + /// Gets or sets the children. + /// + /// The children. + public string Children { get; set; } + + /// + /// Gets or sets the birthday. + /// + /// The birthday. + public DateTime? Birthday { get; set; } + + /// + /// Gets or sets the anniversary. + /// + /// The anniversary. + public DateTime? Anniversary { get; set; } + + /// + /// Gets or sets the gender. + /// + /// The gender. + public GenderTypes Gender { get; set; } = GenderTypes.None; + + /// + /// Gets or sets the language. + /// + /// The language. + public string Language { get; set; } = Defaults.DefaultLanguageCode; + + /// + /// Gets or sets the time zone. + /// + /// The time zone. + public string TimeZone { get; set; } = Defaults.DefaultTimeZone; + + /// + /// Gets or sets the tags. + /// + /// The tags. + public List Tags { get; set; } = new List(); + } +} \ No newline at end of file diff --git a/src/Contacts/ContactName.cs b/src/Contacts/ContactName.cs new file mode 100644 index 0000000..2859900 --- /dev/null +++ b/src/Contacts/ContactName.cs @@ -0,0 +1,66 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + /// + /// This class implements the minimum properties for a contact name. + /// + public class ContactName + { + /// + /// Gets or sets the name of the sir. + /// + /// The name of the sir. + public string PrefixTitle { get; set; } + + /// + /// Gets or sets the first name. + /// + /// The first name. + public string FirstName { get; set; } + + /// + /// Gets or sets the name of the middle. + /// + /// The name of the middle. + public string MiddleName { get; set; } + + /// + /// Gets or sets the last name. + /// + /// The last name. + public string LastName { get; set; } + + /// + /// Gets or sets the suffix title of the name name. + /// + /// The suffix title of the name. + public string SuffixTitle { get; set; } + + /// + /// Gets or sets the display name. + /// + /// The display name. + public string DisplayName => $"{this.PrefixTitle} {this.FirstName} {this.MiddleName} {this.LastName} {this.SuffixTitle}".Trim().Replace(" ", " "); + + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. + public bool Primary { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/Email.cs b/src/Contacts/Email.cs new file mode 100644 index 0000000..75c2e6f --- /dev/null +++ b/src/Contacts/Email.cs @@ -0,0 +1,91 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// Contains an enumerated list of phone types. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum EmailTypes + { + /// + /// Personal e-mail address + /// + Personal, + + /// + /// Work e-mail address + /// + Work, + + /// + /// Support contact e-mail address + /// + Support, + + /// + /// Other e-mail address + /// + Other + } + + /// + /// This class represents a contact e-mail address. + /// + public class Email + { + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the email address. + /// + /// The email address. + public string Address { get; set; } + + /// + /// Gets or sets the type. + /// + /// The type. + public EmailTypes Type { get; set; } + + /// + /// Converts to string. + /// + /// A that represents this instance. + public override string ToString() + { + // format e-mail address based on populated properties. + string email = this.Address; + + if (!string.IsNullOrWhiteSpace(this.Name)) + { + this.Name.Replace("\"", "'"); + string name = this.Name.Contains(" ") ? $"\"{ this.Name}\"" : this.Name; + email = $"{name} <{this.Address}>"; + } + + return email; + } + } +} \ No newline at end of file diff --git a/src/Contacts/Geography.cs b/src/Contacts/Geography.cs new file mode 100644 index 0000000..dc891fd --- /dev/null +++ b/src/Contacts/Geography.cs @@ -0,0 +1,36 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + /// + /// This class represents the bare minimum of a geographic location. + /// + public class Geography : IGeography + { + /// + /// Gets or sets the latitude. + /// + /// The latitude. + public decimal Latitude { get; set; } + + /// + /// Gets or sets the longitude. + /// + /// The longitude. + public decimal Longitude { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/IGeography.cs b/src/Contacts/IGeography.cs new file mode 100644 index 0000000..22b2edd --- /dev/null +++ b/src/Contacts/IGeography.cs @@ -0,0 +1,36 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + /// + /// This interface defines the minimum implementation of a geographic location class. + /// + public interface IGeography + { + /// + /// Gets or sets the latitude. + /// + /// The latitude. + decimal Latitude { get; set; } + + /// + /// Gets or sets the longitude. + /// + /// The longitude. + decimal Longitude { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/Location.cs b/src/Contacts/Location.cs new file mode 100644 index 0000000..c95f7a0 --- /dev/null +++ b/src/Contacts/Location.cs @@ -0,0 +1,46 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using System; + + /// + /// This class represents an address location with associated geographical information and identity. + /// + /// + /// + public class Location : Address, IGeography + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public Guid Id { get; set; } + + /// + /// Gets or sets the latitude. + /// + /// The latitude. + public decimal Latitude { get; set; } + + /// + /// Gets or sets the longitude. + /// + /// The longitude. + public decimal Longitude { get; set; } + } +} \ No newline at end of file diff --git a/src/Contacts/Phone.cs b/src/Contacts/Phone.cs new file mode 100644 index 0000000..8caa93b --- /dev/null +++ b/src/Contacts/Phone.cs @@ -0,0 +1,83 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Contacts +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + + /// + /// Contains an enumerated list of phone types. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum PhoneTypes + { + /// + /// Personal phone number + /// + Personal, + + /// + /// Mobile phone number + /// + Mobile, + + /// + /// Work phone number + /// + Work, + + /// + /// A fax number. + /// + Fax, + + /// + /// Other phone number + /// + Other + } + + /// + /// This class represents a minimum definition of a phone number. + /// + public class Phone + { + /// + /// Gets or sets the country code. + /// + /// The country code. + public string CountryCode { get; set; } + + /// + /// Gets or sets the number. + /// + /// The number. + public string Number { get; set; } + + /// + /// Gets or sets the extension. + /// + /// The extension. + public string Extension { get; set; } + + /// + /// Gets or sets the type. + /// + /// The type. + public PhoneTypes Type { get; set; } + } +} \ No newline at end of file diff --git a/src/Metadata/Category.cs b/src/Metadata/Category.cs new file mode 100644 index 0000000..8783810 --- /dev/null +++ b/src/Metadata/Category.cs @@ -0,0 +1,56 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Metadata +{ + using System; + + /// + /// Contains a minimal definition of a category. + /// + public class Category + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public Guid Id { get; set; } + + /// + /// Gets or sets the parent identifier. + /// + /// The parent identifier. + public Guid? ParentId { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the description. + /// + /// The description. + public string Description { get; set; } + + /// + /// Gets or sets a value indicating whether this is primary. + /// + /// true if primary; otherwise, false. + public bool Primary { get; set; } + } +} \ No newline at end of file diff --git a/src/Metadata/Tag.cs b/src/Metadata/Tag.cs new file mode 100644 index 0000000..2fa787e --- /dev/null +++ b/src/Metadata/Tag.cs @@ -0,0 +1,40 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Metadata +{ + using System; + using System.Collections.Generic; + using System.Text; + + /// + /// This class represents a tag + /// + public class Tag + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public Guid Id { get; set; } + + /// + /// Gets or sets the tag. + /// + /// The tag. + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Settings.StyleCop b/src/Settings.StyleCop new file mode 100644 index 0000000..7fe3464 --- /dev/null +++ b/src/Settings.StyleCop @@ -0,0 +1,19 @@ + + + + + + + False + + + + + False + + + + + + + \ No newline at end of file diff --git a/src/Talegen.Common.Models.csproj b/src/Talegen.Common.Models.csproj new file mode 100644 index 0000000..3a7368f --- /dev/null +++ b/src/Talegen.Common.Models.csproj @@ -0,0 +1,32 @@ + + + + netstandard2.1 + true + true + Apache-2.0 + Copyright (c) Talegen, LLC. All rights reserved. + Talegen, LLC + A set of common models used in SaaS products related to tenant and customer management. + http://talegen.com/ + logo.png + https://github.com/Talegen/Talegen.Common.Models + git + CRM + Initial code release + Assets\logo.ico + false + + + + + + + + + True + + + + + diff --git a/src/Talegen.Common.Models.sln b/src/Talegen.Common.Models.sln new file mode 100644 index 0000000..acf3315 --- /dev/null +++ b/src/Talegen.Common.Models.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30621.155 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Talegen.Common.Models", "Talegen.Common.Models.csproj", "{31E9C063-5754-4DC4-B370-AEAAB800B8F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {31E9C063-5754-4DC4-B370-AEAAB800B8F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {31E9C063-5754-4DC4-B370-AEAAB800B8F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {31E9C063-5754-4DC4-B370-AEAAB800B8F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {31E9C063-5754-4DC4-B370-AEAAB800B8F9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {72E5400A-6113-4E9A-9F9B-AAD9DD6F4F93} + EndGlobalSection +EndGlobal diff --git a/src/Talegen.Common.Models.sln.licenseheader b/src/Talegen.Common.Models.sln.licenseheader new file mode 100644 index 0000000..0144d99 --- /dev/null +++ b/src/Talegen.Common.Models.sln.licenseheader @@ -0,0 +1,51 @@ +extensions: designer.cs generated.cs +extensions: .cs .cpp .h +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ +extensions: .aspx .ascx +<%-- +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ +--%> +extensions: .xml .config .xsd + \ No newline at end of file diff --git a/src/Types/DateTimeRange.cs b/src/Types/DateTimeRange.cs new file mode 100644 index 0000000..4fd031b --- /dev/null +++ b/src/Types/DateTimeRange.cs @@ -0,0 +1,61 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Types +{ + using System; + + /// + /// This class represents a date range of a start date time and end date time. + /// + /// + public class DateTimeRange : IRange + { + /// + /// Gets or sets the start date. + /// + /// The start date. + public DateTime Start { get; set; } + + /// + /// Gets or sets the end date. + /// + /// The end date. + public DateTime End { get; set; } + + /// + /// Includes the specified value. + /// + /// The value. + /// + /// + public bool Includes(DateTime value) + { + return (this.Start <= value) && (value <= this.End); + } + + /// + /// Includes the specified range. + /// + /// The range. + /// + /// + public bool Includes(IRange range) + { + return (this.Start <= range.Start) && (range.End <= this.End); + } + } +} \ No newline at end of file diff --git a/src/Types/IRange.cs b/src/Types/IRange.cs new file mode 100644 index 0000000..1a90519 --- /dev/null +++ b/src/Types/IRange.cs @@ -0,0 +1,51 @@ +/* + * + * (c) Copyright Talegen, LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * +*/ + +namespace Talegen.Common.Models.Types +{ + /// + /// This interface class is used to implement a range class. + /// + /// Contains the type of data for the range. + public interface IRange + { + /// + /// Gets or sets the start. + /// + /// The start. + T Start { get; } + + /// + /// Gets or sets the end. + /// + /// The end. + T End { get; } + + /// + /// Includes the specified value. + /// + /// The value. + /// + bool Includes(T value); + + /// + /// Includes the specified range. + /// + /// The range. + /// + bool Includes(IRange range); + } +} \ No newline at end of file