Пример #1
0
        /*private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
         * {
         *  if
         *
         * }
         */
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(desdeFecha.Text) && !string.IsNullOrEmpty(hastaFecha.Text))
            {
                dataGridViewReservas.Rows.Clear();

                string  dni   = Ag.recuperoDni(Global.GlobalSessionNombre, Global.GlobalSessionPass);
                DataSet Lista = Ag.buscarReservas(dni, desdeFecha.Text, hastaFecha.Text);

                int index = 0;
                if (Lista.Tables[0] != null && Lista.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in Lista.Tables[0].Rows)
                    {
                        dataGridViewReservas.Rows.Add();

                        dataGridViewReservas.Rows[index].Cells[1].Value = dr["fhasta"].ToString();
                        dataGridViewReservas.Rows[index].Cells[2].Value = dr["fdesde"].ToString();
                        dataGridViewReservas.Rows[index].Cells[3].Value = dr["ciudad"].ToString();
                        dataGridViewReservas.Rows[index].Cells[4].Value = dr["precio"].ToString();
                        dataGridViewReservas.Rows[index].Cells[5].Value = dr["alojamiento"].ToString();
                        dataGridViewReservas.Rows[index].Cells[6].Value = dr["id_reserva"].ToString();
                        index++;
                    }
                }
            }
            else
            {
                MessageBox.Show("el campo tipo es requerido");
            }
        }