Пример #1
0
 public List <ControlLoan> GetAllControlLoanEquipment(int idTypeEquipment, EStatusControlLoan status)
 {
     return(_context.ControlLoan
            .Include("Company")
            .Include("Equipment")
            .Include("Equipment.TypeEquipment")
            .Where(ControlLoanSpecs.GetEquipmentControlLoan(idTypeEquipment, status))
            .OrderBy(x => x.IdControlLoan).ToList());
 }
Пример #2
0
 public List <ControlLoan> GetByRange(int skip, int take, string word, EStatusControlLoan status)
 {
     return(_context.ControlLoan
            .Include("Company")
            .Include("Equipment")
            .Include("Equipment.TypeEquipment")
            .Where(ControlLoanSpecs.GetSearchControlLoan(word, status))
            .OrderBy(x => x.IdControlLoan).Skip((skip - 1) * take).Take(take).ToList());
 }
        public void Update(UpdateControlLoanCommand command, EStatusControlLoan status)
        {
            if (!this.UpdateControlLoantScopesIsValid(command, status))
            {
                return;
            }

            this.DateLocation      = command.DateLocation;
            this.DateEndLocation   = command.DateEndLocation;
            this.Note              = command.Note;
            this.IdCompany         = command.IdCompany;
            this.IdEquipment       = command.IdEquipment;
            this.StatusControlLoan = command.StatusControlLoan;
        }
Пример #4
0
        public Task <HttpResponseMessage> GetCount(string word, EStatusControlLoan status)
        {
            var countControlLoan = _service.GetCount(word, status);

            return(CreateResponse(HttpStatusCode.OK, countControlLoan));
        }
 public List <Equipment> GetAllEquipmentControlLoan(string word, EStatusEquipment statusEquipment, EStatusControlLoan statusControlLoan)
 {
     return(_repository.GetAllEquipmentControlLoan(word, statusEquipment, statusControlLoan));
 }
 public UpdateControlLoanCommand(int idControlLoan, DateTime dateLocation, DateTime dateEndLocation, string note, EStatusControlLoan statusControlLoan, int idCompany, int idEquipment)
 {
     this.IdControlLoan     = idControlLoan;
     this.DateLocation      = dateLocation;
     this.DateEndLocation   = dateEndLocation;
     this.Note              = note;
     this.IdCompany         = idCompany;
     this.IdEquipment       = idEquipment;
     this.StatusControlLoan = statusControlLoan;
 }
        public static Expression <Func <ControlLoan, bool> > GetSearchControlLoan(string word, EStatusControlLoan status)
        {
            if (string.IsNullOrEmpty(word) || word.Equals("null"))
            {
                return(x => !x.IdControlLoan.Equals(null) && x.StatusControlLoan == status);
            }

            return(x => (x.Company.CompanyName.Contains(word) || x.Company.FantasyName.Contains(word) || x.Equipment.Patrimony.Contains(word) || x.Equipment.SerialNumber.Contains(word) || x.Equipment.Model.Contains(word)) && x.StatusControlLoan == status);
        }
 public static Expression <Func <ControlLoan, bool> > GetEquipmentControlLoan(int idTypeEquipment, int idVideo, EStatusControlLoan status)
 {
     return(x => x.StatusControlLoan == status && x.Equipment.IdTypeEquipment == idTypeEquipment && x.IdEquipment != idVideo);
 }
 public static Expression <Func <ControlLoan, bool> > GetControlLoan(EStatusControlLoan status)
 {
     return(x => x.StatusControlLoan == status);
 }
 public void Delete()
 {
     this.StatusControlLoan = EStatusControlLoan.Cancelado;
     this.DateEndLocation   = DateTime.Now;
 }
Пример #11
0
 public static bool UpdateControlLoantScopesIsValid(this ControlLoan controlLoan, UpdateControlLoanCommand command, EStatusControlLoan status)
 {
     return(AssertionConcern.IsSatisfiedBy(
                AssertionConcern.AssertNotNull(controlLoan.DateLocation, "A Data de empréstimo é obrigatório"),
                AssertionConcern.AssertNotNull(controlLoan.DateLocation, "A Data de fim do empréstimo é obrigatório"),
                AssertionConcern.AssertTrue(!(controlLoan.DateLocation > command.DateEndLocation), "A data de fim do empréstimo deve ser maior que a data de início"),
                AssertionConcern.AssertTrue(status.Equals(EStatusControlLoan.Vigente), "É permitido editar apenas empréstimos vigentes")
                ));
 }
 public List <ControlLoan> GetByRange(int skip, int take, string word, EStatusControlLoan status)
 {
     return(_repository.GetByRange(skip, take, word, status));
 }
 public List <ControlLoan> GetAllControlLoanEquipment(int idTypeEquipment, EStatusControlLoan status)
 {
     return(_repository.GetAllControlLoanEquipment(idTypeEquipment, status));
 }
 public int GetCount(string word, EStatusControlLoan status)
 {
     return(_repository.GetCount(word, status));
 }
        public List <Equipment> GetAllEquipmentControlLoan(string word, EStatusEquipment statusEquipment, EStatusControlLoan statusControlLoan)
        {
            List <Equipment> listEquipmentAvailable = new List <Equipment>();


            List <ControlLoan> ControlLoan = (List <ControlLoan>)_context.ControlLoan.Where(ControlLoanSpecs.GetControlLoan(statusControlLoan)).ToList();
            List <Equipment>   Equipment   = _context.Equipment.Where(EquipmentSpecs.GetEquipment(word, statusEquipment)).ToList();

            var joined = ControlLoan.Join(Equipment, controlLoan => controlLoan.IdEquipment, equipment => equipment.IdEquipment, (Person, PersoneType) => new { Name = Person.IdEquipment, TypeID = PersoneType.IdEquipment });

            foreach (var equi in Equipment)
            {
                foreach (var cont in ControlLoan)
                {
                    if (cont.IdEquipment == equi.IdEquipment)
                    {
                        listEquipmentAvailable.Add(equi);
                    }
                }
            }



            //joined.Where(a=>a.Name);
            //var result = _context.Equipment.Join(_context.ControlLoan,)

            //.Include("TypeEquipment")

            //.Where(EquipmentSpecs.GetEquipment(word, status))
            //.OrderBy(x => x.Patrimony).ToList();

            return(listEquipmentAvailable);
        }
Пример #16
0
        public Task <HttpResponseMessage> GetAllControlLoanEquipment(EStatusControlLoan status, int video, int word)
        {
            var loan = _service.GetAllControlLoanEquipmentByVideo(video, word, status);

            return(CreateResponse(HttpStatusCode.OK, loan));
        }
Пример #17
0
        public Task <HttpResponseMessage> GetByRange(int skip, string word, EStatusControlLoan status, int take = 12)
        {
            var loan = _service.GetByRange(skip, take, word, status);

            return(CreateResponse(HttpStatusCode.OK, loan));
        }
Пример #18
0
 public int GetCount(string word, EStatusControlLoan status)
 {
     return(_context.ControlLoan.Where(ControlLoanSpecs.GetSearchControlLoan(word, status)).Count());
 }