CSharpLibrary/stuff/Item/ConsultaLivro.cs

52 lines
1.6 KiB
C#
Raw Normal View History

2021-09-02 08:04:56 -03:00
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using CSharpLibrary;
using CSharpLibrary.SqlTypes;
namespace TelasProjeto
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void btnConsultar_Click(object sender, EventArgs e)
{
DataSet ds = ReturnTypes.DSReturnItemByName(txtLivro.Text);
dataGridView1.DataSource = ds;
dataGridView1.DataMember = ds.Tables[0].TableName;
}
private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if(e.RowIndex >= 0 && e.ColumnIndex >= 0)
{
int tmp = 0,i = e.RowIndex;
List<Tuple<int, string>> a = new List<Tuple<int, string>>();
foreach(DataGridViewRow datarow in dataGridView1.Rows)
{
foreach(DataGridViewCell c in datarow.Cells)
{
if (c.RowIndex == i)
{
if (c.ColumnIndex == 0)
tmp = (int)c.Value;
else
{
a.Add(
new Tuple<int,string>(tmp, c.Value.ToString()));
}
}
}
}
formAlterarLivro f = new formAlterarLivro(a);
f.Show();
}
}
}
}