double click the submit button to generate the event handler ..
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "")
{
MessageBox.Show("Please provide valid ID ");
return;
}
else
{
dataGridView1.DataSource = GetCreateCurrentAccountList(Convert.ToInt32(textBox1.Text));
}
}
public List<Cashir> GetCreateCurrentAccountList(int User_Id)
{
using (UserEntities ctx = new UserEntities())
{
var query = (from a in ctx.Cashirs
where a.User_Id == User_Id
select a).Distinct();
List<Cashir> userList = new List<Cashir>();
query.ToList().ForEach(rec =>
{
userList.Add(new Cashir
{
User_Id = rec.User_Id,
username = rec.username,
password = rec.password
});
});
return userList;
}
}
}
}
No comments:
Post a Comment