using PdmSwPlugin.Common.Entity; using PdmSwPlugin.PriceCheck.Param; using System.Collections.ObjectModel; namespace PdmSwPlugin.PriceCheck.Model { public class TaibanModel : NotifyBase { public ModelProperty _modelProperty; public ModelProperty ModelProperty { get => _modelProperty; set => RaiseAndSetIfChanged(ref _modelProperty, value); } public TaibanModel(ModelProperty modelProperty) { ModelProperty = modelProperty; PropertyGrid.Add(ModelProperty); } private string _stuffFee; public string stuffFee { get => _stuffFee; set { RaiseAndSetIfChanged(ref _stuffFee, value); price = CountTotal(out string _).ToString(); } } private string _workFee; public string workFee { get => _workFee; set { RaiseAndSetIfChanged(ref _workFee, value); price = CountTotal(out string _).ToString(); } } private string _surfaceFee; public string surfaceFee { get => _surfaceFee; set { RaiseAndSetIfChanged(ref _surfaceFee, value); price = CountTotal(out string _).ToString(); } } //private string _heatFee; //public string heatFee //{ // get => _heatFee; // set // { // RaiseAndSetIfChanged(ref _heatFee, value); // price = CountTotal(out string _).ToString(); // } //} private string _discount = "1"; public string discount { get => _discount; set { RaiseAndSetIfChanged(ref _discount, value); price = CountTotal(out string _).ToString(); } } private string _price; public string price { get => _price; set => RaiseAndSetIfChanged(ref _price, value); } private ObservableCollection _propertyGrid = new ObservableCollection(); public ObservableCollection PropertyGrid { get => _propertyGrid; set => RaiseAndSetIfChanged(ref _propertyGrid, value); } private ObservableCollection _processGrid = new ObservableCollection(); public ObservableCollection ProcessGrid { get => _processGrid; set => RaiseAndSetIfChanged(ref _processGrid, value); } public double CountTotal(out string message) { message = null; if (!double.TryParse(stuffFee, out double stuff)) { message = "请输入正确的材料费"; return 0; } if (!double.TryParse(workFee, out double work)) { message = "请输入正确的加工费"; return 0; } if (!double.TryParse(surfaceFee, out double surface)) { message = "请输入正确的表处理费"; return 0; } if (!double.TryParse(discount, out double dis)) { message = "请输入正确的系数"; return 0; } return dis * (stuff + work + surface); } } }