Example #1
0
        private void dgv_titu_benef_SelectionChanged(object sender, EventArgs e)
        {
            socios           soc = new socios();
            convertir_imagen img = new convertir_imagen();

            double Codigo_Fliar;

            //dgv_jugadores_inscriptos.CurrentRow.Cells["jugcuil"].Value
            Codigo_Fliar = Convert.ToDouble(dgv_titu_benef.CurrentRow.Cells["CodigoFliar"].Value);

            if (Codigo_Fliar > 0)
            {
                picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_benef_binary(Codigo_Fliar).ToArray());
            }
            else
            {
                if ((Codigo_Fliar == 0) && (Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Exepcion"].Value) == 0)) // es por que es titular
                {
                    picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_titular_binary(_cuil).ToArray());
                }
                else // Es por que es Exepcion
                {
                    picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_benef_binary(1).ToArray());
                }
            }
        }
        private void MostrarFotoBeneficiario(double CodigoDeFamiliar)
        {
            using (var context = new lts_sindicatoDataContext())
            {
                convertir_imagen cnvimg = new convertir_imagen();
                socios           soc    = new socios();

                var foto = soc.get_foto_benef_binary(CodigoDeFamiliar);
                picbox_beneficiario.Image = cnvimg.ByteArrayToImage(foto.ToArray());
                lbl_Parentesco.Text       = dgv_MostrarBeneficiario.CurrentRow.Cells["parentesco"].Value.ToString();
            }
        }
Example #3
0
        private void dgv_titu_benef_SelectionChanged_1(object sender, EventArgs e)
        {
            int cantfilas = dgv_titu_benef.Rows.Count;

            if (cantfilas > 0) // este if lo hago por que me da error cuando limpio el grid y llamo a mostrar los beneficiarios de las mochilas
            {
                socios           soc = new socios();
                convertir_imagen img = new convertir_imagen();
                int    edad          = Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Edad"].Value);
                double Codigo_Fliar;

                Codigo_Fliar = Convert.ToDouble(dgv_titu_benef.CurrentRow.Cells["CodigoFliar"].Value);

                if (Codigo_Fliar > 0)
                {
                    picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_benef_binary(Codigo_Fliar).ToArray());
                }
                else
                {
                    if ((Codigo_Fliar == 0) && (Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Exepcion"].Value) == 0)) // es por que es titular
                    {
                        picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_titular_binary(_cuil).ToArray());
                    }
                    else // Es por que es Exepcion
                    {
                        picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_benef_binary(1).ToArray());
                    }
                }

                HabilitarBotonEmitirCupon(Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Exepcion"].Value),
                                          Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["ExepcionId"].Value),
                                          Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["CodigoFliar"].Value),
                                          edad,
                                          Convert.ToInt32(cbx_eventos.SelectedValue),
                                          (Codigo_Fliar == 0 ? true : false)
                                          );
            }
        }
