Beispiel #1
0
 public List <CourseDTO> GetAll()
 {
     try
     {
         return(MapDTO.MapList <CourseDTO, Course>(_uow.CourseRepo.GetAll()));
     }
     catch (Exception e)
     {
         log.Error("kon niet ophalen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #2
0
 public List <ProductDTO> GetAll()
 {
     try
     {
         return(MapDTO.MapList <ProductDTO, Product>(_uow.ProductRepo.GetAll()));
     }
     catch (Exception e)
     {
         log.Error("kon geen producten oplijsten");
         throw new Exception(e.Message);
     }
 }
Beispiel #3
0
 public List <VatDTO> GetAll()
 {
     try
     {
         return(MapDTO.MapList <VatDTO, Vat>(_uow.VatRepo.GetAll()));
     }
     catch (Exception e)
     {
         log.Error("kon geen btw's vinden", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #4
0
 public List <InvoiceDetailDTO> GetAll()
 {
     try
     {
         return(MapDTO.MapList <InvoiceDetailDTO, InvoiceDetail>(_uow.InvoiceDetailRepo.GetAll()));
     }
     catch (Exception e)
     {
         log.Error("kon geen facturen ophalen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #5
0
 public void Delete(ProductDTO c)
 {
     try
     {
         _uow.ProductRepo.Remove(MapDTO.Map <Product, ProductDTO>(c));
         _uow.Save();
     }
     catch (Exception e)
     {
         log.Error("kon geen product verwijderen");
         throw new Exception(e.Message);
     }
 }
Beispiel #6
0
 public ProductPriceDTO FindByID(int?id)
 {
     try
     {
         var c = _uow.ProductPriceRepo.FindById(id);
         return(c == null ? null : MapDTO.Map <ProductPriceDTO, ProductPrice>(c));
     }
     catch (Exception e)
     {
         log.Error("kon geen Prijs id vinden");
         throw new Exception(e.Message);
     }
 }
Beispiel #7
0
 public void Delete(InvoiceDetailDTO c)
 {
     try
     {
         _uow.InvoiceDetailRepo.Remove(MapDTO.Map <InvoiceDetail, InvoiceDetailDTO>(c));
         _uow.Save();
     }
     catch (Exception e)
     {
         log.Error("kon geen factuur verwijderen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #8
0
 public VatDTO FindByID(int?id)
 {
     try
     {
         var c = _uow.VatRepo.FindById(id);
         return(c == null ? null : MapDTO.Map <VatDTO, Vat>(c));
     }
     catch (Exception e)
     {
         log.Error("kon geen btw id vinden", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #9
0
 public void Delete(VatDTO c)
 {
     try
     {
         _uow.VatRepo.Remove(MapDTO.Map <Vat, VatDTO>(c));
         _uow.Save();
     }
     catch (Exception e)
     {
         log.Error("kon geen btw verwijderen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #10
0
 public void Delete(CourseDTO c)
 {
     try
     {
         _uow.CourseRepo.Remove(MapDTO.Map <Course, CourseDTO>(c));
         _uow.Save();
     }
     catch (Exception e)
     {
         log.Error("kon geen cursus verwijderren", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #11
0
        public CourseDTO FindByID(int?id)
        {
            try
            {
                var c = _uow.CourseRepo.FindById(id);

                return(c == null ? null : MapDTO.Map <CourseDTO, Course>(c));
            }
            catch (Exception e)
            {
                log.Error("Kon id niet vinden", e);
                throw new Exception(e.Message);
            }
        }
Beispiel #12
0
        public InvoiceDetailDTO FindByID(int?id)
        {
            try
            {
                var c = _uow.InvoiceDetailRepo.FindById(id);

                return(c == null ? null : MapDTO.Map <InvoiceDetailDTO, InvoiceDetail>(c));
            }
            catch (Exception e)
            {
                log.Error("kon geen id van factuur vinden", e);
                throw new Exception(e.Message);
            }
        }
Beispiel #13
0
 public InvoiceDetailDTO Update(InvoiceDetailDTO c)
 {
     try
     {
         _uow.InvoiceDetailRepo.Modify(MapDTO.Map <InvoiceDetail, InvoiceDetailDTO>(c));
         _uow.Save();
         return(c);
     }
     catch (Exception e)
     {
         log.Error("kon geen factuur aanpassen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #14
0
 public InvoiceDTO Update(InvoiceDTO c)
 {
     try
     {
         _uow.InvoiceRepo.Modify(MapDTO.Map <Invoice, InvoiceDTO>(c));
         _uow.Save();
         return(c);
     }
     catch (Exception e)
     {
         log.Error("kon niet updaten");
         throw new Exception(e.Message);
     }
 }
Beispiel #15
0
 public ProductDTO Update(ProductDTO c)
 {
     try
     {
         _uow.ProductRepo.Modify(MapDTO.Map <Product, ProductDTO>(c));
         _uow.Save();
         return(c);
     }
     catch (Exception e)
     {
         log.Error("kon geen product wijzigen");
         throw new Exception(e.Message);
     }
 }
Beispiel #16
0
 public CourseDTO Update(CourseDTO c)
 {
     try
     {
         _uow.CourseRepo.Modify(MapDTO.Map <Course, CourseDTO>(c));
         _uow.Save();
         return(c);
     }
     catch (Exception e)
     {
         log.Error("kon niet updaten");
         throw new Exception(e.Message);
     }
 }
Beispiel #17
0
 public VatDTO Update(VatDTO c)
 {
     try
     {
         _uow.VatRepo.Modify(MapDTO.Map <Vat, VatDTO>(c));
         _uow.Save();
         return(c);
     }
     catch (Exception e)
     {
         log.Error("kon geen btw aanpassen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #18
0
 public ProductPriceDTO Update(ProductPriceDTO c)
 {
     try
     {
         _uow.ProductPriceRepo.Modify(MapDTO.Map <ProductPrice, ProductPriceDTO>(c));
         _uow.Save();
         return(c);
     }
     catch (Exception e)
     {
         log.Error("kon geen prijs aanpassen", e);
         throw new Exception(e.Message);
     }
 }
Beispiel #19
0
        public void Delete(int id)
        {
            var c = FindByID(id);

            try
            {
                _uow.ProductRepo.Remove(MapDTO.Map <Product, ProductDTO>(c));
                _uow.Save();
            }
            catch (Exception e)
            {
                log.Error("kon geen product verwijderren", e);
                throw new Exception(e.Message);
            }
        }
Beispiel #20
0
        public void Delete(int id)
        {
            var c = FindByID(id);

            try
            {
                _uow.InvoiceRepo.Remove(MapDTO.Map <Invoice, InvoiceDTO>(c));
                _uow.Save();
            }
            catch (Exception e)
            {
                log.Error("kon geen invoice verwijderren", e);
                throw new Exception(e.Message);
            }
        }
Beispiel #21
0
        public VatDTO Create(VatDTO c)
        {
            try
            {
                var vat = MapDTO.Map <Vat, VatDTO>(c);
                _uow.VatRepo.Add(vat);
                _uow.Save();

                c.Id = vat.Id;

                return(c);
            }
            catch (Exception e)
            {
                log.Error(e.Message);
                throw new Exception(e.Message);
            }
        }
Beispiel #22
0
        public CourseDTO Create(CourseDTO c)
        {
            try
            {
                var course = MapDTO.Map <Course, CourseDTO>(c);
                _uow.CourseRepo.Add(course);
                _uow.Save();

                c.Id = course.Id;

                return(c);
            }
            catch (Exception e)
            {
                log.Error("Kon geen cursus aanmaken", e);
                throw new Exception(e.Message);
            }
        }
Beispiel #23
0
        public ProductPriceDTO Create(ProductPriceDTO c)
        {
            try
            {
                var productPrice = MapDTO.Map <ProductPrice, ProductPriceDTO>(c);
                _uow.ProductPriceRepo.Add(productPrice);
                _uow.Save();

                c.Id = productPrice.Id;

                return(c);
            }
            catch (Exception e)
            {
                log.Error("kon geen productprijs toevoegen");
                throw new Exception(e.Message);
            }
        }
Beispiel #24
0
        public InvoiceDetailDTO Create(InvoiceDetailDTO c)
        {
            try
            {
                var        invoiceDetail = MapDTO.Map <InvoiceDetail, InvoiceDetailDTO>(c);
                InvoiceDTO invoice       = _invoiceLogic.GetAll().Last();
                invoiceDetail.InvoiceId = invoice.Id;
                _uow.InvoiceDetailRepo.Add(invoiceDetail);
                _uow.Save();

                c.Id = invoiceDetail.Id;

                return(c);
            }
            catch (Exception e)
            {
                log.Error("kon geen factuur toeveogen");
                throw new Exception(e.Message);
            }
        }
Beispiel #25
0
        public ProductDTO Create(ProductDTO c)
        {
            try
            {
                var             product = MapDTO.Map <Product, ProductDTO>(c);
                ProductPriceDTO price   = _prdPriceLogic.GetAll().Last();
                product.PriceId = price.Id;
                _uow.ProductRepo.Add(product);
                _uow.Save();

                c.Id = product.Id;

                return(c);
            }
            catch (Exception e)
            {
                log.Error("kon geen product toevoegen", e);
                throw  new Exception(e.Message);
            }
        }
Beispiel #26
0
        public InvoiceDTO Create(InvoiceDTO c)
        {
            try
            {
                if (today != firstDayOfNextMonth)
                {
                    counter++;

                    var now         = DateTime.Now;
                    var generateId  = now.Year + "-" + now.Month + "-" + counter;
                    var invoiceRepo = MapDTO.Map <Invoice, InvoiceDTO>(c);
                    invoiceRepo.InvoiceCode = generateId;
                    _uow.InvoiceRepo.Add(invoiceRepo);
                    _uow.Save();

                    c.Id = invoiceRepo.Id;
                }
                else
                {
                    getCounter();
                    var now        = DateTime.Now;
                    var generateId = now.Year + "-" + now.Month + "-" + counter;

                    var invoiceRepo = MapDTO.Map <Invoice, InvoiceDTO>(c);
                    invoiceRepo.InvoiceCode = generateId;
                    _uow.InvoiceRepo.Add(invoiceRepo);
                    _uow.Save();

                    c.InvoiceCode = generateId;
                    c.Id          = invoiceRepo.Id;
                }

                return(c);
            }
            catch (Exception e)
            {
                log.Error("kon geen factuur toevoegen", e);
                throw new Exception(e.Message);
            }
        }
Beispiel #27
0
 public void Delete(InvoiceDTO c)
 {
     _uow.InvoiceRepo.Remove(MapDTO.Map <Invoice, InvoiceDTO>(c));
     _uow.Save();
 }
Beispiel #28
0
 public List <InvoiceDTO> GetAll()
 {
     return(MapDTO.MapList <InvoiceDTO, Invoice>(_uow.InvoiceRepo.GetAll()));
 }
Beispiel #29
0
        public InvoiceDTO FindByID(int?id)
        {
            var c = _uow.InvoiceRepo.FindById(id);

            return(c == null ? null : MapDTO.Map <InvoiceDTO, Invoice>(c));
        }