예제 #1
0
        private void botBuscar_Click(object sender, EventArgs e)
        {
            string query = "select c.nombre as Nombre, c.apellido as Apellido, c.doc as Documento, t.nro_tarjeta as Número_tarjeta, t.fecha_alta as Fecha from NTVC.Cliente c, NTVC.tarjeta t where t.cod_cliente = c.cod_cliente and ";

            if (FuncionesUtiles.esNumerico(textNumeroTarjeta) || FuncionesUtiles.estaVacio(textNumeroTarjeta))
            {
                if (!FuncionesUtiles.estaVacio(textNumeroTarjeta))
                {
                    query += "t.nro_tarjeta = " + textNumeroTarjeta.Text + " and ";
                }
                if (!FuncionesUtiles.estaVacio(textFechaAlta))
                {
                    query += "t.fecha_alta = '" + textFechaAlta.Text + "' and ";
                }
                if (!FuncionesUtiles.estaVacio(textCliente))
                {
                    query += "t.cod_cliente = " + textCliente.Text + " and ";
                }
                query += "1=1";
                FuncionesUtiles.llenarDataGridView(query, dataGridView1);
            }
            else
            {
                MessageBox.Show("El número de tarjeta debe ser un valor numérico y menor a 2000000000", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
            }
        }
예제 #2
0
 private void botLimpiar_Click(object sender, EventArgs e)
 {
     this.textCliente.Text       = "";
     this.textFechaAlta.Text     = "";
     this.textNumeroTarjeta.Text = "";
     FuncionesUtiles.llenarDataGridView("select c.nombre as Nombre, c.apellido as Apellido, c.doc as Documento, t.nro_tarjeta as Número_tarjeta, t.fecha_alta as Fecha from NTVC.Cliente c, NTVC.tarjeta t where c.cod_cliente = 0 and t.cod_cliente = 0", dataGridView1);
 }
예제 #3
0
        private void salirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (FuncionesUtiles.ventanaDialogo())
            {
            case "Yes":
                FuncionesUtiles.siguienteActiva = false;
                FuncionesUtiles.activarMenu();
                FuncionesUtiles.INVENTARIO_EQUIPO = "";
                guardar();
                this.Close();
                return;

            case "No":
                FuncionesUtiles.siguienteActiva = false;
                FuncionesUtiles.activarMenu();
                FuncionesUtiles.INVENTARIO_EQUIPO = "";
                this.Close();
                return;

            case "Cancel":
                return;

            default:
                return;
            }
        }
예제 #4
0
 private void salirToolStripMenuItem_Click(object sender, EventArgs e)
 {
     this.Close();
     FuncionesUtiles.siguienteActiva = false;
     FuncionesUtiles.activarMenu();
     FuncionesUtiles.INVENTARIO_EQUIPO = "";
 }
