Exemplo n.º 1
0
 public Etapa_TO GetByCode(Etapa_TO pTO)
 {
     try
     {
         return(new Etapa_DAO().GetByCode(pTO));
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 2
0
        public bool Delete(Etapa_TO pTO)
        {
            bool retorno = false;

            try
            {
                retorno = new Etapa_DAO().Delete(pTO);
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Exemplo n.º 3
0
        public List <Etapa_TO> SearchAll(Etapa_TO pTO)
        {
            string condicao = "";

            try
            {
// implementa a condição de procura
                condicao += "";
                return(new Etapa_DAO().SearchAll(condicao));
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 4
0
        internal List <Etapa_TO> SearchAll(string pCondicao)
        {
            SqlConnection connection = null;

            try
            {
                connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);
                connection.Open();
            }
            catch (Exception)
            {
                throw;
            }

            SqlCommand    command = null;
            SqlDataReader reader  = null;

            string sql = " SELECT * FROM vcrm_etapa ";

            List <Etapa_TO> collection = new List <Etapa_TO>();

            try
            {
                command = new SqlCommand(sql, connection);
                reader  = command.ExecuteReader();

                while (reader.Read())
                {
                    Etapa_TO EtapaTO = new Etapa_TO();
                    EtapaTO.eta_codigo = Convert.ToInt32(reader["eta_codigo"]);
                    EtapaTO.eta_nome   = Convert.ToString(reader["eta_nome"]);
                    EtapaTO.eta_final  = Convert.ToInt32(reader["eta_final"]);
                    collection.Add(EtapaTO);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }
            return(collection);
        }
Exemplo n.º 5
0
        internal bool Save(Etapa_TO pTO)
        {
            SqlConnection connection = null;

            try
            {
                connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);
                connection.Open();
            }
            catch (Exception)
            {
                throw;
            }

            SqlCommand command = null;
            bool       retorno = false;

            string sql = "INSERT INTO vcrm_etapa" +
                         " ( eta_codigo " +
                         ", eta_nome " +
                         ", eta_final) " +
                         "VALUES " +
                         "( @eta_codigo " +
                         " , @eta_nome " +
                         " , @eta_final ) ";

            try
            {
                command = new SqlCommand(sql, connection);
                command.Parameters.AddWithValue("@eta_codigo", pTO.eta_codigo);
                command.Parameters.AddWithValue("@eta_nome", pTO.eta_nome);
                command.Parameters.AddWithValue("@eta_final", pTO.eta_final);
                command.ExecuteNonQuery();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }

            return(retorno);
        }
Exemplo n.º 6
0
        internal Etapa_TO GetByCode(Etapa_TO pTO)
        {
            SqlConnection connection = null;

            try
            {
                connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);
                connection.Open();
            }
            catch (Exception)
            {
                throw;
            }
            SqlCommand    command = null;
            SqlDataReader reader  = null;

            string sql = " SELECT * FROM vcrm_etapa ";

            try
            {
                command = new SqlCommand(sql, connection);

                reader = command.ExecuteReader();

                if (reader.Read())
                {
                    pTO.eta_codigo = Convert.ToInt32(reader["eta_codigo"]);
                    pTO.eta_nome   = Convert.ToString(reader["eta_nome"]);
                    pTO.eta_final  = Convert.ToInt32(reader["eta_final"]);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }

            return(pTO);
        }
Exemplo n.º 7
0
        public bool Save(bool pOpcao, Etapa_TO pTO)
        {
            bool retorno = false;

            try
            {
                if (pOpcao)
                {
                    retorno = new Etapa_DAO().Save(pTO);
                }
                else
                {
                    retorno = new Etapa_DAO().Update(pTO);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Exemplo n.º 8
0
        internal bool Delete(Etapa_TO pTO)
        {
            SqlConnection connection = null;

            try
            {
                connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);
                connection.Open();
            }
            catch (Exception)
            {
                throw;
            }

            SqlCommand command = null;
            bool       retorno = false;

            string sql = "DELETE FROM vcrm_etapa" +
                         "WHERE ... ";

            try
            {
                command = new SqlCommand(sql, connection);

                command.ExecuteNonQuery();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                command.Dispose();
                connection.Close();
                connection.Dispose();
            }

            return(retorno);
        }