- nettiergeneratorsample.zip
- database
- sample
- BusinessLogic
- Common
- Config
- DalFactory
- GUI
- WinGUI
- IDAL
- Model
- MsSqlDal
- OP_CACHE.ATR
- OP_CACHE.IDX
- Sample.sln
- Security
- TierModel
- Tools
- EnterpriseLibrary
- Microsoft.Practices.EnterpriseLibrary.Caching.dll
- Microsoft.Practices.EnterpriseLibrary.Caching.XML
- Microsoft.Practices.EnterpriseLibrary.Common.dll
- Microsoft.Practices.EnterpriseLibrary.Common.XML
- Microsoft.Practices.ObjectBuilder.dll
- Microsoft.Practices.ObjectBuilder.XML
- TierGenerator
- nettiergenerator.zip
- netTierGenerator
- BusinessLogic
- Common
- Common.csproj
- Data
- Exception
- OP_CACHE.ATR
- OP_CACHE.IDX
- Properties
- Util
- Config
- Console
- DalFactory
- IDal
- Model
- MsSqlDal
- netTierGenerator.sln
- OP_CACHE.ATR
- OP_CACHE.IDX
- TierGenerator
- TierModel
|
using System;
using Sample.Common.Data;
using Sample.Common.Exception;
using Sample.Common.History;
using Sample.Common.Util;
using Sample.Common.Validation;
namespace Sample.Model.Store
{
[Serializable]
public partial class GoodInfoModel : BusinessEntity, ICloneable, IEquatable<GoodInfoModel>
{
#region Static Members
private static readonly ValidationRules VALIDATION_RULES;
#endregion Static Members
#region members
private string _name;
private decimal _cost;
private int _quantity;
#endregion members
#region properties
[HistoryAttribute()]
public string Name
{
[global::System.Diagnostics.DebuggerStepThrough]
get { return this._name; }
[global::System.Diagnostics.DebuggerStepThrough]
set { this._name = value; }
}
[HistoryAttribute()]
public decimal Cost
{
[global::System.Diagnostics.DebuggerStepThrough]
get { return this._cost; }
[global::System.Diagnostics.DebuggerStepThrough]
set { this._cost = value; }
}
[HistoryAttribute()]
public int Quantity
{
[global::System.Diagnostics.DebuggerStepThrough]
get { return this._quantity; }
[global::System.Diagnostics.DebuggerStepThrough]
set { this._quantity = value; }
}
#endregion properties
#region Constructors
public GoodInfoModel(Guid _id, string _name, decimal _cost, int _quantity)
: this()
{
this._id = _id;
this._name = _name;
this._cost = _cost;
this._quantity = _quantity;
}
static GoodInfoModel()
{
GoodInfoModel.VALIDATION_RULES = new ValidationRules();
GoodInfoModel.AddDatabaseSchemaRules();
GoodInfoModel.AddCustomRules();
}
#endregion Constructors
#region Public Methods
public void Validate()
{
ValidationResult validationResult = GoodInfoModel.VALIDATION_RULES.Validate(this);
if (!validationResult.IsValid)
{
throw new ValidationException(this, validationResult);
}
}
#endregion Public Methods
#region Static Methods
private static void AddDatabaseSchemaRules()
{
GoodInfoModel.VALIDATION_RULES.AddRule(CommonRules.NotNull, "Name");
GoodInfoModel.VALIDATION_RULES.AddRule(CommonRules.StringMaxLength, new CommonRules.MaxLengthRuleArgs("Name", 50));
GoodInfoModel.VALIDATION_RULES.AddRule(CommonRules.NotNull, "Cost");
GoodInfoModel.VALIDATION_RULES.AddRule(CommonRules.NotNull, "Quantity");
}
#endregion Static Methods
#region ICloneable Members
public object Clone()
{
GoodInfoModel clone = new GoodInfoModel();
clone.Id = this.Id;
clone.Name = this.Name;
clone.Cost = this.Cost;
clone.Quantity = this.Quantity;
return clone;
}
#endregion ICloneable Members
#region IEquatable<GoodInfoModel> Members
public bool Equals(GoodInfoModel other)
{
if (other == null) { return false; }
if (Object.ReferenceEquals(this, other)) { return true; }
return
this.Id == other.Id &&
this.Name == other.Name &&
this.Cost == other.Cost &&
this.Quantity == other.Quantity;
}
#endregion IEquatable<GoodInfoModel> Members
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.