예제 #5
0
        private void guardarCsvMenuItem_Click(object sender, EventArgs e)
        {
            login log;

            switch (FuncionesUtiles.ventanaDialogo())
            {
            case "Yes":

                guardar();
                log = new login();
                log.Show();
                this.Visible = false;
                FuncionesUtiles.form1.Visible     = false;
                FuncionesUtiles.INVENTARIO_EQUIPO = "";
                return;

            case "No":
                log = new login();
                log.Show();
                this.Visible = false;
                FuncionesUtiles.form1.Visible     = false;
                FuncionesUtiles.INVENTARIO_EQUIPO = "";
                return;

            case "Cancel":
                return;

            default:
                return;
            }
        }
 private void botBuscar_Click(object sender, EventArgs e)
 {
     //verificar los numericos
     if ((!FuncionesUtiles.esNumerico(textNumero) && !FuncionesUtiles.estaVacio(textNumero)))
     {
         //hay campos numericos con valores no numericos
         string mensaje = "Los siguientes campos deben ser numéricos y positivos:";
         if (!FuncionesUtiles.esNumerico(textNumero) && !FuncionesUtiles.estaVacio(textNumero))
         {
             mensaje += "\n-Número";
         }
     }
     else
     {
         SqlConnection con = Conexion.conectar();
         con.Open();
         SqlCommand    com;
         SqlDataReader reader;
         string        cod_rubro = "";
         if (comboBoxRubro.SelectedIndex > -1)
         {
             com = new SqlCommand("select cod_rubro from ntvc.rubro where descripcion = @descripcion", con);
             com.Parameters.AddWithValue("@descripcion", comboBoxRubro.Items[comboBoxRubro.SelectedIndex].ToString().Trim());
             reader = com.ExecuteReader();
             if (reader.Read())
             {
                 cod_rubro = reader["cod_rubro"].ToString().Trim();
             }
             reader.Close();
         }
         string select = "select distinct b.razon_social as Razón_Social, b.dir_calle as Calle, b.dir_nro as Número, b.dir_piso as Piso, b.dir_dpto as Depto, r.descripcion as Rubro from ntvc.beneficiario b, ntvc.rubro r where b.cod_rubro = r.cod_rubro and ";
         if (!FuncionesUtiles.estaVacio(textCalle))
         {
             select += "b.dir_calle like '%" + textCalle.Text + "%' and ";
         }
         if (!FuncionesUtiles.estaVacio(textDepto))
         {
             select += "b.dir_dpto like '%" + textDepto.Text + "%' and ";
         }
         if (!FuncionesUtiles.estaVacio(textNumero))
         {
             select += "b.dir_nro = " + textNumero.Text + " and ";
         }
         if (!FuncionesUtiles.estaVacio(textPiso))
         {
             select += "b.dir_piso = " + textPiso.Text + " and ";
         }
         if (!FuncionesUtiles.estaVacio(textRazonSocial))
         {
             select += "b.razon_social like '%" + textRazonSocial.Text + "%' and ";
         }
         if (comboBoxRubro.SelectedIndex > -1)
         {
             select += "r.descripcion = '" + comboBoxRubro.Items[comboBoxRubro.SelectedIndex].ToString().Trim() + "' and ";
         }
         select += "1 = 1";
         FuncionesUtiles.llenarDataGridView(select, dataGridView1);
         con.Close();
     }
 }
