mirror of
https://github.com/VitalickS/BrightSharp.Toolkit.git
synced 2026-03-21 02:21:15 +00:00
v1.0
This commit is contained in:
@@ -77,8 +77,10 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppleJobsContext.cs" />
|
||||
<Compile Include="Models\Articles\NewsCategory.cs" />
|
||||
<Compile Include="Models\Articles\News.cs" />
|
||||
<Compile Include="Models\Inventory\Accessories.cs" />
|
||||
<Compile Include="Models\Customer.cs" />
|
||||
<Compile Include="Models\Common\Customer.cs" />
|
||||
<Compile Include="Models\Inventory\Employee.cs" />
|
||||
<Compile Include="Models\ModelsJobs\Model.cs" />
|
||||
<Compile Include="Models\ModelsJobs\ModelJobPriceTemplate.cs" />
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using AppleJobs.Data.Models;
|
||||
using AppleJobs.Data.Models.Articles;
|
||||
using AppleJobs.Data.Models.Common;
|
||||
using AppleJobs.Data.Models.Inventory;
|
||||
using AppleJobs.Data.Models.ModelsJobs;
|
||||
using AppleJobs.Data.Models.Orders;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using MySql.Data.Entity;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Data.Entity;
|
||||
|
||||
namespace AppleJobs.Data
|
||||
@@ -41,6 +43,13 @@ namespace AppleJobs.Data
|
||||
|
||||
#endregion
|
||||
|
||||
#region Articles / News
|
||||
|
||||
public DbSet<News> News { get; set; }
|
||||
public DbSet<NewsCategory> NewsCategories { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public AppleJobsContext(string connection = "Default") : base(connection)
|
||||
{
|
||||
}
|
||||
|
||||
25
AppleJobs.Data/Models/Articles/News.cs
Normal file
25
AppleJobs.Data/Models/Articles/News.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.Articles
|
||||
{
|
||||
[Table("ApjNews")]
|
||||
public class News
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Content { get; set; }
|
||||
public int OrderIndex { get; set; }
|
||||
public int CharCount { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
public string State { get; set; }
|
||||
public int CategoryId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(CategoryId))]
|
||||
public virtual NewsCategory NewsCategory { get; set; }
|
||||
|
||||
public string FilterString { get { return string.Join(",", Title, Content, OrderIndex, CharCount, Date, State, NewsCategory.CategoryDescription); } }
|
||||
}
|
||||
}
|
||||
15
AppleJobs.Data/Models/Articles/NewsCategory.cs
Normal file
15
AppleJobs.Data/Models/Articles/NewsCategory.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.Articles
|
||||
{
|
||||
[Table("ApjNewsCategory")]
|
||||
public class NewsCategory
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string CategoryName { get; set; }
|
||||
public string CategoryDescription { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.ModelsJobs
|
||||
namespace AppleJobs.Data.Models.Common
|
||||
{
|
||||
public class Customer
|
||||
{
|
||||
@@ -10,5 +10,6 @@ namespace AppleJobs.Data.Models.ModelsJobs
|
||||
public string Name { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string MainEmail { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models
|
||||
namespace AppleJobs.Data.Models.Inventory
|
||||
{
|
||||
public class Accessories
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models
|
||||
namespace AppleJobs.Data.Models.Inventory
|
||||
{
|
||||
public class Employee
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.ModelsJobs
|
||||
{
|
||||
[TsModel]
|
||||
public class Model
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.ModelsJobs
|
||||
{
|
||||
[TsModel]
|
||||
public class ModelCategory
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.ModelsJobs
|
||||
{
|
||||
[TsModel]
|
||||
public class ModelJob
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AppleJobs.Data.Models.Common;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models.ModelsJobs
|
||||
{
|
||||
[TsModel]
|
||||
public class ModelJobPriceTemplate
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using AppleJobs.Data.Models.ModelsJobs;
|
||||
using AppleJobs.Data.Models.Common;
|
||||
using AppleJobs.Data.Models.Inventory;
|
||||
using AppleJobs.Data.Models.ModelsJobs;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models
|
||||
namespace AppleJobs.Data.Models.Orders
|
||||
{
|
||||
[TsModel]
|
||||
public class OrderView
|
||||
@@ -60,12 +62,14 @@ namespace AppleJobs.Data.Models
|
||||
public bool? IsDrive { get; set; }
|
||||
public int? Price { get; set; }
|
||||
|
||||
#region ForeignKeys
|
||||
public int OrderStatuses_Id { get; set; }
|
||||
public int Models_Id { get; set; }
|
||||
public int? ModelJobs_Id { get; set; }
|
||||
public int Customers_Id { get; set; }
|
||||
public int? Accessories_Id { get; set; }
|
||||
public int? Employees_Id { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
[ForeignKey(nameof(OrderStatuses_Id))]
|
||||
@@ -90,14 +94,8 @@ namespace AppleJobs.Data.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}",
|
||||
Contact, Comment, DateCreated, DateClosed, DateUpdated,
|
||||
OrderStatus?.Name,
|
||||
Model.FilterString,
|
||||
JobModel.FilterString,
|
||||
Customer?.Name,
|
||||
Accessories?.Name,
|
||||
Employee?.Name);
|
||||
return string.Join(",", Contact, Comment, DateCreated, DateClosed, DateUpdated,
|
||||
OrderStatus?.Name, Model.FilterString, JobModel.FilterString, Customer?.Name, Accessories?.Name, Employee?.Name, Price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models
|
||||
namespace AppleJobs.Data.Models.Orders
|
||||
{
|
||||
[TsModel]
|
||||
public class OrderCategory
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AppleJobs.Data.Models
|
||||
namespace AppleJobs.Data.Models.Orders
|
||||
{
|
||||
[TsModel]
|
||||
[Table("OrderStatuses")]
|
||||
|
||||
Reference in New Issue
Block a user