Пример #1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (TstCmdAgrefarUsr.Text.Equals("Crear socio"))
            {
                TstCmdAgrefarUsr.Text = "Guardar nuevo socio";
                LimpiaFormulario();
                gbxMembresia.Enabled = false;
                validarControles(true);
            }

            else if (TstCmdAgrefarUsr.Text.Equals("Guardar nuevo socio"))
            {
                if (ChkForm_InsOGuardar())
                {
                    ClsSocios Socio = new ClsSocios();
                    string    mens  = "";
                    TstCmdAgrefarUsr.Text = "Crear socio";

                    // pasamos todos los datos a los parametros de la esctructura para ejecutar el SP AltaSocio
                    Socio.m_Nombre = TxtNombreSocio.Text;
                    //Socio.m_IdSocio =
                    Socio.m_FotoId     = "fff";
                    Socio.m_Direccion1 = TxtDireccion1.Text;
                    Socio.m_Direccion2 = TxtDireccion2.Text;
                    Socio.m_Email      = TxtEmail.Text;
                    Socio.m_Edad       = "0";
                    Socio.m_Telefono   = mktCelular.Text;
                    Socio.m_Sexo       = RDsexoFem.Checked ? "F" : "M";
                    Socio.m_TipoSocio  = txtDiasViajero.Text;

                    Socio.m_Fingerprint = "vacio";
                    //Socio.m_FechaIngreso = DtpFechaIngreso.Value;
                    //Socio.m_Vencimiento = DTPFechaVencHasta.Value;
                    Socio.m_Observacion     = "Observaciones";
                    Socio.m_Indicaciones    = "Indicaciones";
                    Socio.m_User_modif      = "Admin";
                    Socio.m_FechaNacimiento = Convert.ToDateTime(mktFechaNacimiento.Text);
                    // Asignando el valor de la imagen
                    // Stream usado como buffer
                    System.IO.MemoryStream ms = new System.IO.MemoryStream();
                    // Se guarda la imagen en el buffer
                    pbFotoUser.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                    // Se extraen los bytes del buffer para asignarlos como valor para el parámetro.
                    //ImgFoto =  ms.GetBuffer();
                    //imagen = Convert.ToByte( ms.GetBuffer());
                    Socio.m_Foto = ms.GetBuffer();

                    //Parametros de salida
                    TxtIdSocio.Text = Socio.InsSocio();
                    idSocio         = Convert.ToInt32(TxtIdSocio.Text);
                    // mens = TxtIdSocio.Text;
                    MessageBox.Show("Socio agregado de forma correcta");
                    validarGBX();
                }
            }
        }
Пример #2
0
        private void buscarSocio()
        {
            ClsSocios Socio = new ClsSocios();

            dt = new DataTable();
            long NoSocio;

            NoSocio         = Int64.Parse(TSTxtBuscaSocio.Text);
            Socio.m_IdSocio = NoSocio;
            dt = Socio.RegresaSocio();
            if (dt.Rows.Count != 0)
            {
                foreach (DataRow filas in dt.Rows)
                {
                    // indice de columnas
                    //IdSocio 0
                    TxtIdSocio.Text = filas["IdSocio"].ToString();
                    //[FotoId] 1
                    //[Fingerprint] 2
                    //[Nombre] 3
                    TxtNombreSocio.Text = filas["Nombre"].ToString();
                    //[Direccion1] 4
                    TxtDireccion1.Text = filas["Direccion1"].ToString();
                    //[Direccion2] 5
                    TxtDireccion2.Text = filas["Direccion2"].ToString();
                    //[Email] 6
                    TxtEmail.Text = filas["Email"].ToString();
                    //[Edad] 7
                    //[Telefono] 8
                    mktCelular.Text = filas["Telefono"].ToString();
                    //,[Sexo] 9
                    string Sexo;
                    Sexo = filas["Sexo"].ToString();
                    if (Sexo == "F")
                    {
                        RDsexoFem.Checked   = true;
                        RDmasculino.Checked = false;
                    }
                    else
                    {
                        RDsexoFem.Checked   = false;
                        RDmasculino.Checked = true;
                    }

                    //[TipoSocio] 10
                    //[FechaIngreso] 11
                    //DtpFechaIngreso.Text= filas["FechaIngreso"].ToString();
                    //[Indicaciones] 12
                    //[DiasViajero] 13
                    //[Vencimiento_prev] 14
                    //[Vencimiento] 15

                    //[Observacion] 16
                    //[Fecha_modif] 17
                    //[User_modif] 18
                    //[Foto] 19
                    byte[] imageBuffer = (byte[])filas["Foto"];
                    // Se crea un MemoryStream a partir de ese buffer
                    MemoryStream ms = new MemoryStream(imageBuffer);
                    // Se utiliza el MemoryStream para extraer la imagen
                    //PbFotoSocio.Image = Image.FromStream(ms);
                    pbFotoUser.Image = Image.FromStream(ms);

                    //[fechaNacimiento] 20
                    //DTPFechaNac.Text = filas["fechaNacimiento"].ToString();
                    mktFechaNacimiento.Text = filas["fechaNacimiento"].ToString();
                }
                cls_socios.m_IdSocio = Convert.ToInt32(TxtIdSocio.Text);
                dt = cls_socios.movimientosSocios();
                dataGridView1.DataSource = dt;
                cls_lockers.m_idSocio    = Convert.ToInt32(TSTxtBuscaSocio.Text);
                // MessageBox.Show(cls_lockers.m_idSocio.ToString());
                DataTable dtLocker = cls_lockers.buscarLockerSocio();
                foreach (DataRow filas in dtLocker.Rows)
                {
                    DTPLockerVence.Value = Convert.ToDateTime(filas["fechaVencimiento"].ToString());
                }

                dt = cls_socios.buscarSocioDiasViajero();

                if (dt.Rows.Count > 0)
                {
                    txtDiasViajero.Text         = dt.Rows[0]["numDiasViajero"].ToString();
                    dtpVencimientoViajero.Value = Convert.ToDateTime(dt.Rows[0]["fechaVencimiento"].ToString());
                }
            }
            else
            {
                MessageBox.Show("  Socio no encontrado ");
            }
        }