예제 #7
0
 private void botBuscar_Click(object sender, EventArgs e)
 {
     if (!FuncionesUtiles.esNumerico(textDNI) && !FuncionesUtiles.estaVacio(textDNI))
     {
         MessageBox.Show("El documento debe ser numérico.", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
     }
     else
     {
         SqlConnection con = Conexion.conectar();
         con.Open();
         string busqueda = "select c.nombre as Nombre, c.apellido as Apellido, c.tipo_doc as Tipo, c.doc as Documento, p.nombre as Provincia, c.mail as Mail, c.telefono as Teléfono, c.dir_calle as Calle, c.dir_nro as Número, c.dir_piso as Piso, c.dir_dpto as Depto from NTVC.Cliente c, NTVC.provincia p where c.cod_provincia = p.cod_provincia and ";
         if (!FuncionesUtiles.estaVacio(textApellido))
         {
             busqueda += "c.apellido like '%" + textApellido.Text + "%' and ";
         }
         if (!FuncionesUtiles.estaVacio(textNombre))
         {
             busqueda += "c.nombre like '%" + textNombre.Text + "%' and ";
         }
         if (!FuncionesUtiles.estaVacio(textDNI))
         {
             busqueda += "c.doc = " + textDNI.Text + " and ";
         }
         if (comboBox1.SelectedIndex > -1)
         {
             busqueda += "p.nombre = '" + comboBox1.Items[comboBox1.SelectedIndex].ToString().Trim() + "' and ";
         }
         busqueda += "1=1";
         FuncionesUtiles.llenarDataGridView(busqueda, dataGridView1);
     }
 }
예제 #8
0
 private void botBuscar_Click(object sender, EventArgs e)
 {
     if (!FuncionesUtiles.esNumerico(textNumeroSerie) && !FuncionesUtiles.estaVacio(textNumeroSerie))
     {
         MessageBox.Show("El número de serie debe ser numérico.", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
     }
     else
     {
         SqlConnection con = Conexion.conectar();
         con.Open();
         string busqueda = "select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where cod_postnet not in (select cod_postnet from ntvc.beneficiario_postnet) and ";
         if (!FuncionesUtiles.estaVacio(textMarca))
         {
             busqueda += "Marca like '%" + textMarca.Text + "%' and ";
         }
         if (!FuncionesUtiles.estaVacio(textModelo))
         {
             busqueda += "Modelo like '%" + textModelo.Text + "%' and ";
         }
         if (!FuncionesUtiles.estaVacio(textNumeroSerie))
         {
             busqueda += "nro_serie  = " + textNumeroSerie.Text + " and ";
         }
         busqueda += "1=1";
         FuncionesUtiles.llenarDataGridView(busqueda, dataGridView1);
         con.Close();
     }
 }
예제 #9
0
        private void botAgregarPostNets_Click(object sender, EventArgs e)
        {
            SeleccionarPostNets form = new SeleccionarPostNets();

            form.ShowDialog(this);
            if (form.serial_a != "")
            {
                if (!serials.Contains(form.serial_a))
                {
                    serials.Add(form.serial_a);
                    textPostNets.Text = "";
                    foreach (string serial in serials)
                    {
                        if (FuncionesUtiles.estaVacio(textPostNets))
                        {
                            textPostNets.Text = serial;
                        }
                        else
                        {
                            textPostNets.Text += ", " + serial;
                        }
                    }
                }
            }
        }
예제 #10
0
        private void butBuscarVentas_Click(object sender, EventArgs e)
        {
            string select = "SELECT  c.fecha FECHA,cli.apellido APELLIDO,cli.nombre NOMBRE,t.nro_tarjeta NRO_TARJETA,c.cod_postnet COD_POSNET,pos.marca MARCA,pos.modelo MODELO,c.monto MONTO FROM (((ntvc.beneficiario b INNER JOIN ntvc.compra c ON b.cod_beneficiario=c.cod_beneficiario) INNER JOIN ntvc.postnet pos ON pos.cod_postnet=c.cod_postnet) INNER JOIN ntvc.tarjeta t ON t.cod_tarjeta=c.cod_tarjeta) INNER JOIN ntvc.cliente cli ON cli.cod_cliente=t.cod_cliente WHERE c.pagado=0 and b.razon_social=";

            if (!FuncionesUtiles.estaVacio(textBeneficiario))
            {
                select += "'" + textBeneficiario.Text + "' and ";
            }
            if (!FuncionesUtiles.estaVacio(textFechaInicio))
            {
                select += "c.fecha between'" + textFechaInicio.Text + "' and ";
            }
            if (!FuncionesUtiles.estaVacio(textFechaFin))
            {
                select += "'" + textFechaFin.Text + "'";
            }
            if ((!FuncionesUtiles.estaVacio(textFechaFin)) && (!FuncionesUtiles.estaVacio(textFechaInicio)) && (!FuncionesUtiles.estaVacio(textBeneficiario)))
            {
                FuncionesUtiles.llenarDataGridView(select, dataGridView1);
            }
            else
            {
                MessageBox.Show("Debe llenar todos los campos", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
            }
        }
예제 #11
0
 private void botQuitarPostNets_Click(object sender, EventArgs e)
 {
     if (serials.Count() == 0)
     {
         MessageBox.Show("No hay post-nets que quitar", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
     }
     else
     {
         QuitarPostNets form = new QuitarPostNets(serials);
         form.ShowDialog(this);
         serials.Remove(form.serial_q);
         textPostNets.Text = "";
         foreach (string serial in serials)
         {
             if (FuncionesUtiles.estaVacio(textPostNets))
             {
                 textPostNets.Text = serial;
             }
             else
             {
                 textPostNets.Text += ", " + serial;
             }
         }
     }
 }
예제 #12
0
 private void botLimpiar_Click(object sender, EventArgs e)
 {
     textMarca.Text       = "";
     textModelo.Text      = "";
     textNumeroSerie.Text = "";
     FuncionesUtiles.llenarDataGridView("select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where cod_postnet = 0", dataGridView1);
 }
예제 #13
0
        private void pantallaBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            switch (FuncionesUtiles.ventanaDialogo())
            {
            case "Yes":

                guardar();
                this.gridPantalla.Enabled = true;
                this.ApagarBotones();
                Pantalla_Load(sender, e);
                return;

            case "No":
                ApagarBotones();
                gridPantalla.Enabled = true;
                Pantalla_Load(sender, e);
                return;

            case "Cancel":
                return;

            default:
                return;
            }
        }
예제 #14
0
        private void mouseBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            switch (FuncionesUtiles.ventanaDialogo())
            {
            case "Yes":

                guardar();
                Mouse_Load(sender, e);
                ApagarBotones();
                gridMouse.Enabled = true;
                return;

            case "No":
                Mouse_Load(sender, e);
                ApagarBotones();
                gridMouse.Enabled = true;
                return;

            case "Cancel":
                return;

            default:
                return;
            }
        }
예제 #15
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            switch (FuncionesUtiles.ventanaDialogo())
            {
            case "Yes":

                guardar();
                this.Close();

                FuncionesUtiles.form1.Visible   = false;
                FuncionesUtiles.siguienteActiva = true;
                FuncionesUtiles.desactivarMenu();
                FuncionesUtiles.abrirVentanas(new CPU());
                return;

            case "No":
                this.Close();

                FuncionesUtiles.form1.Visible   = false;
                FuncionesUtiles.siguienteActiva = true;
                FuncionesUtiles.desactivarMenu();
                FuncionesUtiles.abrirVentanas(new CPU());
                return;

            case "Cancel":
                return;

            default:
                return;
            }
        }
예제 #16
0
 private void botSeleccionarBenficiario_Click(object sender, EventArgs e)
 {
     SeleccionarBeneficiario form = new SeleccionarBeneficiario();
     form.ShowDialog(this);
     textBeneficiario.Text = form.razon_social;
     comboBoxPostNet.Items.Clear();
     cods_postnets_.Clear();
     if(!FuncionesUtiles.estaVacio(textBeneficiario))
     {
         SqlConnection con = Conexion.conectar();
         con.Open();
         SqlCommand com = new SqlCommand("select cod_beneficiario from ntvc.beneficiario where razon_social = @rs", con);
         com.Parameters.AddWithValue("@rs", form.razon_social);
         SqlDataReader reader = com.ExecuteReader();
         cod_beneficiario_ = "";
         if (reader.Read())
         {
             cod_beneficiario_ = reader["cod_beneficiario"].ToString().Trim();
         }
         reader.Close();
         com = new SqlCommand("select p.cod_postnet, p.nro_serie, p.marca, p.modelo from ntvc.postnet p, ntvc.beneficiario_postnet bp where bp.cod_beneficiario = @cb and bp.cod_postnet = p.cod_postnet", con);
         com.Parameters.AddWithValue("@cb", cod_beneficiario_);
         reader = com.ExecuteReader();
         while (reader.Read())
         {
             string pn = reader["marca"].ToString().Trim() + " " + reader["modelo"].ToString().Trim() + " (" + reader["nro_serie"].ToString().Trim() + ")";
             comboBoxPostNet.Items.Add(pn);
             cods_postnets_.Add(reader["cod_postnet"].ToString().Trim());
         }
         reader.Close();
         con.Close();
     }
 }
예제 #17
0
 private void botLimpiar_Click(object sender, EventArgs e)
 {
     textNombre.Text         = "";
     textApellido.Text       = "";
     textDNI.Text            = "";
     comboBox1.SelectedIndex = -1;
     FuncionesUtiles.llenarDataGridView("select c.nombre as Nombre, c.apellido as Apellido, c.tipo_doc as Tipo, c.doc as Documento, p.nombre as Provincia, c.mail as Mail, c.telefono as Teléfono, c.dir_calle as Calle, c.dir_nro as Número, c.dir_piso as Piso, c.dir_dpto as Depto from NTVC.Cliente c, NTVC.provincia p where cod_cliente = 0 and p.cod_provincia = 0", dataGridView1);
 }
예제 #18
0
        public InactividadTarjetas()
        {
            InitializeComponent();
            this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1;

            string select = "SELECT * FROM NTVC.TARJETASINACTIVAS()";

            FuncionesUtiles.llenarDataGridView(select, dataGridView1);
        }
예제 #19
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            FuncionesUtiles.form1.Visible   = false;
            FuncionesUtiles.siguienteActiva = true;

            FuncionesUtiles.desactivarMenu();

            FuncionesUtiles.abrirVentanas(new CPU());
        }
