Add project files.
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
using SafeBagDE70;
|
||||
|
||||
namespace SafeBagDE70.Model
|
||||
{
|
||||
public class LvCountItem : INotifyPropertyChanged
|
||||
{
|
||||
public string _Name { get; set; }
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
int deno = 0;
|
||||
var str = _Name;
|
||||
if (int.TryParse(_Name, out deno))
|
||||
{
|
||||
str = String.Format(CultureInfo.InvariantCulture,
|
||||
"{0:#,#.##}", deno);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_Name != value)
|
||||
{
|
||||
_Name = value;
|
||||
OnPropertyChanged(nameof(Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
public string _Quantity { get; set; }
|
||||
public string Quantity
|
||||
{
|
||||
get => _Quantity;
|
||||
set
|
||||
{
|
||||
if(_Quantity != value)
|
||||
{
|
||||
_Quantity = value;
|
||||
OnPropertyChanged(nameof(Quantity));
|
||||
double deno = 0;
|
||||
|
||||
double.TryParse(_Name, out deno);
|
||||
var str = getValue().ToString();
|
||||
if (str == "") str = "0";
|
||||
Value = str;
|
||||
//if(double.TryParse(_Name, out deno))
|
||||
//{
|
||||
// var str = getValue().ToString();
|
||||
// if (str == "") str = "0";
|
||||
// Value = str;
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public double getValue()
|
||||
{
|
||||
double deno = 0;
|
||||
double.TryParse(_Name, out deno);
|
||||
double quant = 0;
|
||||
double.TryParse(_Quantity, out quant);
|
||||
return (deno * quant);
|
||||
}
|
||||
|
||||
private string _Value;
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
var str = _Value;
|
||||
int val = 0;
|
||||
if (int.TryParse(_Value, out val))
|
||||
{
|
||||
str = String.Format(CultureInfo.InvariantCulture,
|
||||
"{0:#,#.##}", val);
|
||||
if(str=="")str= "0";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_Value != value)
|
||||
{
|
||||
_Value = value;
|
||||
OnPropertyChanged(nameof(Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
protected virtual void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
|
||||
public class SessionQuantity
|
||||
{
|
||||
private List<int[]> subSessionQuantities = new List<int[]>();
|
||||
public void AddSubSession(int[] subSessionQuantity)
|
||||
{
|
||||
subSessionQuantities.Add(subSessionQuantity);
|
||||
}
|
||||
public void RemoveLastSubSession()
|
||||
{
|
||||
subSessionQuantities.RemoveAt(subSessionQuantities.Count - 1);
|
||||
}
|
||||
public int GetQuantity(int index)
|
||||
{
|
||||
int _totalQuantity = 0;
|
||||
foreach (var item in subSessionQuantities)
|
||||
{
|
||||
_totalQuantity += item[index];
|
||||
}
|
||||
return _totalQuantity;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Reference in New Issue
Block a user