Пример #3
0
        private void TSTxtBuscaSocio_KeyDown(object sender, KeyEventArgs e)
        {
            ClsSocios Socio = new ClsSocios();
            DataTable dt = new DataTable();

            if ((int)e.KeyCode  == (int)Keys.Enter)
            {

                long NoSocio;
                NoSocio = Int64.Parse ( TSTxtBuscaSocio.Text);
                Socio.m_IdSocio = NoSocio;
                dt = Socio.RegresaSocio();
                if (dt.Rows.Count!=0)
                {

                    foreach (DataRow filas in dt.Rows)
                    {

                        // indice de columnas 
                        //IdSocio 0
                         TxtIdSocio.Text = filas["IdSocio"].ToString();
                        //[FotoId] 1
                        //[Fingerprint] 2
                        //[Nombre] 3
                        TxtSocio.Text= filas["Nombre"].ToString();
                        //[Direccion1] 4
                        TxtDireccion1.Text= filas["Direccion1"].ToString();
                        //[Direccion2] 5
                        TxtDireccion2.Text = filas["Direccion2"].ToString();
                        //[Email] 6
                        TxtEmail.Text= filas["Email"].ToString();
                        //[Edad] 7 
                        //[Telefono] 8 
                        mktCelular.Text= filas["Telefono"].ToString();
                        //,[Sexo] 9
                        string Sexo;
                        Sexo = filas["Sexo"].ToString();
                        if (Sexo == "F")
                        {
                            RDsexoFem.Checked = true;
                            RDmasculino.Checked = false;
                        }
                        else
                        {
                            RDsexoFem.Checked = false;
                            RDmasculino.Checked = true;
                        }

                        //[TipoSocio] 10
                        //[FechaIngreso] 11
                        //DtpFechaIngreso.Text= filas["FechaIngreso"].ToString();
                        //[Indicaciones] 12
                        //[DiasViajero] 13
                        //[Vencimiento_prev] 14
                        //[Vencimiento] 15

                        //[Observacion] 16
                        //[Fecha_modif] 17
                        //[User_modif] 18
                        //[Foto] 19
                        byte[] imageBuffer = (byte[])filas["Foto"];
                        // Se crea un MemoryStream a partir de ese buffer
                        MemoryStream ms = new MemoryStream(imageBuffer);
                        // Se utiliza el MemoryStream para extraer la imagen
                        //PbFotoSocio.Image = Image.FromStream(ms);
                        pbFotoUser.Image = Image.FromStream(ms);

                        //[fechaNacimiento] 20
                        //DTPFechaNac.Text = filas["fechaNacimiento"].ToString();
                        mktFechaNacimiento.Text = filas["fechaNacimiento"].ToString();
                    }
                }
                else MessageBox.Show("  Socio no encontrado ");
            }
        }