Esempio n. 1
0
        public static CETipoProducto Tipo_Producto_Consultar_datos(Result_transaccion obj_transac, string m_cod_tipo)
        {
            CETipoProducto obj_tipo = new CETipoProducto();
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                obj_tipo = CDTipoProducto.Tipo_Producto_Consultar_datos(conn, m_cod_tipo);

                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo consultar los datos del tipo de producto" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }

            return obj_tipo;
        }
Esempio n. 2
0
        public Boolean userValidate(CEuser oCEUser)
        {
            bool result = false;
            String procedure = "spGetUser";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection= oCDConnection.openDB();
                SqlCommand oSqlCommand = oSqlConnection.CreateCommand();
                oSqlCommand.CommandText = procedure;
                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.Parameters.Add("@id",SqlDbType.VarChar,25).Value=oCEUser.id_usuario;
                oSqlCommand.Parameters.Add("@clave", SqlDbType.VarChar, 25).Value = oCEUser.clave;
                SqlDataReader oSqlDataReader= oSqlCommand.ExecuteReader();
                if (oSqlDataReader.HasRows)
                {
                   result = true;
                }

                return result;
            }
            catch(Exception e)
            {
                e.ToString();
                return result;
            }
        }
Esempio n. 3
0
        public static CEModelo Modelo_Consultar_datos(Result_transaccion obj_transac, string m_cod_modelo)
        {
            CEModelo obj_modelo = new CEModelo();
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                obj_modelo = CDModelo.Modelo_Consultar_datos(conn, m_cod_modelo);

                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo consultar los datos del modelo" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }

            return obj_modelo;
        }
Esempio n. 4
0
        public static void Modelo_Grabar(string Accion, CEModelo obj_modelo, Result_transaccion obj_transac)
        {
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                if (Accion == "N")
                {
                    CDModelo.Modelo_Insertar(conn, obj_modelo);
                }
                else
                {
                    CDModelo.Modelo_Actualizar(conn, obj_modelo);
                }

                obj_transac.resultado = 1;
                obj_transac.new_codigo = obj_modelo.cod_modelo;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo grabar la informacion en la base de datos" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }
        }
Esempio n. 5
0
        public static CEClase Clase_Consultar_datos(Result_transaccion obj_transac, string m_cod_clase)
        {
            CEClase obj_clase = new CEClase();
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                obj_clase = CDClase.Clase_Consultar_datos(conn, m_cod_clase);

                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo consultar los datos de la clase" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }

            return obj_clase;
        }
Esempio n. 6
0
        public static CEUnidad_Medida Unidad_Medida_Consultar_datos(Result_transaccion obj_transac, string m_cod_um)
        {
            CEUnidad_Medida obj_um = new CEUnidad_Medida();
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                obj_um = CDUnidad_Medida.Unidad_Medida_Consultar_datos(conn,m_cod_um);

                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo consultar los datos del modelo" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }

            return obj_um;
        }
Esempio n. 7
0
        public DataTable gettipoproducto_eliminar(string cod_tipo)
        {
            string procedure = "sp_eliminar_tipodeproducto";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.Parameters.Add("@cod_tipo", SqlDbType.Char, 4).Value = cod_tipo;
                //oSqlCommand.ExecuteNonQuery();
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);

                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 8
0
        public static CEMarca Marca_Consultar_datos(Result_transaccion obj_transac, string m_cod_marca)
        {
            CEMarca obj_marca = new CEMarca();
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                obj_marca = CDMarca.Marca_Consultar_datos(conn,m_cod_marca);

                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo consultar los datos de la marca" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }

            return obj_marca;
        }
Esempio n. 9
0
        public bool actualizartipoproducto(Entidad.TipoDeProducto oFamilia)
        {
            CDConnection ocd = new CDConnection();
            SqlConnection oconexion = ocd.openDB();
            SqlCommand oSqlCommand = new SqlCommand("sp_actualizar_tipoproducto", oconexion);
            oSqlCommand.CommandType = CommandType.StoredProcedure;
            oSqlCommand.Parameters.Add("@id_empresa", SqlDbType.Int).Value = oFamilia.id_Empresa;
            oSqlCommand.Parameters.Add("@cod_iso", SqlDbType.VarChar, 2).Value = oFamilia.Cod_iso_idio;
            oSqlCommand.Parameters.Add("@codigo", SqlDbType.VarChar, 3).Value = oFamilia.cod_cate;
            oSqlCommand.Parameters.Add("@codigo_clase", SqlDbType.VarChar, 3).Value = oFamilia.cod_clase;
            oSqlCommand.Parameters.Add("@cod_tipo", SqlDbType.VarChar, 4).Value = oFamilia.cod_tipo;
            oSqlCommand.Parameters.Add("@abrv", SqlDbType.VarChar, 10).Value = oFamilia.txt_abrv;
            oSqlCommand.Parameters.Add("@desc", SqlDbType.VarChar, 50).Value = oFamilia.txt_desc;

            oSqlCommand.ExecuteNonQuery();
            oconexion.Close();
            return true;
        }
Esempio n. 10
0
        public DataTable getAllProducts()
        {
            string sp = "sp_inv_all";

            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(sp, oSqlConnection);
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;
            }
            catch
            {
                return null;
            }
        }
Esempio n. 11
0
        public DataTable getAlmacenList()
        {
            String procedure_alm = "sp_listar_alm";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure_alm, oSqlConnection);
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 12
0
        public DataTable getMarca_ModeloAll()
        {
            String procedure = "usp_marca_modelo_Listar";
               try
               {
               SqlConnection oSqlConnection = new SqlConnection();
               CDConnection oCDConnection = new CDConnection();
               oSqlConnection = oCDConnection.openDB();
               SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
               SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
               DataTable oDataTable = new DataTable();
               oSqlDataAdapter.Fill(oDataTable);
               return oDataTable;

               }
               catch (Exception e)
               {
               e.ToString();
               return null;
               }
        }
