public bool Cadastra(Veiculo c) { if (!string.IsNullOrEmpty(c.Placa)) { if (c.Placa.Length > 6) { if (!string.IsNullOrEmpty(c.Modelo)) { if (!string.IsNullOrEmpty(c.Km)) { if (!string.IsNullOrEmpty(c.ProxTroca)) { if (!string.IsNullOrEmpty(c.TrocaPadrao)) { CadVeiculosDAO DAO = new CadVeiculosDAO(); DataTable Result = new DataTable(); Result = DAO.Cadastra(c, Autenticacao.GetCodUsuario()); if (Result != null) { if (Result.Rows.Count > 0) { if (Result.Rows[0].ItemArray[0].ToString().Equals("1")) { return(true); } else { return(false); } } } } } } } } } return(false); }
public Veiculo BuscaAnt(Veiculo c) { CadVeiculosDAO DAO = new CadVeiculosDAO(); DataTable Result = new DataTable(); Result = DAO.BuscaAnt(c); if (Result != null) { if (Result.Rows.Count > 0) { if (!Result.Rows[0].ItemArray[0].ToString().Equals("-1")) { c = DataToUsuario(Result, c); return(c); } else { return(null); } } else { c.Id = null; Result = DAO.BuscaAnt(c); if (Result != null) { if (Result.Rows.Count > 0) { if (!Result.Rows[0].ItemArray[0].ToString().Equals("-1")) { c = DataToUsuario(Result, c); return(c); } } } } } return(null); }
public bool Apaga(string placa) { CadVeiculosDAO DAO = new CadVeiculosDAO(); if (!string.IsNullOrEmpty(placa)) { DataTable Result = new DataTable(); Result = DAO.Apaga(placa, Autenticacao.GetCodUsuario()); if (Result != null) { if (Result.Rows.Count > 0) { if (Result.Rows[0].ItemArray[0].ToString().Equals("1")) { return(true); } } } } return(false); }