Beispiel #1
0
        /// <summary>
        /// lee datos de la base de datos
        /// </summary>
        /// <param name="lv">listview de de entrada</param>
        public void ActualizarAgenda(ListView lv)
        {
            FormPago formPago = new FormPago();

            formPago.materialRaisedButton1.Visible = false;
            string item  = lv.SelectedItems[0].SubItems[8].Text;
            string item2 = lv.SelectedItems[0].SubItems[7].Text;

            MessageBox.Show(item2 + "" + item2);
            try
            {
                if (lv.SelectedIndices.Count <= -1)
                {
                    return;
                }
                else
                {
                    SqlCommand cmd = new SqlCommand("Select A.idCliente, A.idlugar, A.diagnostico, A.equipo, A.fecha, A.descripcion where P.idPago=" + Convert.ToInt32(item2) + "AND PS.idPago=" + Convert.ToInt32(item2) + "", cnn.conn);
                    cnn.Conectar();
                    cmd.CommandType = CommandType.Text;
                    SqlDataReader dr = cmd.ExecuteReader();
                    using (FormPago f*g = new FormPago())
                    {
                        f*g.btnActualizarpago.Visible = true;
                        if (dr.Read())
                        {
                            f*g.cmbCliente.Text   = dr[4].ToString();
                            f*g.txtArticulo.Text  = dr[1].ToString();
                            f*g.txtPrecio.Text    = dr[2].ToString();
                            f*g.dtpFechaPago.Text = dr[3].ToString();
                            f*g.lvtel.Text        = dr[6].ToString();
                            f*g.lvDireccion.Text  = dr[7].ToString();
                            f*g.lvcomment.Text    = dr[8].ToString();
                            f*g.txtcantidad.Text  = dr[9].ToString();
                            f*g.lbpago.Text       = dr[11].ToString();
                            dr.Close();
                        }
                        f*g.ShowDialog();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo salio mal ;_; " + ex.Message);
            }
            finally
            {
                cnn.Desconectar();
            }
        }
Beispiel #2
0
        /// <summary>
        /// muestra los pagos registrados de clientes en un listview
        /// </summary>
        /// <param name="lv">listview para mostrar datos</param>
        public void clickpagos(ListView lv)
        {
            string item  = lv.SelectedItems[0].SubItems[8].Text;
            string item2 = lv.SelectedItems[0].SubItems[7].Text;

            try
            {
                if (lv.SelectedIndices.Count <= -1)
                {
                    return;
                }
                else
                {
                    SqlCommand cmd = new SqlCommand("Select P.idPago, P.NombreArticulo, P.Precio, P.fechapago,C.NombreCompleto,C.telefono,C.direccion, C.Comentario,P.cantidad, P.Fk_pagoCliente, C.idCliente, PS.idPagos, PS.idPago from Cliente C inner join pago P on(C.idCliente= P.Fk_pagoCliente) INNER JOIN Pagos PS on(PS.idPago= P.idPago) where PS.idPago=" + Convert.ToInt32(item) + "AND P.idPago=" + Convert.ToInt32(item2) + "", cnn.conn);
                    cnn.Conectar();
                    cmd.CommandType = CommandType.Text;
                    SqlDataReader dr  = cmd.ExecuteReader();
                    FormPago      f*g = new FormPago();
                    f*g.materialRaisedButton1.Visible = false;
                    f*g.btnActualizarpago.Visible     = true;
                    if (dr.Read())
                    {
                        f*g.cmbCliente.Text        = dr[4].ToString();
                        f*g.cmbCliente.ValueMember = dr.GetInt32(10).ToString();
                        f*g.txtArticulo.Text       = dr[1].ToString();
                        f*g.txtPrecio.Text         = dr[2].ToString();
                        f*g.dtpFechaPago.Text      = dr[3].ToString();
                        f*g.lvtel.Text             = dr[5].ToString();
                        f*g.lvDireccion.Text       = dr[6].ToString();
                        f*g.lvcomment.Text         = dr[7].ToString();
                        f*g.txtcantidad.Text       = dr[8].ToString();
                        f*g.lbpago.Text            = dr[0].ToString();
                        dr.Close();
                    }
                    f*g.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo salio mal ;_; " + ex.Message);
            }
            finally
            {
                cnn.Desconectar();
            }
        }