Example #1
0
        //Remoção de clientes no banco de dados


        public static void RemoverLocacao(int Id)
        {
            Locacao locacao = GetLocacao(Id);
            Context db      = new Context();

            db.Locacoes.Remove(locacao);
            db.SaveChanges();
        }
Example #2
0
        public static Locacao AtualizarLocacoes(
            Locacao locacao
            )
        {
            Context db = new Context();

            db.Locacoes.Update(locacao);
            db.SaveChanges();
            return(locacao);
        }
Example #3
0
        public override string ToString()
        {
            return(String.Format(
                       "Id: {0} - Nome do Cliente: {1} - Data de Nascimento: {2:d} - Dias p/ Devolução: {3} - Qtd. Locações {4}",

                       this.Id,
                       this.Nome,
                       this.DtNascimento,
                       this.DiasParaRetorno,
                       Locacao.GetCount(this.Id)
                       ));
        }
Example #4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj.GetType() != this.GetType())
            {
                return(false);
            }
            Locacao locacao = (Locacao)obj;

            return(this.GetHashCode() == locacao.GetHashCode());
        }
Example #5
0
        public LocacaoVeiculoLeve(
            Locacao Locacao,
            VeiculoLeve VeiculoLeve
            )
        {
            Context db = new Context();

            this.Locacao       = Locacao;
            this.IdLocacao     = Locacao.Id;
            this.VeiculoLeve   = VeiculoLeve;
            this.IdVeiculoLeve = VeiculoLeve.Id;

            db.LocacaoVeiculoLeves.Add(this);
            db.SaveChanges();
        }
Example #6
0
        public LocacaoVeiculoPesado(
            Locacao Locacao,
            VeiculoPesado VeiculoPesado
            )
        {
            Context db = new Context();

            this.Locacao         = Locacao;
            this.IdLocacao       = Locacao.Id;
            this.VeiculoPesado   = VeiculoPesado;
            this.IdVeiculoPesado = VeiculoPesado.Id;

            db.LocacaoVeiculoPesados.Add(this);
            db.SaveChanges();
        }
Example #7
0
        public static Locacao AtualizarLocacao(
            Locacao locacao,
            string stringValor,
            string stringCampo
            )
        {
            int Campo = Convert.ToInt32(stringCampo);

            switch (Campo)
            {
            case 1:
                locacao.DataLocacao = Convert.ToDateTime(stringValor);
                break;
            }
            Context db = new Context();

            db.Locacoes.Update(locacao);
            db.SaveChanges();
            return(locacao);
        }