Esempio n. 13
0
        public DataTable getSubFamiliaAll()
        {
            String procedure = "spSubFamiliaReadAll";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 14
0
        public static void Marca_Modelo_Grabar(CEMarca_Modelo obj_marca_modelo, Result_transaccion obj_transac)
        {
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                CDMarca_Modelo.Marca_Modelo_Insertar(conn,obj_marca_modelo);
                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo grabar la informacion en la base de datos" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }
        }
Esempio n. 15
0
        public DataTable getTipoProductolistar()
        {
            String procedure = "sp_listar_TipodeProducto";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);

                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 16
0
        public static void Marca_Modelo_Eliminar(Result_transaccion obj_transac, string m_cod_marca)
        {
            SqlConnection conn = null;

            try
            {
                conn = new CDConnection().openDB();
                CDMarca_Modelo.Marca_Modelo_Eliminar(conn, m_cod_marca);

                obj_transac.resultado = 1;
                obj_transac.msg_error = "";
            }
            catch (Exception ex)
            {
                obj_transac.resultado = 0;
                obj_transac.msg_error = "Error!!! No se pudo eliminar la informacion de la base de datos" + ex.Message;
            }
            finally
            {
                CDConnection.CloseConexion(conn);
            }
        }
Esempio n. 17
0
        public DataTable getGriewList(CEInventario oEntidad)
        {
            String procedure_alm = "sp_inv";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure_alm, oSqlConnection);
                oSqlCommand.CommandType=CommandType.StoredProcedure;
                oSqlCommand.Parameters.Add("@nom_alm", SqlDbType.Char, 15).Value = oEntidad.almacen;
                oSqlCommand.Parameters.Add("@nom_est", SqlDbType.VarChar, 20).Value = oEntidad.tipo_Inventario;
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 18
0
        //public DataTable insertar(Categoria oCategoria)
        //{
        //  try
        //{
        //  CDConnection  oCD = new CDConnection ();
        //SqlConnection oSqlConnection = oCD.openDB();
        //SqlCommand SqlCommand = new SqlCommand("sp_insertar_categoria", oSqlConnection);
        //SqlCommand.CommandType = CommandType.StoredProcedure;
        //SqlCommand.Parameters.Add("@id_Categoria", SqlDbType.Char, 3).Value = oCategoria.Id_Categoria;
        //SqlCommand.Parameters.Add("@Nombre", SqlDbType.Char, 50).Value = oCategoria.Nombre;
        //oSqlConnection.Open();
        //SqlCommand.ExecuteNonQuery();
        //oSqlConnection.Close();
        //}
        //atch (System.Exception ex)
        //{
        // error = "Error: " + ex.Message;
        // }
        //return error;
        //        }
        public DataTable Buscar(string Nombre)
        {
            String procedure = "sp_buscar_Categoria";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection  oCDConnection = new CDConnection ();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.Parameters.Add("@descripcion", SqlDbType.VarChar, 50).Value = Nombre;
                oSqlCommand.ExecuteNonQuery();
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 19
0
        public DataTable getModeloAnterior(string cod_marca)
        {
            String procedure = "usp_modelo_Listar_anterior";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.Parameters.Add("@cod_marca", SqlDbType.VarChar, 3).Value = cod_marca;
                oSqlCommand.ExecuteNonQuery();
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 20
0
        public DataTable llenar_combobox4()
        {
            String procedure = "llenar_combobox4";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection oCDConnection = new CDConnection();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);
                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }
Esempio n. 21
0
 public bool getCategoria_actualizar(CECategoria oCategoria)
 {
     CDConnection  ocd = new CDConnection ();
     SqlConnection oconexion = ocd.openDB();
     SqlCommand oSqlCommand = new SqlCommand("sp_actualizar_categoria", oconexion);
     oSqlCommand.CommandType = CommandType.StoredProcedure;
     oSqlCommand.Parameters.Add("@id_Empresa", SqlDbType.Int).Value = oCategoria.id_Empresa;
     oSqlCommand.Parameters.Add("@cod_iso_idio", SqlDbType.VarChar, 2).Value = oCategoria.cod_iso_idio;
     oSqlCommand.Parameters.Add("@cod_cat", SqlDbType.VarChar, 3).Value = oCategoria.Id_Categoria;
     oSqlCommand.Parameters.Add("@abrv", SqlDbType.VarChar, 10).Value = oCategoria.Nombre;
     oSqlCommand.Parameters.Add("@desc", SqlDbType.VarChar, 50).Value = oCategoria.descripcion;
     oSqlCommand.ExecuteNonQuery();
     oconexion.Close();
     return true;
 }
Esempio n. 22
0
        public DataTable getFammilia_eliminar(string Id_Categoria)
        {
            string procedure = "sp_eliminar_categoria";
            try
            {
                SqlConnection oSqlConnection = new SqlConnection();
                CDConnection  oCDConnection = new CDConnection ();
                oSqlConnection = oCDConnection.openDB();
                SqlCommand oSqlCommand = new SqlCommand(procedure, oSqlConnection);
                oSqlCommand.CommandType = CommandType.StoredProcedure;
                oSqlCommand.Parameters.Add("@cod_cate", SqlDbType.VarChar, 3).Value = Id_Categoria;
                //oSqlCommand.ExecuteNonQuery();
                SqlDataAdapter oSqlDataAdapter = new SqlDataAdapter(oSqlCommand);
                DataTable oDataTable = new DataTable();
                oSqlDataAdapter.Fill(oDataTable);

                return oDataTable;

            }
            catch (Exception e)
            {
                e.ToString();
                return null;
            }
        }