67 lines
2.1 KiB
C#
67 lines
2.1 KiB
C#
using KanSan.Base;
|
|
using KanSan.Base.Interfaces;
|
|
using KanSan.Base.Interfaces.UI;
|
|
using KanSan.Base.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace KanSan.ViewModel
|
|
{
|
|
public class LeistungsverzeichnisPositionenListViewModel :PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
|
{
|
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
|
List<LeistungsverzeichnisPosition> lvPositionen;
|
|
public List<LeistungsverzeichnisPosition> LVPositionen
|
|
{
|
|
get => lvPositionen;
|
|
set
|
|
{
|
|
if (lvPositionen == value) return;
|
|
lvPositionen = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
string tag;
|
|
public LeistungsverzeichnisPositionenListViewModel(string tag)
|
|
{
|
|
this.tag = tag;
|
|
LoadLVPositionen();
|
|
}
|
|
|
|
void LoadLVPositionen()
|
|
{
|
|
if (tag == string.Empty)
|
|
{
|
|
LVPositionen = unitOfWork.LeistungsverzeichnisRepository.Get().ToList();
|
|
}
|
|
else
|
|
{
|
|
LVPositionen = unitOfWork.LeistungsverzeichnisRepository.Get(x => x.Tag.Equals(tag)).ToList();
|
|
if (LVPositionen == null) LVPositionen = new List<LeistungsverzeichnisPosition>();
|
|
}
|
|
}
|
|
|
|
public LeistungsverzeichnisPosition NeueLeistungsverzeichnisPosition()
|
|
{
|
|
Guid guid = Guid.NewGuid();
|
|
LeistungsverzeichnisPosition leistungsverzeichnisPosition = new LeistungsverzeichnisPosition()
|
|
{
|
|
GuidNr = guid,
|
|
Beschreibung = "TV Inspektion",
|
|
Positionsnummer = "1.0.0.1",
|
|
Einheit = "M",
|
|
Tag = "JMStandard"
|
|
};
|
|
unitOfWork.LeistungsverzeichnisRepository.Insert(leistungsverzeichnisPosition);
|
|
unitOfWork.Commit();
|
|
LoadLVPositionen();
|
|
return leistungsverzeichnisPosition;
|
|
}
|
|
|
|
}
|
|
}
|