public StockUnitViewModel(StockUnit arg) { _stockUnitRepository = new StockUnitRepository(); _stockUnitNoteRepository = new StockUnitNoteRepository(); InitViewModel(!arg.IsNew ? _stockUnitRepository.GetById(arg.Id, true) : arg); }
private void AddMethod() { var stockUnitRepository = new StockUnitRepository(); var items = AddFunc(DefaultCard); if (items == null) { return; } foreach (var item in items) { DefaultCard.StockUnitList.Remove(item); OnPropertyChanged("DefaultCard"); var stockUnit = stockUnitRepository.GetById(item.Id, true); stockUnit.Card = _card; if (!StockUnitList.Contains(stockUnit)) { StockUnitList.Add(stockUnit); } if (_itemsToDelete.Contains(stockUnit)) { _itemsToDelete.Remove(stockUnit); } } }
private void RefreshMethod() { var selectedStockUnit = StockUnitSelectedItem as StockUnit; if (selectedStockUnit != null) { var stockUnit = _stockUnitRepository.GetById(selectedStockUnit.Id, true); UnitList = new ObservableCollection <Unit>(stockUnit.UnitList); } }
public void ConvertTest() { var stockUnitRepository = new StockUnitRepository(); var stockUnit = stockUnitRepository.GetById(1266, true); var converter = new StockUnitXmlConverter(); var result = converter.Convert(stockUnit); Console.WriteLine(result.OuterXml); }
public void ReportExportTest() { var stockUnitRepository = new StockUnitRepository(); var stockUnit = stockUnitRepository.GetById(1266, true); var templateFileName = "C:\\Work\\Stock\\Stock.Report\\bin\\Debug\\Templates\\passport.docx"; var outFileName = "C:\\Work\\Stock\\Stock.Report\\bin\\Debug\\Export\\stockUnitTemplate.docx"; var stockUnitReport = new StockUnitReport(); stockUnitReport.Export(stockUnit, templateFileName, outFileName); }
public void ReportExportDirectoryNotExistTest() { var stockUnitRepository = new StockUnitRepository(); var stockUnit = stockUnitRepository.GetById(1266, true); var templateFileName = "C:\\Work\\Stock\\Stock.Report\\bin\\Debug\\Templates\\passport.docx"; var outFileName = "C:\\Work\\Stock\\Stock.Report\\bin\\Debug\\ExportTest\\test.docx"; var stockUnitReport = new StockUnitReport(); var result = stockUnitReport.Export(stockUnit, templateFileName, outFileName); Console.WriteLine(stockUnitReport.LastError); Assert.IsTrue(!result); }
private void CopyMethod() { var item = SelectedItem as StockUnit; if (item != null) { var repository = new StockUnitRepository(); var stockUnit = repository.GetById(item.Id, true); var result = new StockUnit { StockNumber = item.StockNumber, StockName = item.StockName, CreationDate = item.CreationDate, Comments = item.Comments }; var units = stockUnit.UnitList; var resultUnits = new List <Unit>(); foreach (var unit in units) { var resultUnit = new Unit { StockUnit = result, UnitType = unit.UnitType, Manufacture = unit.Manufacture, ModelName = unit.ModelName, Comments = unit.Comments }; resultUnits.Add(resultUnit); } result.UnitList = resultUnits; CopyAction(result); } }