Example #4
0
        private void RecorrerDgvTituBenef()
        {
            EventosCupones EvntCpn = new EventosCupones();
            DS_cupones     ds      = new DS_cupones();
            DataTable      dt      = ds.cupon_dia_niño;

            dt.Clear();
            socios soc = new socios();

            foreach (DataGridViewRow fila in dgv_titu_benef.Rows)
            {
                if (Convert.ToBoolean(fila.Cells["EmitirCupon"].Value))
                {
                    DataRow dr    = dt.NewRow();
                    var     datos = soc.get_datos_socio(_cuil, 0);
                    if (Convert.ToInt32(fila.Cells["Exepcion"].Value) == 1)                          // si es Exepcion
                    {
                        if (EvntCpn.ExisteExepcion(Convert.ToInt32(fila.Cells["ExepcionID"].Value))) // si Exepcion ya emitio cupon
                        {
                            MessageBox.Show("Ya se emitio cupon para Exepcion.");
                        }
                        else
                        {
                            EventosCupones evntcpn  = new EventosCupones();
                            int            nrocupon = evntcpn.EventosCuponesInsertar(
                                Convert.ToInt32(cbx_eventos.SelectedValue),
                                Convert.ToDouble(fila.Cells["dni"].Value),
                                Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                                Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                                0,
                                UsuarioID,
                                string.Empty,
                                0,
                                datos.CuilStr,
                                0
                                );


                            dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                            dr["titu_dni"]           = datos.dni;
                            dr["titu_empresa"]       = datos.empresa;
                            dr["titu_nrosocio"]      = datos.nrosocio;
                            dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                            dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                            dr["benef_dni"]          = fila.Cells["Dni"].Value;
                            dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                            dr["benef_edad"]         = fila.Cells["Edad"].Value;
                            dr["benef_foto"]         = soc.get_foto_benef_binary(1).ToArray();
                            dr["event_nrocupon"]     = nrocupon;
                            dr["event_fechaentrega"] = DateTime.Now;
                            dt.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        if (EvntCpn.ExisteFamiliar(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)))
                        {
                            MessageBox.Show("Ya se emitio cupon para Beneficiario.");
                        }
                        else
                        {
                            EventosCupones evntcpn = new EventosCupones();

                            int nrocupon = evntcpn.EventosCuponesInsertar(
                                Convert.ToInt32(cbx_eventos.SelectedValue),
                                Convert.ToDouble(fila.Cells["dni"].Value),
                                Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                                Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                                0,
                                UsuarioID,
                                string.Empty,
                                0,
                                datos.CuilStr,
                                0
                                );

                            dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                            dr["titu_dni"]           = datos.dni;
                            dr["titu_empresa"]       = datos.empresa;
                            dr["titu_nrosocio"]      = datos.nrosocio;
                            dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                            dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                            dr["benef_dni"]          = fila.Cells["Dni"].Value;
                            dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                            dr["benef_edad"]         = fila.Cells["Edad"].Value;
                            dr["benef_foto"]         = soc.get_foto_benef_binary(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)).ToArray();
                            dr["event_nrocupon"]     = nrocupon;
                            dr["event_fechaentrega"] = DateTime.Now;
                            dt.Rows.Add(dr);
                        }
                    }
                }
            }
            if (dt.Rows.Count > 0)
            {
                ImprimirCupones(dt);
            }
        }
