using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Configuration;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Data.SqlTypes;
namespace Banking_v._1._0
{
public partial class loginform : Form
{
SqlConnection connect;
int cnt = 0;
string uname;
public loginform()
{
InitializeComponent();
}
private void OpenConnection()
{
connect = new SqlConnection();
connect.ConnectionString = ConfigurationManager.AppSettings["ApplicationConnection"].ToString();
connect.Open();
}
private void loginform_Activated(object sender, System.EventArgs e)
{
}
private void btnExit_Click(object sender, EventArgs e)
{
DialogResult dlg;
dlg = MessageBox.Show(“Are you sure you want to exit?”, “Attention”, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
if (dlg == DialogResult.Yes)
{
Application.Exit();
}
}
private void btnLogin_Click(object sender, EventArgs e)
{
OpenConnection();
SqlCommand cmd = new SqlCommand();
cmd.Connection = connect;
cmd.CommandType = CommandType.Text;
cmd.CommandText = “SELECT * FROM TellerInfo”;
bool x = false;
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
if ((reader["EmployeeID"].ToString() == txtTellerID.Text) && (reader["Password"].ToString() == txtPassword.Text))
{
this.Close();
MessageBox.Show(“Login successful.”, “Banking version 1.0″, MessageBoxButtons.OK, MessageBoxIcon.Information);
Main_Form.tellername = support.GetData(“EmployeeLastName”, “TellerInfo”, “EmployeeID”, txtTellerID.Text);
x = true;
}
}
if (x == false)
{
txtPassword.Clear();
txtTellerID.Clear();
cnt = cnt + 1;
MessageBox.Show(“Invalid Teller ID or Password”, “Warning”, MessageBoxButtons.OK, MessageBoxIcon.Warning);
if (cnt == 3)
{
MessageBox.Show(“Invalid access to Application”, “Access denied”, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
Application.Exit();
}
}
reader.Close();
}
private void loginform_Load(object sender, EventArgs e)
{
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Password_Retrival frm = new Password_Retrival();
frm.ShowDialog();
}
}
}








![13112009085[1] 13112009085[1]](http://farm3.static.flickr.com/2788/4173608507_cd25904f4d_t.jpg)
