예제 #1
0
        public static bool Cadastro(ObjConexao objConexao)
        {
            bancoClienteDataContext = new BancoClienteDataContext();
            conexao = new BancoDados.Conexao();
            try
            {
                conexao.Ip             = objConexao.Ip;
                conexao.Porta          = objConexao.Porta;
                conexao.Senha          = objConexao.Senha;
                conexao.Dominio        = objConexao.Dominio;
                conexao.Id_Cliente     = objConexao.ObjCliente.Id;
                conexao.Id_TipoConexao = objConexao.ObjTipoConexao.Id;

                bancoClienteDataContext.Conexaos.InsertOnSubmit(conexao);
                bancoClienteDataContext.SubmitChanges();
                return(true);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                bancoClienteDataContext.Dispose();
            }
        }
예제 #2
0
 public static bool Cadastro(ObjConexao objConexao)
 {
     bancoClienteDataContext = new BancoClienteDataContext();
     conexao = new BancoDados.Conexao();
     try
     {
         conexao = bancoClienteDataContext.Conexaos.First(con => con.Id == objConexao.Id);
         bancoClienteDataContext.Conexaos.DeleteOnSubmit(conexao);
         bancoClienteDataContext.SubmitChanges();
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         bancoClienteDataContext.Dispose();
     }
 }