private void InitViewModel() { Repository = new RepairRepository(); AddCommand = new RelayCommand(x => AddMethod()); EditCommand = new RelayCommand(x => EditMethod()); DeleteCommand = new RelayCommand(x => DeleteMethod()); FilterCommand = new RelayCommand(x => FilterMethod()); ClearFilterCommand = new RelayCommand(x => ClearFilterMethod()); }
private string GetCost(Dictionary <string, string> dialogData) { var fault = dialogData["usterka"]; var brand = dialogData["marka"]; using (var repo = new RepairRepository()) { return(repo.GetPrice(fault, brand).ToString(System.Globalization.CultureInfo.InvariantCulture)); } }
public BHEUnitOfWork(BrownsAppDBEntities1 bheDBContext) { _bheDBContext = bheDBContext; PartsRepository = new PartsRepository(_bheDBContext); UserRepository = new UserRepository(_bheDBContext); CompanyRepository = new CompanyRepository(_bheDBContext); LogsRepository = new LogsRepository(_bheDBContext); CustomerRepository = new CustomerRepository(_bheDBContext); InvoiceRepository = new InvoiceRepository(_bheDBContext); InvoiceItemsRepository = new InvoiceItemsRepository(_bheDBContext); InvoiceLaborRepository = new InvoiceLaborRepository(_bheDBContext); RepairRepository = new RepairRepository(_bheDBContext); }
public UnitOfWork(PhoneServiceDbContext context, SearchFilterHealpers searchFilterHealpers) { _context = context; _searchFilterHealpers = searchFilterHealpers; Customers = new CustomerRepository(_context, _searchFilterHealpers); SapareParts = new SaparePartRepository(_context); Products = new ProductRepository(_context, _searchFilterHealpers); Repairs = new RepairRepository(_context, _searchFilterHealpers); RepairItems = new RepairItemRepository(_context); EmailSubject = new EmailSubjectRepository(_context); EmailTemplate = new EmailTemplateRepository(_context); ProductSaparePart = new ProductSaparePartRepository(_context); //TODO: Add rest repo connection }
public string GetVarValue(string val, Dictionary <string, string> dialogData) { switch (val) { case "cost": return(GetCost(dialogData)); case "date": using (var repo = new RepairRepository()) { return(repo.GetNextPossibleDate().ToString("yyyy-MM-dd")); } default: return(null); } }
private void InitViewModel(StockUnit stockUnit) { _itemsToDelete = new List <Unit>(); _addedFiles = new List <string>(); _deletedFiles = new List <string>(); _deletedStockUnitFiles = new List <StockUnitFile>(); StockUnit = stockUnit; if (StockUnit.IsNew && StockUnit.UnitList == null) { StockUnit.UnitList = new List <Unit>(); } InitLists(); UnitList = new ObservableCollection <Unit>(StockUnit.UnitList); UnitList.CollectionChanged += UnitList_CollectionChanged; var documentRepository = new DocumentRepository(); DocumnetsList = new ObservableCollection <Document>(documentRepository.GetByStockUnit(StockUnit)); var repairRepository = new RepairRepository(); RepairList = new ObservableCollection <Repair>(repairRepository.GetAllByStockUnit(StockUnit)); var filesRepository = new StockUnitFileRepository(); StockUnitFiles = new ObservableCollection <StockUnitFile>(filesRepository.GetByStockUnitId(StockUnit)); StockUnitNoteList = !StockUnit.IsNew ? new ObservableCollection <StockUnitNote>(_stockUnitNoteRepository.GetByStockUnitId(StockUnit)) : new ObservableCollection <StockUnitNote>(); var repository = new UnitRepository(); ManufactureList = repository.GetManufactureList(); ModelList = repository.GetModelList(); AddUnitCommand = new RelayCommand(x => UnitList.Add(new Unit())); RemoveUnitCommand = new RelayCommand(x => RemoveMethod()); ReportsCommand = new RelayCommand(x => ReportsMethod()); SaveCommand = new RelayCommand(x => SaveMethod()); CloseCommand = new RelayCommand(x => CloseMethod()); AddFileCommand = new RelayCommand(x => AddFileMethod()); RemoveFileCommand = new RelayCommand(x => RemoveFileMethod()); OpenFileCommand = new RelayCommand(x => OpenFileMethod()); OpenFolderCommand = new RelayCommand(x => OpenFolderMethod()); }
private DataHandleResult AddRepiar(Dictionary <string, string> dialogData) { try { var faultKey = "usterka"; var faultData = new[] { new { Fault = "engine", Fields = new string[] { "naped", "spalanie" } }, new { Fault = "tires", Fields = new string[] { "rodzajOpon" } }, new { Fault = "doors", Fields = new string[] { "drzwi" } }, }.ToDictionary(d => d.Fault); var fault = dialogData[faultKey]; var descripton = new StringBuilder($"Usterka - {fault}: "); foreach (var additionalData in faultData[fault].Fields) { if (dialogData.ContainsKey(additionalData)) { descripton.AppendLine(additionalData + ":" + dialogData[additionalData]); } } var pin = string.Join("", dialogData["pin"].Split(' ')); var brand = dialogData["marka"]; var productionYear = dialogData["rocznik"]; var price = dialogData["cost"]; var date = dialogData["date"]; using (var repairRepo = new RepairRepository()) { var success = repairRepo.AddRepair(pin, brand, productionYear, fault, descripton.ToString(), DateTime.Parse(date), decimal.Parse(price, System.Globalization.CultureInfo.InvariantCulture)); return(new DataHandleResult { Success = true }); } } catch (Exception e) { return(new DataHandleResult { Success = false, Error = e.ToString() }); } }
public StockUnitReport() { _repairRepository = new RepairRepository(); _noteRepository = new StockUnitNoteRepository(); }
public RepairAddViewModel(Repair arg) { _repairRepository = new RepairRepository(); InitViewModel(_repairRepository.GetById(arg.Id, true)); }
public RepairAddViewModel() { _repairRepository = new RepairRepository(); InitViewModel(new Repair()); }
public StockUnitXmlConverter() { _repository = new StockUnitRepository(); _repairRepository = new RepairRepository(); _noteRepository = new StockUnitNoteRepository(); }