Example #5
0
        private void EmitirCupon_()
        {
            EventosCupones EvntCpn = new EventosCupones();
            DS_cupones     ds      = new DS_cupones();
            DataTable      dt      = ds.cupon_dia_niño;

            dt.Clear();
            socios          soc        = new socios();
            DataGridViewRow fila       = dgv_titu_benef.CurrentRow;
            DataRow         dr         = dt.NewRow();
            var             datos      = soc.get_datos_socio(_cuil, 0);
            int             edad       = Convert.ToInt32(fila.Cells["Edad"].Value);
            int             nroDeCupon = 0;
            int             Termas     = chk_Termas.Checked ? 1 : 0;

            if (edad > 1 || edad < 22)
            {
                if (Convert.ToInt32(fila.Cells["Exepcion"].Value) == 1)                          // si es Exepcion
                {
                    if (EvntCpn.ExisteExepcion(Convert.ToInt32(fila.Cells["ExepcionID"].Value))) // si Exepcion ya emitio cupon
                    {
                        MessageBox.Show("Ya se emitio cupon para Exepcion.");
                    }
                    else
                    {
                        EventosCupones evntcpn  = new EventosCupones();
                        int            nrocupon = evntcpn.EventosCuponesInsertar(
                            Convert.ToInt32(cbx_eventos.SelectedValue),
                            Convert.ToDouble(fila.Cells["dni"].Value),
                            Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                            Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                            Convert.ToInt32(cbx_Mochilas.SelectedValue),
                            UsuarioID,
                            txt_QuienRetira.Text,
                            chk_FondoDeDesempleo.Checked == true ? 1 : 0,
                            datos.CuilStr,
                            chk_Termas.Checked ? 1 : 0
                            );
                        nroDeCupon = nrocupon;

                        dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                        dr["titu_dni"]           = datos.dni;
                        dr["titu_empresa"]       = datos.empresa;
                        dr["titu_nrosocio"]      = datos.nrosocio;
                        dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                        dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                        dr["benef_dni"]          = fila.Cells["Dni"].Value;
                        dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                        dr["benef_edad"]         = fila.Cells["Edad"].Value;
                        dr["benef_foto"]         = soc.get_foto_benef_binary(1).ToArray();
                        dr["event_nrocupon"]     = nrocupon;
                        dr["event_fechaentrega"] = DateTime.Now;
                        dr["event_cupon_ID"]     = EvntCpn.GetCuponID();
                        dr["reimpresion"]        = "0";
                        dt.Rows.Add(dr);
                    }
                }
                else // no es exepcion y pregunto si es entrega de Mochilas y pregunto se existe el familiar par enviar mensaje de que ya se emitio el cupon y si no existe Asigno el Cupon
                {
                    if (Convert.ToInt32(cbx_eventos.SelectedValue) == 4 ?
                        EvntCpn.ExisteFamiliar(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)) :
                        EvntCpn.ExisteTitular(Convert.ToInt32(fila.Cells["Dni"].Value), Convert.ToInt32(cbx_eventos.SelectedValue)))
                    {
                        MessageBox.Show("Ya se emitio cupon para Beneficiario.");
                    }
                    else
                    {
                        EventosCupones evntcpn = new EventosCupones();

                        //Inserto el cupon y devuelvo el nro de Cupon

                        int nrocupon = evntcpn.EventosCuponesInsertar(
                            Convert.ToInt32(cbx_eventos.SelectedValue),
                            Convert.ToDouble(fila.Cells["dni"].Value),
                            Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                            Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                            Convert.ToInt32(cbx_Mochilas.SelectedValue),
                            UsuarioID,
                            txt_QuienRetira.Text,
                            chk_FondoDeDesempleo.Checked == true ? 1 : 0,
                            datos.CuilStr,
                            chk_Termas.Checked ? 1 : 0
                            );
                        nroDeCupon = nrocupon;

                        dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                        dr["titu_dni"]           = datos.dni;
                        dr["titu_empresa"]       = datos.empresa;
                        dr["titu_nrosocio"]      = datos.nrosocio;
                        dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                        dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                        dr["benef_dni"]          = fila.Cells["Dni"].Value;
                        dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                        dr["benef_edad"]         = fila.Cells["Edad"].Value;
                        dr["benef_foto"]         = soc.get_foto_benef_binary(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)).ToArray();
                        dr["event_nrocupon"]     = nrocupon;
                        dr["event_fechaentrega"] = DateTime.Now;
                        dr["event_cupon_ID"]     = EvntCpn.GetCuponID();
                        dr["reimpresion"]        = "0";
                        dr["Turno"] = EvntCpn.GetDiaHoraDelTurno(EvntCpn.GetTurno(Convert.ToString(_cuil), Termas));
                        dr["Logo"]  = mtdConvertirImagen.ImageToByteArray(Image.FromFile("C:\\SEC_Gestion\\Imagen\\Logo_reporte.png"));
                        dt.Rows.Add(dr);
                    }
                }
                if (dt.Rows.Count > 0)
                {
                    ImprimirCupones(dt, nroDeCupon, datos.nrosocio, fila.Cells["Edad"].Value.ToString(), datos.dni, dt.Rows[0]["titu_apenom"].ToString(), datos.empresa, fila.Cells["Dni"].Value.ToString(), fila.Cells["nombre"].Value.ToString());

                    fila.Cells["Estado"].Value = "Emitido [Nº: " + EvntCpn.GetNumeroCuponPorCuil(Convert.ToDouble(fila.Cells["dni"].Value), Convert.ToInt32(cbx_eventos.SelectedValue)).ToString() + "]";
                    btn_emitir_cupon.Enabled   = false;

                    //Muestro el Turno. En el Label del Formulario
                    MostrarTurno();
                }
            }
        }