0% found this document useful (0 votes)
73 views7 pages

Modelos ECommerce App

The document defines 14 classes that model the entities and relationships in an e-commerce application. The classes include Category, City, Company, Customer, Department, Inventory, Order, Product, Sale, Tax, and User. Each class defines properties for its attributes and relationships to other classes using attributes like PrimaryKey, OneToMany, and ManyToOne.

Uploaded by

Daniel Jiménez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
73 views7 pages

Modelos ECommerce App

The document defines 14 classes that model the entities and relationships in an e-commerce application. The classes include Category, City, Company, Customer, Department, Inventory, Order, Product, Sale, Tax, and User. Each class defines properties for its attributes and relationships to other classes using attributes like PrimaryKey, OneToMany, and ManyToOne.

Uploaded by

Daniel Jiménez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Modelos ECommerce App

Contenido
1 Category .......................................................................................................................................................................... 1
2 City .................................................................................................................................................................................. 1
3 Company ......................................................................................................................................................................... 2
4 CompanyCustomer ......................................................................................................................................................... 2
5 Customer ......................................................................................................................................................................... 3
6 Department ..................................................................................................................................................................... 4
7 Inventory ......................................................................................................................................................................... 4
8 LoginRequest................................................................................................................................................................... 4
9 Order ............................................................................................................................................................................... 4
10 Product ........................................................................................................................................................................ 5
11 Response ..................................................................................................................................................................... 6
12 Sale .............................................................................................................................................................................. 6
13 Tax ............................................................................................................................................................................... 6
14 User ............................................................................................................................................................................. 7

1 Category
public class Category
{
[PrimaryKey]
public int CategoryId { get; set; }

public string Description { get; set; }

public int CompanyId { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Product> Products { get; set; }

public override int GetHashCode()


{
return CategoryId;
}
}

2 City
public class City
{
[PrimaryKey]
public int CityId { get; set; }

public string Name { get; set; }


public int DepartmentId { get; set; }

[ManyToOne]
public Department Department { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Customer> Customers { get; set; }

public override int GetHashCode()


{
return CityId;
}
}

3 Company
public class Company
{
[PrimaryKey]
public int CompanyId { get; set; }

public string Name { get; set; }

public string Phone { get; set; }

public string Address { get; set; }

public string Logo { get; set; }

public int DepartmentId { get; set; }

public int CityId { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<User> Users { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Product> Products { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<CompanyCustomer> CompanyCustomers { get; set; }

public override int GetHashCode()


{
return CompanyId;
}
}

4 CompanyCustomer
public class CompanyCustomer
{
[PrimaryKey]
public int CompanyCustomerId { get; set; }

public int CompanyId { get; set; }

public int CustomerId { get; set; }

[ManyToOne]
public Company Company { get; set; }

[ManyToOne]
public Customer Customer { get; set; }
public override int GetHashCode()
{
return CompanyCustomerId;
}
}

5 Customer
public class Customer
{
[PrimaryKey, AutoIncrement]
public int CustomerId { get; set; }

public string UserName { get; set; }

public string FirstName { get; set; }

public string LastName { get; set; }

public string Photo { get; set; }

public string Phone { get; set; }

public string Address { get; set; }

public double Latitude { get; set; }

public double Longitude { get; set; }

public int DepartmentId { get; set; }

public int CityId { get; set; }

[ManyToOne]
public Department Department { get; set; }

[ManyToOne]
public City City { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<CompanyCustomer> CompanyCustomers { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Order> Orders { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Sale> Sales { get; set; }

public bool IsUpdated { get; set; }

public string FullName { get { return string.Format("{0} {1}", FirstName, LastName); } }

public string PhotoFullPath


{
get
{
return Photo == null? string.Empty : string.Format("http://zulu-software.com/ECommerce{0}",
Photo.Substring(1));
}
}

public override int GetHashCode()


{
return CustomerId;
}
}

6 Department
public class Department
{
[PrimaryKey]
public int DepartmentId { get; set; }

public string Name { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<City> Cities { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Customer> Customers { get; set; }

public override int GetHashCode()


{
return DepartmentId;
}
}

7 Inventory
public class Inventory
{
[PrimaryKey]
public int InventoryId { get; set; }

public int ProductId { get; set; }

[ManyToOne]
public Product Product { get; set; }

public int WarehouseId { get; set; }

public string WarehouseName { get; set; }

public double Stock { get; set; }

public override int GetHashCode()


{
return InventoryId;
}
}

8 LoginRequest
public class LoginRequest
{
public string Email { get; set; }

public string Password { get; set; }


}

9 Order
public class Order
{
[PrimaryKey]
public int OrderId { get; set; }
public int CompanyId { get; set; }

public int CustomerId { get; set; }

public int StateId { get; set; }

public string Date { get; set; }

public string Remarks { get; set; }

[ManyToOne]
public Customer Customer { get; set; }

public override int GetHashCode()


{
return OrderId;
}
}

10 Product
public class Product
{
[PrimaryKey]
public int ProductId { get; set; }

public string Description { get; set; }

public string BarCode { get; set; }

public decimal Price { get; set; }

public string Image { get; set; }

public string Remarks { get; set; }

public double Stock { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]

public List<Inventory> Inventories { get; set; }

public int CompanyId { get; set; }

[ManyToOne]
public Company Company { get; set; }

public int CategoryId { get; set; }

[ManyToOne]
public Category Category { get; set; }

public int TaxId { get; set; }

[ManyToOne]
public Tax Tax { get; set; }

public string ImageFullPath { get { return string.Format("http://zulu-software.com/ECommerce{0}",


Image.Substring(1)); } }

public override int GetHashCode()


{
return ProductId;
}
}

11 Response
public class Response
{
public bool IsSucces { get; set; }

public string Message { get; set; }

public object Result { get; set; }


}

12 Sale
public class Sale
{
[PrimaryKey]
public int SaleId { get; set; }

public int CompanyId { get; set; }

public int CustomerId { get; set; }

public int WarehouseId { get; set; }

public int StateId { get; set; }

public int? OrderId { get; set; }

public DateTime Date { get; set; }

public string Remarks { get; set; }

[ManyToOne]
public Customer Customer { get; set; }

public override int GetHashCode()


{
return SaleId;
}
}

13 Tax
public class Tax
{
[PrimaryKey]
public int TaxId { get; set; }

public string Description { get; set; }

public double Rate { get; set; }

public int CompanyId { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<Product> Products { get; set; }

public override int GetHashCode()


{
return TaxId;
}
}

14 User
public class User
{
[PrimaryKey]
public int UserId { get; set; }

public string UserName { get; set; }

public string FirstName { get; set; }

public string LastName { get; set; }

public string Photo { get; set; }

public string Phone { get; set; }

public string Address { get; set; }

public int DepartmentId { get; set; }

public string DepartmentName { get; set; }

public int CityId { get; set; }

public string CityName { get; set; }

[ManyToOne]
public Company Company { get; set; }

public bool IsAdmin { get; set; }

public bool IsUser { get; set; }

public bool IsCustomer { get; set; }

public bool IsSupplier { get; set; }

public bool IsRemembered { get; set; }

public string Password { get; set; }

public string FullName { get { return string.Format("{0} {1}", FirstName, LastName); } }

public string PhotoFullPath { get { return string.Format("http://zulu-software.com/ECommerce{0}",


Photo.Substring(1)); } }

public override int GetHashCode()


{
return UserId;
}
}

You might also like