Skip to content

Commit

Permalink
NoobOrchard
Browse files Browse the repository at this point in the history
基于ABP+Orchard 基础框架
  • Loading branch information
noobwu committed Oct 27, 2017
0 parents commit 34868c2
Show file tree
Hide file tree
Showing 1,675 changed files with 222,318 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
bin/ obj/[Bb]in
obj
[Dd]ebug
[Rr]elease
*.user
*.aps
*.eto
ClientBin
GeneratedArtifacts
_Pvt_Extensions
project.lock.json
*.nuget.props
*.nuget.targets
.*.swp
.DS_Store
.vs
bin
obj
*.log
*Noob.Web.Admin.EasyUI*Logs
packages

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
using OrchardNorthwind.Common.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OrchardNorthwind.Common.Data
{
public static class NorthwindFactory
{
public static readonly List<Type> ModelTypes = new List<Type> {
typeof(OrderDetail),
typeof(Order),
typeof(EmployeeTerritory),
typeof(Employee),
typeof(Product),
typeof(Category),
typeof(Customer),
typeof(Shipper),
typeof(Supplier),
typeof(CustomerCustomerDemo),
typeof(CustomerDemographic),
typeof(Territory),
typeof(Region),
};

public static Category Category(int id, string categoryName, string description, byte[] picture)
{
return new Category
{
Id = id,
CategoryName = categoryName,
Description = description,
Picture = picture
};
}

public static Customer Customer(
string customerId, string companyName, string contactName, string contactTitle,
string address, string city, string region, string postalCode, string country,
string phoneNo, string faxNo,
byte[] picture)
{
return new Customer
{
Id = customerId,
CompanyName = companyName,
ContactName = contactName,
ContactTitle = contactTitle,
Address = address,
City = city,
Region = region,
PostalCode = postalCode,
Country = country,
Phone = phoneNo,
Fax = faxNo,
Picture = picture
};
}

public static Employee Employee(
int employeeId, string lastName, string firstName, string title,
string titleOfCourtesy, DateTime? birthDate, DateTime? hireDate,
string address, string city, string region, string postalCode, string country,
string homePhone, string extension,
byte[] photo,
string notes, int? reportsTo, string photoPath)
{
return new Employee
{
Id = employeeId,
LastName = lastName,
FirstName = firstName,
Title = title,
TitleOfCourtesy = titleOfCourtesy,
BirthDate = birthDate,
HireDate = hireDate,
Address = address,
City = city,
Region = region,
PostalCode = postalCode,
Country = country,
HomePhone = homePhone,
Extension = extension,
Photo = photo,
Notes = notes,
ReportsTo = reportsTo,
PhotoPath = photoPath,
};
}

public static Shipper Shipper(int id, string companyName, string phoneNo)
{
return new Shipper
{
Id = id,
CompanyName = companyName,
Phone = phoneNo,
};
}

public static Supplier Supplier(
int supplierId, string companyName, string contactName, string contactTitle,
string address, string city, string region, string postalCode, string country,
string phoneNo, string faxNo,
string homePage)
{
return new Supplier
{
Id = supplierId,
CompanyName = companyName,
ContactName = contactName,
ContactTitle = contactTitle,
Address = address,
City = city,
Region = region,
PostalCode = postalCode,
Country = country,
Phone = phoneNo,
Fax = faxNo,
HomePage = homePage
};
}

public static Order Order(
int orderId, string customerId, int employeeId, DateTime? orderDate, DateTime? requiredDate,
DateTime? shippedDate, int shipVia, decimal freight, string shipName,
string address, string city, string region, string postalCode, string country)
{
return new Order
{
Id = orderId,
CustomerId = customerId,
EmployeeId = employeeId,
OrderDate = orderDate,
RequiredDate = requiredDate,
ShippedDate = shippedDate,
ShipVia = shipVia,
Freight = freight,
ShipName = shipName,
ShipAddress = address,
ShipCity = city,
ShipRegion = region,
ShipPostalCode = postalCode,
ShipCountry = country,
};
}

public static Product Product(
int productId, string productName, int supplierId, int categoryId,
string qtyPerUnit, decimal unitPrice, short unitsInStock,
short unitsOnOrder, short reorderLevel, bool discontinued)
{
return new Product
{
Id = productId,
ProductName = productName,
SupplierId = supplierId,
CategoryId = categoryId,
QuantityPerUnit = qtyPerUnit,
UnitPrice = unitPrice,
UnitsInStock = unitsInStock,
UnitsOnOrder = unitsOnOrder,
ReorderLevel = reorderLevel,
Discontinued = discontinued,
};
}

public static OrderDetail OrderDetail(
int orderId, int productId, decimal unitPrice, short quantity, double discount)
{
return new OrderDetail
{
OrderId = orderId,
ProductId = productId,
UnitPrice = unitPrice,
Quantity = quantity,
Discount = discount,
};
}

public static CustomerCustomerDemo CustomerCustomerDemo(
string customerId, string customerTypeId)
{
return new CustomerCustomerDemo
{
Id = customerId,
CustomerTypeId = customerTypeId,
};
}

public static Region Region(
int regionId, string regionDescription)
{
return new Region
{
Id = regionId,
RegionDescription = regionDescription,
};
}

public static Territory Territory(
string territoryId, string territoryDescription, int regionId)
{
return new Territory
{
Id = territoryId,
TerritoryDescription = territoryDescription,
RegionId = regionId,
};
}

public static EmployeeTerritory EmployeeTerritory(
int employeeId, string territoryId)
{
return new EmployeeTerritory
{
EmployeeId = employeeId,
TerritoryId = territoryId,
};
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System;
using System.Web;
using System.Data;
using Orchard.Domain.Entities;
namespace OrchardNorthwind.Common.Entities
{
/// <summary>
/// Categories
/// </summary>
[Serializable]
public class Category:Entity<int>
{
/// <summary>
///
/// </summary>
public virtual int CategoryId { get;set; }

/// <summary>
///
/// </summary>
public virtual string CategoryName { get;set;}
/// <summary>
///
/// </summary>
public virtual string Description { get;set;}
/// <summary>
///
/// </summary>
public virtual byte[] Picture { get;set;}


/// <summary>
/// Unique identifier for this entity.
/// </summary>
public override int Id { get { return CategoryId; } set { CategoryId=value; }}
/// <summary>
/// 获取主键的属性名称
/// </summary>
/// <returns></returns>
public override string GetPKPropertyName()
{
return "CategoryId";
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
using System;
using System.Web;
using System.Data;
using Orchard.Domain.Entities;
namespace OrchardNorthwind.Common.Entities
{
/// <summary>
/// Customers
/// </summary>
[Serializable]
public class Customer:Entity<string>
{
/// <summary>
///
/// </summary>
public virtual string CustomerId { get;set; }

/// <summary>
///
/// </summary>
public virtual string CompanyName { get;set;}
/// <summary>
///
/// </summary>
public virtual string ContactName { get;set;}
/// <summary>
///
/// </summary>
public virtual string ContactTitle { get;set;}
/// <summary>
///
/// </summary>
public virtual string Address { get;set;}
/// <summary>
///
/// </summary>
public virtual string City { get;set;}
/// <summary>
///
/// </summary>
public virtual string Region { get;set;}
/// <summary>
///
/// </summary>
public virtual string PostalCode { get;set;}
/// <summary>
///
/// </summary>
public virtual string Country { get;set;}
/// <summary>
///
/// </summary>
public virtual string Phone { get;set;}
/// <summary>
///
/// </summary>
public virtual string Fax { get;set;}
/// <summary>
///
/// </summary>
public virtual byte[] Picture { get;set;}


/// <summary>
/// Unique identifier for this entity.
/// </summary>
public override string Id { get { return CustomerId; } set { CustomerId=value; }}
/// <summary>
/// 获取主键的属性名称
/// </summary>
/// <returns></returns>
public override string GetPKPropertyName()
{
return "CustomerId";
}

}

}
Loading

0 comments on commit 34868c2

Please sign in to comment.