Example #1
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;
            }
        }
Example #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;
            }
        }
Example #3
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;
        }
Example #4
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;
            }
        }
Example #5
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;
            }
        }
Example #6
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;
            }
        }
Example #7
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;
               }
        }
Example #8
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;
            }
        }
Example #9
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;
            }
        }
Example #10
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;
            }
        }
Example #11
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;
 }
Example #12
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;
            }
        }
Example #13
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;
            }
        }
Example #14
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;
            }
        }