예제 #20
0
        private void btnDetalleMouse_Click(object sender, EventArgs e)
        {
            if (!FuncionesUtiles.masdetallesActiva)
            {
                FuncionesUtiles.masdetallesActiva = true;
            }

            FuncionesUtiles.abrirVentanas(new Vistas.Mouse());
        }
예제 #21
0
        private void btnDetallePproyeccion_Click(object sender, EventArgs e)
        {
            if (!FuncionesUtiles.masdetallesActiva)
            {
                FuncionesUtiles.masdetallesActiva = true;
            }

            FuncionesUtiles.abrirVentanas(new PProyeccion());
        }
예제 #22
0
        private void botBuscar_Click(object sender, EventArgs e)
        {
            string busqueda = "select username as Username from NTVC.usuario";

            if (!FuncionesUtiles.estaVacio(textUsername))
            {
                busqueda += " where username like '" + textUsername.Text + "'";
            }
            FuncionesUtiles.llenarDataGridView(busqueda, dataGridView1);
        }
예제 #23
0
        public ModificacionBeneficiario(string rs)
        {
            InitializeComponent();
            this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1;

            razon_social_vieja = rs;
            SqlConnection con = Conexion.conectar();

            con.Open();
            SqlCommand    com    = new SqlCommand("select * from ntvc.rubro order by descripcion", con);
            SqlDataReader reader = com.ExecuteReader();

            while (reader.Read())
            {
                comboBoxRubro.Items.Add(reader["descripcion"]);
            }
            reader.Close();
            com = new SqlCommand("select b.cod_beneficiario, b.razon_social, b.dir_calle , b.dir_nro , b.dir_piso , b.dir_dpto , r.descripcion from ntvc.beneficiario b, ntvc.rubro r where b.cod_rubro = r.cod_rubro and razon_social = @rs", con);
            com.Parameters.AddWithValue("@rs", razon_social_vieja);
            reader            = com.ExecuteReader();
            cod_beneficiario_ = "";
            if (reader.Read())
            {
                cod_beneficiario_           = reader["cod_beneficiario"].ToString().Trim();
                textCalle.Text              = reader["dir_calle"].ToString().Trim();
                textDepto.Text              = reader["dir_dpto"].ToString().Trim();
                textNumero.Text             = reader["dir_nro"].ToString().Trim();
                textPiso.Text               = reader["dir_piso"].ToString().Trim();
                textRazonSocial.Text        = reader["razon_social"].ToString().Trim();
                comboBoxRubro.SelectedIndex = comboBoxRubro.Items.IndexOf(reader["descripcion"]);
            }
            reader.Close();
            com = new SqlCommand("select p.nro_serie from ntvc.postnet p, ntvc.beneficiario_postnet bp where bp.cod_beneficiario = @cb and bp.cod_postnet = p.cod_postnet", con);
            com.Parameters.AddWithValue("@cb", cod_beneficiario_);
            reader = com.ExecuteReader();
            while (reader.Read())
            {
                serials.Add(reader["nro_serie"].ToString().Trim());
            }
            reader.Close();
            foreach (string serial in serials)
            {
                if (FuncionesUtiles.estaVacio(textPostNets))
                {
                    textPostNets.Text = serial;
                }
                else
                {
                    textPostNets.Text += ", " + serial;
                }
            }
            con.Close();
        }
