예제 #1
0
        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());
        }
예제 #2
0
        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);
        }
예제 #4
0
 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
 }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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());
        }
예제 #7
0
 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()
         });
     }
 }
예제 #8
0
 public StockUnitReport()
 {
     _repairRepository = new RepairRepository();
     _noteRepository   = new StockUnitNoteRepository();
 }
예제 #9
0
 public RepairAddViewModel(Repair arg)
 {
     _repairRepository = new RepairRepository();
     InitViewModel(_repairRepository.GetById(arg.Id, true));
 }
예제 #10
0
 public RepairAddViewModel()
 {
     _repairRepository = new RepairRepository();
     InitViewModel(new Repair());
 }
예제 #11
0
 public StockUnitXmlConverter()
 {
     _repository       = new StockUnitRepository();
     _repairRepository = new RepairRepository();
     _noteRepository   = new StockUnitNoteRepository();
 }