66 lines
2.1 KiB
C#
66 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace EnVisage.Models
|
|
{
|
|
public class FeeCalculationModel
|
|
{
|
|
public System.Guid Id { get; set; }
|
|
public System.Guid ExpenditureCategoryId { get; set; }
|
|
[Required]
|
|
[Display(Name = "Minimum Shot")]
|
|
public int MinShot { get; set; }
|
|
[Required]
|
|
[Display(Name = "Maximum Shot")]
|
|
public int MaxShot { get; set; }
|
|
[Required]
|
|
[Display(Name = "Quantity")]
|
|
public int Quantity { get; set; }
|
|
|
|
public virtual ExpenditureCategory ExpenditureCategory { get; set; }
|
|
|
|
/// <summary>
|
|
/// Casts a <see cref="Fee_Calculation"/> obect to the object of type <see cref="FeeCalculationModel"/>.
|
|
/// </summary>
|
|
/// <param name="obj">A <see cref="Fee_Calculation"/> object.</param>
|
|
/// <returns>A <see cref="FeeCalculationModel"/> object filled with data from db.</returns>
|
|
public static explicit operator FeeCalculationModel(FeeCalculation obj)
|
|
{
|
|
if (obj == null)
|
|
return null;
|
|
var model = new FeeCalculationModel
|
|
{
|
|
Id = obj.Id,
|
|
ExpenditureCategoryId = obj.ExpenditureCategoryId,
|
|
MinShot = obj.MinShot,
|
|
MaxShot = obj.MaxShot,
|
|
Quantity = obj.Quantity,
|
|
ExpenditureCategory = obj.ExpenditureCategory
|
|
|
|
};
|
|
return model;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Copies data from model to DAL object.
|
|
/// </summary>
|
|
/// <param name="dbObj">A target DAL object.</param>
|
|
public void CopyTo(FeeCalculation dbObj)
|
|
{
|
|
if (dbObj == null)
|
|
throw new ArgumentNullException();
|
|
dbObj.ExpenditureCategoryId = ExpenditureCategoryId;
|
|
dbObj.MinShot = MinShot;
|
|
dbObj.MaxShot = MaxShot;
|
|
dbObj.Quantity = Quantity;
|
|
dbObj.ExpenditureCategory = ExpenditureCategory;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
} |