public void Delete(int id)
 {
     using (var db = new RepTecUnitOfWork())
     {
         db.RepairRequestsRepository.Delete(id);
         db.Commit();
     }
 }
示例#2
0
 public void Insert(Repairer repairer)
 {
     using (var db = new RepTecUnitOfWork())
     {
         db.RepairersRepository.Insert(repairer);
         db.Commit();
     }
 }
示例#3
0
 public void Delete(int id)
 {
     using (var db = new RepTecUnitOfWork())
     {
         db.NomenclatureInRequestRepository.Delete(id);
         db.Commit();
     }
 }
示例#4
0
 public void Update(Repairer repairer)
 {
     using (var db = new RepTecUnitOfWork())
     {
         db.RepairersRepository.Update(repairer);
         db.Commit();
     }
 }
        public List <NomenclatureType> GetAll()
        {
            List <NomenclatureType> nomenclatureTypes;

            using (var db = new RepTecUnitOfWork())
            {
                nomenclatureTypes = db.NomenclatureTypesRepository.GetAll();
            }
            return(nomenclatureTypes);
        }
        public List <Nomenclature> GetAll()
        {
            List <Nomenclature> nomenclature;

            using (var db = new RepTecUnitOfWork())
            {
                nomenclature = db.NomenclatureRepository.GetAll(null, n => n.Type);
            }
            return(nomenclature);
        }
示例#7
0
        public Repairer GetById(int id)
        {
            Repairer repairer;

            using (var db = new RepTecUnitOfWork())
            {
                repairer = db.RepairersRepository.GetByСondition(r => r.Id == id);
            }
            return(repairer);
        }
示例#8
0
        public List <Repairer> GetAll()
        {
            List <Repairer> repairers;

            using (var db = new RepTecUnitOfWork())
            {
                repairers = db.RepairersRepository.GetAll();
            }
            return(repairers);
        }
        public Nomenclature GetById(int id)
        {
            Nomenclature nomenclature;

            using (var db = new RepTecUnitOfWork())
            {
                nomenclature = db.NomenclatureRepository.GetByСondition(r => r.Id == id, n => n.Type);
            }
            return(nomenclature);
        }
示例#10
0
        public List <RepairStatus> GetAll()
        {
            List <RepairStatus> repairStatuses;

            using (var db = new RepTecUnitOfWork())
            {
                repairStatuses = db.RepairStatusesRepository.GetAll();
            }
            return(repairStatuses);
        }
示例#11
0
        public List <NomenclatureInRequest> GetAllByRequest(int requestId)
        {
            List <NomenclatureInRequest> nomenclatureInRequest;

            using (var db = new RepTecUnitOfWork())
            {
                nomenclatureInRequest = db.NomenclatureInRequestRepository.GetAll(n => n.RepairRequestId == requestId,
                                                                                  n => n.Nomenclature, n => n.Nomenclature.Type);
            }
            return(nomenclatureInRequest);
        }
        public RepairRequest GetById(int id)
        {
            RepairRequest repairRequest;

            using (var db = new RepTecUnitOfWork())
            {
                repairRequest = db.RepairRequestsRepository.GetByСondition(r => r.Id == id, r => r.Status,
                                                                           r => r.Repairer, r => r.EquipmentToBeRepaired);
            }
            return(repairRequest);
        }
 public void Insert(Nomenclature nomenclature)
 {
     nomenclature.Price = Math.Round(nomenclature.Price, 2);
     using (var db = new RepTecUnitOfWork())
     {
         var type = db.NomenclatureTypesRepository.GetByСondition(t => t.Id == nomenclature.Type.Id);
         nomenclature.Type = type;
         db.NomenclatureRepository.Insert(nomenclature);
         db.Commit();
     }
 }
示例#14
0
        public NomenclatureInRequest GetById(int id)
        {
            NomenclatureInRequest nomenclatureInRequest;

            using (var db = new RepTecUnitOfWork())
            {
                nomenclatureInRequest = db.NomenclatureInRequestRepository.GetByСondition(r => r.Id == id,
                                                                                          n => n.Nomenclature, n => n.Nomenclature.Type);
            }
            return(nomenclatureInRequest);
        }
示例#15
0
        public void Insert(NomenclatureInRequest nomenclatureInRequest)
        {
            using (var db = new RepTecUnitOfWork())
            {
                var nomenclature = db.NomenclatureRepository.GetByСondition(t => t.Id == nomenclatureInRequest.Nomenclature.Id);
                nomenclatureInRequest.Nomenclature = nomenclature;

                db.NomenclatureInRequestRepository.Insert(nomenclatureInRequest);
                db.Commit();
            }
        }
        public List <RepairRequest> GetAll()
        {
            List <RepairRequest> repairRequests;

            using (var db = new RepTecUnitOfWork())
            {
                repairRequests = db.RepairRequestsRepository.GetAll(null, r => r.Status,
                                                                    r => r.Repairer, r => r.EquipmentToBeRepaired);
            }
            return(repairRequests);
        }
        public void Update(RepairRequest repairRequest)
        {
            using (var db = new RepTecUnitOfWork())
            {
                var status = db.RepairStatusesRepository.GetByСondition(s => s.Id == repairRequest.Status.Id);
                repairRequest.Status = status;

                var equipmentToBeRepaired = db.NomenclatureRepository.GetByСondition(n => n.Id == repairRequest.EquipmentToBeRepaired.Id);
                repairRequest.EquipmentToBeRepaired = equipmentToBeRepaired;

                var repairer = db.RepairersRepository.GetByСondition(r => r.Id == repairRequest.Repairer.Id);
                repairRequest.Repairer = repairer;

                db.RepairRequestsRepository.Update(repairRequest);
                db.Commit();
            }
        }