예제 #24
0
 private void botLimpiar_Click(object sender, EventArgs e)
 {
     textApellido.Text = "";
     textCalle.Text    = "";
     textDepto.Text    = "";
     textDNI.Text      = "";
     textMail.Text     = "";
     textNombre.Text   = "";
     textNumero.Text   = "";
     textPiso.Text     = "";
     textTelefono.Text = "";
     FuncionesUtiles.llenarDataGridView("select * from ntvc.cliente where cod_cliente = 0", dataGridView1);
 }
예제 #25
0
        public QuitarPostNets(List <string> serials)
        {
            InitializeComponent();
            this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1;
            string select = "select nro_serie as Serial, marca as Marca, modelo as Modelo from ntvc.postnet where ";

            foreach (string serial in serials)
            {
                select += "nro_serie = " + serial + " or ";
            }
            select += "1=2";
            FuncionesUtiles.llenarDataGridView(select, dataGridView1);
        }
예제 #26
0
        public SeleccionCliente()
        {
            InitializeComponent();
            this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1;
            FuncionesUtiles.llenarDataGridView("select c.nombre as Nombre, c.apellido as Apellido, c.tipo_doc as Tipo, c.doc as Documento, p.nombre as Provincia, c.mail as Mail, c.telefono as Teléfono, c.dir_calle as Calle, c.dir_nro as Número, c.dir_piso as Piso, c.dir_dpto as Depto from NTVC.Cliente c, NTVC.provincia p where cod_cliente = 0 and p.cod_provincia = 0", dataGridView1);
            SqlConnection con = Conexion.conectar();

            con.Open();
            SqlCommand    com    = new SqlCommand("select * from ntvc.provincia order by nombre", con);
            SqlDataReader reader = com.ExecuteReader();

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["nombre"]);
            }
            reader.Close();
            con.Close();
        }
