Example #1
0
        public void rellenarproducto()
        {
            DataTable     dt          = new DataTable();
            Clconexion    objconexion = new Clconexion();
            SqlConnection conexion    = new SqlConnection(objconexion.conexion());

            conexion.Open();
            SqlCommand     combobox = new SqlCommand("select * from Producto", conexion);
            SqlDataAdapter da       = new SqlDataAdapter(combobox);

            da.Fill(dt);
            this.comboarticulo.DataSource    = dt;
            this.comboarticulo.ValueMember   = "PR_ID";
            this.comboarticulo.DisplayMember = "PR_NOMBRE";
            conexion.Close();

            AutoCompleteStringCollection colectar = new AutoCompleteStringCollection();

            foreach (DataRow Row in dt.Rows)
            {
                colectar.Add(Convert.ToString(Row["PR_NOMBRE"]));
            }
            comboarticulo.AutoCompleteCustomSource = colectar;
            comboarticulo.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            comboarticulo.AutoCompleteSource       = AutoCompleteSource.CustomSource;
        }
Example #2
0
        public static void auditoria(string au_actividad)
        {
            Clconexion    objconexion = new Clconexion();
            SqlConnection con         = new SqlConnection(objconexion.conexion());

            con.Open();

            SqlCommand Registrar = new SqlCommand("insert into Auditoria values(@au_usuario,@au_fecha,@au_descrip)", con);

            Registrar.Parameters.AddWithValue("@au_usuario", Clases.clusuario.usuario);
            Registrar.Parameters.AddWithValue("@au_fecha", DateTime.Today);
            Registrar.Parameters.AddWithValue("@au_descrip", au_actividad);
            Registrar.ExecuteNonQuery();
            con.Close();

            //string user = "******";
            //string usuario = Clases.clusuario.persona;
            //Clconexion objconexion = new Clconexion();
            //SqlConnection conexion = new SqlConnection(objconexion.conexion());
            //conexion.Open();
            //string query = "insert into Auditoria values('"+usuario+"','"+DateTime.Now.ToString("MM/dd/yyyy/ HH:mm:ss")+"','"+au_actividad+"')";
            //SqlCommand cmd = new SqlCommand(query, conexion);
            //cmd.ExecuteNonQuery();
            //conexion.Close();
        }
Example #3
0
        public void cargarcliente()
        {
            DataTable      dt          = new DataTable();
            Clconexion     objconexion = new Clconexion();
            SqlConnection  conexion    = new SqlConnection(objconexion.conexion());
            SqlCommand     combobox    = new SqlCommand("select * from Cliente", conexion);
            SqlDataAdapter da          = new SqlDataAdapter(combobox);

            da.Fill(dt);
            this.cboxcliente.DataSource    = dt;
            this.cboxcliente.ValueMember   = "CLI_CLAVE";
            this.cboxcliente.DisplayMember = "CLI_NOMBRE";
            conexion.Close();
        }
Example #4
0
        public static void realizar(string ruta)
        {
            string        fecha       = DateTime.Now.ToString("dd-MM-yyyy");
            string        query       = "BACKUP DATABASE [NEVERIAC] TO DISK = N'" + ruta + "" + "/Respaldo Neveria" + " " + fecha + ".bak' WITH NOFORMAT, NOINIT, NAME= N'Neveria completa base de datos  copia de seguridad', SKIP, NOREWIND, NOUNLOAD, STATS=10";
            Clconexion    objconexion = new Clconexion();
            SqlConnection conexion    = new SqlConnection(objconexion.conexion());
            SqlCommand    cmd;

            cmd            = new SqlCommand(query);
            cmd.Connection = conexion;
            conexion.Open();
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
Example #5
0
        public void maximo()
        {
            Clconexion    objconexion = new Clconexion();
            SqlConnection conexion    = new SqlConnection(objconexion.conexion());

            conexion.Open();
            SqlCommand comando = new SqlCommand("SELECT isnull(MAX(VG_FOLIO),0)+1 AS ultimo from Venta_general", conexion);

            SqlDataReader Lector = comando.ExecuteReader();

            if (Lector.Read())
            {
                txtNumVenta.Text = Lector["ultimo"].ToString();
            }
            conexion.Close();
        }
Example #6
0
 private void txtcliente_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         Clconexion    objconexion = new Clconexion();
         SqlConnection conexion    = new SqlConnection(objconexion.conexion());
         conexion.Open();
         string     query = "select CLI_NOMBRE FROM Cliente where CLI_CLAVE=@Clave";
         SqlCommand cmd   = new SqlCommand(query, conexion);
         cmd.Parameters.Clear();
         cmd.Parameters.AddWithValue("@Clave", txtcliente.Text);
         SqlDataReader lector = cmd.ExecuteReader();
         if (lector.Read())
         {
             txtnombrec.Text    = lector["CLI_NOMBRE"].ToString();
             txtcliente.Enabled = false;
             //cboxempleado.Enabled = true;
             //cboxempleado.Focus();
             btnbuscarcliente.Enabled = false;
         }
         conexion.Close();
     }
 }