~!!~

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();
}

}
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s