예제 #27
0
        public AltaClientes()
        {
            InitializeComponent();
            this.Icon = BoletoElectronicoDesktop.Properties.Resources.NTVCSUBE1;

            FuncionesUtiles.llenarTipoDoc(comboBoxTD);
            SqlConnection con = Conexion.conectar();

            con.Open();
            SqlCommand    com    = new SqlCommand("select * from ntvc.provincia where cod_provincia != 26 order by nombre", con);
            SqlDataReader reader = com.ExecuteReader();

            while (reader.Read())
            {
                comboBox1.Items.Add(reader["nombre"]);
            }
            reader.Close();
            con.Close();
        }
예제 #28
0
        private void botRegistrarPago_Click(object sender, EventArgs e)
        {
            if ((!FuncionesUtiles.estaVacio(textFechaFin)) && (!FuncionesUtiles.estaVacio(textFechaInicio)) && (!FuncionesUtiles.estaVacio(textBeneficiario)))
            {
                string        consulta;
                SqlConnection con = Conexion.conectar();
                con.Open();
                consulta = "insert into ntvc.pago (monto, cod_beneficiario, cod_compra)" +
                           " select compra.monto, compra.cod_beneficiario, compra.cod_compra" +
                           " from ntvc.compra compra, ntvc.beneficiario beneficiario" +
                           " where beneficiario.razon_social = @razon_social and" +
                           " compra.fecha between @fechaInicio and @fechaFin and" +
                           " compra.cod_beneficiario = beneficiario.cod_beneficiario and" +
                           " compra.pagado = 0";
                SqlCommand com = new SqlCommand(consulta, con);
                com.Parameters.AddWithValue("@razon_social", this.textBeneficiario.Text);
                com.Parameters.AddWithValue("@fechaInicio", this.textFechaInicio.Text);
                com.Parameters.AddWithValue("@fechaFin", this.textFechaFin.Text);
                com.ExecuteNonQuery();
                consulta = "update ntvc.compra set pagado = 1" +
                           " from (select compra.monto, compra.cod_beneficiario, compra.cod_compra" +
                           " from ntvc.compra compra, ntvc.beneficiario beneficiario" +
                           " where beneficiario.razon_social = @razon_social and" +
                           " compra.fecha between @fechaInicio and @fechaFin and" +
                           " compra.cod_beneficiario = beneficiario.cod_beneficiario and" +
                           " compra.pagado = 0) as aux" +
                           " where compra.cod_compra = aux.cod_compra";
                com = new SqlCommand(consulta, con);
                com.Parameters.AddWithValue("@razon_social", this.textBeneficiario.Text);
                com.Parameters.AddWithValue("@fechaInicio", this.textFechaInicio.Text);
                com.Parameters.AddWithValue("@fechaFin", this.textFechaFin.Text);

                com.ExecuteNonQuery();
                this.Close();
                MessageBox.Show("Los pagos se han registrado.", "Registro exitoso", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.None);
                con.Close();
            }
            else
            {
                MessageBox.Show("Debe llenar todos los campos", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
            }
        }
예제 #29
0
        private void equipoBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            switch (FuncionesUtiles.ventanaDialogo())
            {
            case "Yes":
                if (GuardadoValido())
                {
                    guardado();
                }
                return;

            case "No":
                ApagarBotones();
                this.equipoTableAdapter.Fill(this.sistemasFCNMDataSet.Equipo);
                return;

            case "Cancel":
                return;

            default:
                return;
            }
        }
