-
Notifications
You must be signed in to change notification settings - Fork 7
/
ViewCustomerProfile.cs
84 lines (74 loc) · 2.71 KB
/
ViewCustomerProfile.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ApteanEdgeBank
{
public partial class ViewCustomerProfile : Form
{
public ViewCustomerProfile()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int res;
if(textBox1.Text.Length==0)
MessageBox.Show("Please enter the Customer ID");
if(textBox1.Text.Length!=4)
MessageBox.Show("Invalid Customer ID");
if(!int.TryParse(textBox1.Text,out res))
{
MessageBox.Show("Only Digits are allowed");
}
if(!(int.Parse(textBox1.Text)>=1233))
{
MessageBox.Show("Invalid Customer ID");
}
UserDAO user = new UserDAO();
DataTable dataTable = new DataTable ();
dataTable = user.GetData("use ApteanEdgeBank select * from customer where CustomerID=" + textBox1.Text,UserDAO.connectionString);
dataGridView1.DataSource = bindingSource1;
bindingSource1.DataSource = dataTable;
if (dataTable.Rows.Count == 0)
{
MessageBox.Show("No records Found");
}
}
private void button2_Click(object sender, EventArgs e)
{
UserDAO user = new UserDAO();
DataTable dataTable = new DataTable();
dataTable = user.GetData("use ApteanEdgeBank select * from customer where FirstName=" + "'"+textBox2.Text+"'", UserDAO.connectionString);
dataGridView1.DataSource = bindingSource1;
bindingSource1.DataSource = dataTable;
if (dataTable.Rows.Count == 0)
{
MessageBox.Show("No records Found");
}
}
private void button3_Click(object sender, EventArgs e)
{
UserDAO user = new UserDAO();
DataTable dataTable = new DataTable();
dataTable = user.GetData("use ApteanEdgeBank select * from customer where LastName=" + "'" + textBox3.Text + "'", UserDAO.connectionString);
dataGridView1.DataSource = bindingSource1;
bindingSource1.DataSource = dataTable;
if (dataTable.Rows.Count == 0)
{
MessageBox.Show("No records Found");
}
}
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}