Dodaj pliki projektów.
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Haftmittel
|
||||
{
|
||||
public class Skladnik : INotifyPropertyChanged, IDataErrorInfo
|
||||
{
|
||||
private Int32 _id = 0;
|
||||
private decimal _procent = 0;
|
||||
private decimal _procentDo = 0;
|
||||
private List<Historia> _Historia;
|
||||
|
||||
public Int32 Id
|
||||
{
|
||||
get { return _id; }
|
||||
set
|
||||
{
|
||||
_id = value;
|
||||
|
||||
if (_id == 0)
|
||||
{
|
||||
Procent = 0;
|
||||
OnPropertyChanged("Procent");
|
||||
}
|
||||
|
||||
OnPropertyChanged("Id");
|
||||
}
|
||||
}
|
||||
|
||||
public decimal Procent
|
||||
{
|
||||
get { return _procent; }
|
||||
set
|
||||
{
|
||||
_procent = value;
|
||||
OnPropertyChanged("Procent");
|
||||
OnPropertyChanged("ProcentDo");
|
||||
}
|
||||
}
|
||||
|
||||
public decimal ProcentDo
|
||||
{
|
||||
get { return _procentDo; }
|
||||
set
|
||||
{
|
||||
_procentDo = value;
|
||||
OnPropertyChanged("ProcentDo");
|
||||
OnPropertyChanged("Procent");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Historia zmian wartości
|
||||
/// </summary>
|
||||
public List<Historia> Historia
|
||||
{
|
||||
get { return _Historia; }
|
||||
set { _Historia = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Historia zmian typu
|
||||
/// </summary>
|
||||
public List<Historia> Historia_Id
|
||||
{ get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Historia zmian wartości ProcentDo
|
||||
/// </summary>
|
||||
public List<Historia> Historia_Do
|
||||
{ get; set; }
|
||||
|
||||
#region Obsługa INotifyPropertyChanged
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
protected void OnPropertyChanged(string name)
|
||||
{
|
||||
PropertyChangedEventHandler handler = PropertyChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Obsługa IDataErrorInfo
|
||||
public string Error
|
||||
{
|
||||
get { throw new NotImplementedException(); }
|
||||
}
|
||||
|
||||
public string this[string columnName]
|
||||
{
|
||||
get
|
||||
{
|
||||
string result = null;
|
||||
|
||||
#region Procent
|
||||
if (columnName == "Procent")
|
||||
{
|
||||
if (Procent < 0 || Procent > 100)
|
||||
result = "tylko wartości od 0 do 100";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region ProcentDo
|
||||
if (columnName == "ProcentDo")
|
||||
{
|
||||
if (ProcentDo < 0 || ProcentDo > 100)
|
||||
result = "tylko wartości od 0 do 100";
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Procent
|
||||
if (columnName == "Procent" || columnName == "ProcentDo")
|
||||
{
|
||||
if (Procent > ProcentDo)
|
||||
result = "niewłaściwe wartości";
|
||||
}
|
||||
#endregion
|
||||
return result;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user