예제 #30
0
        private void botGuardar_Click(object sender, EventArgs e)
        {
            if (FuncionesUtiles.estanVacios(new List <TextBox> {
                textPostNets, textCalle, textRazonSocial, textNumero
            }) || comboBoxRubro.SelectedIndex == -1)
            {
                string mensaje = "Debe completar los siguientes campos:";
                if (textRazonSocial.Text == "")
                {
                    mensaje += "\n-Razón social";
                }
                if (comboBoxRubro.SelectedIndex == -1)
                {
                    mensaje += "\n-Rubro";
                }
                if (textPostNets.Text == "")
                {
                    mensaje += "\n-Post-nets";
                }
                if (textCalle.Text == "")
                {
                    mensaje += "\n-Calle";
                }
                if (textNumero.Text == "")
                {
                    mensaje += "\n-Número";
                }
                MessageBox.Show(mensaje, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
            }
            else
            {
                //campos completos, verificar los numericos
                if (!FuncionesUtiles.sonNumericos(new List <TextBox> {
                    textNumero
                }))
                {
                    //hay campos numericos con valores no numericos
                    string mensaje = "Los siguientes campos deben ser numéricos y positivos:";
                    if (!FuncionesUtiles.esNumerico(textNumero) && !FuncionesUtiles.estaVacio(textNumero))
                    {
                        mensaje += "\n-Número";
                    }
                    MessageBox.Show(mensaje, "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
                }
                else
                {
                    //campos correctos, verificar unicidad de la razon social
                    SqlConnection con = Conexion.conectar();
                    con.Open();
                    SqlCommand com = new SqlCommand("select * from ntvc.beneficiario where razon_social = @razon_social", con);
                    com.Parameters.AddWithValue("@razon_social", textRazonSocial.Text);
                    SqlDataReader reader = com.ExecuteReader();
                    if (reader.Read())
                    {
                        //razon social repetida
                        reader.Close();
                        MessageBox.Show("La razón social ya se encuentra en el sistema.", "Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Hand);
                    }
                    else
                    {
                        //hacer insert
                        reader.Close();
                        string cod_rubro = "";
                        com = new SqlCommand("select cod_rubro from ntvc.rubro where descripcion = @descripcion", con);
                        com.Parameters.AddWithValue("@descripcion", comboBoxRubro.Items[comboBoxRubro.SelectedIndex].ToString().Trim());
                        reader = com.ExecuteReader();
                        if (reader.Read())
                        {
                            cod_rubro = reader["cod_rubro"].ToString().Trim();
                        }
                        reader.Close();
                        string insert = "Insert into NTVC.beneficiario (razon_social, dir_calle, dir_nro, dir_piso, dir_dpto, habilitado, cod_rubro)";
                        insert += " values(@razon_social, @dir_calle, @dir_numero, @dir_piso, @dir_depto, @habilitado, @cod_rubro)";
                        com     = new SqlCommand(insert, con);
                        com.Parameters.AddWithValue("@razon_social", textRazonSocial.Text);
                        com.Parameters.AddWithValue("@dir_calle", textCalle.Text);
                        com.Parameters.AddWithValue("@dir_numero", textNumero.Text);
                        com.Parameters.AddWithValue("@dir_piso", textPiso.Text);
                        com.Parameters.AddWithValue("@dir_depto", textDepto.Text);
                        com.Parameters.AddWithValue("@habilitado", 1);
                        com.Parameters.AddWithValue("@cod_rubro", cod_rubro);
                        com.ExecuteNonQuery();

                        //insert de postnets
                        string cod_beneficiario = "";
                        com = new SqlCommand("select cod_beneficiario from ntvc.beneficiario where razon_social = @razon_social", con);
                        com.Parameters.AddWithValue("@razon_social", textRazonSocial.Text);
                        reader = com.ExecuteReader();
                        if (reader.Read())
                        {
                            cod_beneficiario = reader["cod_beneficiario"].ToString().Trim();
                        }
                        reader.Close();
                        foreach (string serial in serials)
                        {
                            string cod_postnet = "";
                            com = new SqlCommand("select cod_postnet from ntvc.postnet where nro_serie = @serial", con);
                            com.Parameters.AddWithValue("@serial", serial);
                            reader = com.ExecuteReader();
                            if (reader.Read())
                            {
                                cod_postnet = reader["cod_postnet"].ToString().Trim();
                            }
                            reader.Close();
                            com = new SqlCommand("insert into ntvc.beneficiario_postnet (cod_beneficiario, cod_postnet) values (@cod_beneficiario, @cod_postnet)", con);
                            com.Parameters.AddWithValue("@cod_beneficiario", cod_beneficiario);
                            com.Parameters.AddWithValue("@cod_postnet", cod_postnet);
                            com.ExecuteNonQuery();
                        }
                        MessageBox.Show("El beneficiario ha sido agregado.", "Alta exitosa", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.None);
                        this.Close();
                    }
                    con.Close();
                }
            }
        }