DurnyklyYol/DurnyklyYol.Module/BusinessObjects/CargoRequest.cs

96 lines
2.8 KiB
C#

using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
namespace DurnyklyYol.Module.BusinessObjects
{
[DefaultClassOptions, NavigationItem("Clients & Goods")]
//[ImageName("BO_Contact")]
//[DefaultProperty("DisplayMemberNameForLookupEditorsOfThisType")]
//[DefaultListViewOptions(MasterDetailMode.ListViewOnly, false, NewItemRowPosition.None)]
//[Persistent("DatabaseTableName")]
// Specify more UI options using a declarative approach (https://documentation.devexpress.com/#eXpressAppFramework/CustomDocument112701).
public class CargoRequest : BaseObject
{ // Inherit from a different class to provide a custom primary key, concurrency and deletion behavior, etc. (https://documentation.devexpress.com/eXpressAppFramework/CustomDocument113146.aspx).
// Use CodeRush to create XPO classes and properties with a few keystrokes.
// https://docs.devexpress.com/CodeRushForRoslyn/118557
public CargoRequest(Session session)
: base(session)
{
}
public override void AfterConstruction()
{
base.AfterConstruction();
CreatedAt = DateTime.Now;
Status = RequestStatus.New;
}
RequestStatus status;
string to;
string from;
string description;
string goodsType;
DateTime createdAt;
Client client;
[Association("Client-CargoRequests")]
public Client Client
{
get => client;
set => SetPropertyValue(nameof(Client), ref client, value);
}
public DateTime CreatedAt
{
get => createdAt;
set => SetPropertyValue(nameof(CreatedAt), ref createdAt, value);
}
[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string GoodsType
{
get => goodsType;
set => SetPropertyValue(nameof(GoodsType), ref goodsType, value);
}
[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string Description
{
get => description;
set => SetPropertyValue(nameof(Description), ref description, value);
}
[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string From
{
get => from;
set => SetPropertyValue(nameof(From), ref from, value);
}
[Size(SizeAttribute.DefaultStringMappingFieldSize)]
public string To
{
get => to;
set => SetPropertyValue(nameof(To), ref to, value);
}
public RequestStatus Status
{
get => status;
set => SetPropertyValue(nameof(Status), ref status, value);
}
}
public enum RequestStatus
{
New,
Accepted,
Rejected
}
}