private void cmdFinalizar_Click(object sender, EventArgs e)
        {
            cmd             = new SqlCommand("ROAD_TO_PROYECTO.Finalizar_Publicacion", db.Connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@PubliId", SqlDbType.Int).Value = (int)dgPublis[0, fila].Value;
            cmd.ExecuteNonQuery();
            MessageBox.Show("Publicación finalizada");

            cmd             = new SqlCommand("ROAD_TO_PROYECTO.Buscar_Ultima_Factura", db.Connection);
            cmd.CommandType = CommandType.StoredProcedure;

            sdr = cmd.ExecuteReader();
            while (sdr.Read())
            {
                factId = int.Parse(sdr["FactNro"].ToString());
            }
            sdr.Close();

            dgPublis.Visible     = false;
            cmdActivar.Visible   = false;
            cmdModificar.Visible = false;
            cmdFinalizar.Visible = false;

            WindowsFormsApplication1.ComprarOfertar.Facturar factura = new WindowsFormsApplication1.ComprarOfertar.Facturar();
            factura.factId        = factId;
            factura.publId        = int.Parse(dgPublis[0, fila].Value.ToString());
            factura.esPorConsulta = 0;
            factura.Show();
            this.Hide();
        }
Esempio n. 2
0
        private void cmdFinalizar_Click(object sender, EventArgs e)
        {
            cmd             = new SqlCommand("ROAD_TO_PROYECTO.Usuario_Nuevo", db.Connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@Usuario", SqlDbType.Int).Value = user;

            sdr = cmd.ExecuteReader();
            while (sdr.Read())
            {
                esNuevo = int.Parse(sdr["Nuevo"].ToString());
            }
            sdr.Close();

            cmd             = new SqlCommand("ROAD_TO_PROYECTO.Visibilidad_Publicacion", db.Connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@PubliId", SqlDbType.Int).Value = (int)dgPublis[0, fila].Value;

            sdr = cmd.ExecuteReader();
            while (sdr.Read())
            {
                visibPubli = sdr["Descripcion"].ToString();
            }
            sdr.Close();

            cmd             = new SqlCommand("ROAD_TO_PROYECTO.Finalizar_Publicacion", db.Connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@PubliId", SqlDbType.Int).Value          = (int)dgPublis[0, fila].Value;
            cmd.Parameters.AddWithValue("@FechaActual", SqlDbType.DateTime).Value = Fecha.getFechaActual();
            cmd.ExecuteNonQuery();
            MessageBox.Show("Se finalizó la publicación", "Sr.Usuario", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);

            dgPublis.Visible     = false;
            cmdActivar.Visible   = false;
            cmdModificar.Visible = false;
            cmdPausar.Visible    = false;
            cmdFinalizar.Visible = false;

            if (esNuevo == 0 && !(visibPubli == "Gratis"))
            {
                cmd             = new SqlCommand("ROAD_TO_PROYECTO.Buscar_Ultima_Factura", db.Connection);
                cmd.CommandType = CommandType.StoredProcedure;

                sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    factId = int.Parse(sdr["FactNro"].ToString());
                }
                sdr.Close();

                WindowsFormsApplication1.ComprarOfertar.Facturar factura = new WindowsFormsApplication1.ComprarOfertar.Facturar();
                factura.factId        = factId;
                factura.publId        = int.Parse(dgPublis[0, fila].Value.ToString());
                factura.esPorConsulta = 0;
                factura.Show();
                this.Hide();
            }
        }
        private void cmdVerFactura_Click(object sender, EventArgs e)
        {
            int fila = dataGridView1.CurrentRow.Index;

            WindowsFormsApplication1.ComprarOfertar.Facturar factura = new WindowsFormsApplication1.ComprarOfertar.Facturar();
            factura.factId        = int.Parse(dataGridView1[0, fila].Value.ToString());
            factura.publId        = int.Parse(dataGridView1[1, fila].Value.ToString());
            factura.esPorConsulta = 1;
            factura.Show();
            this.Hide();
        }