[go: up one dir, main page]

0% found this document useful (0 votes)
105 views9 pages

Uml Diagrams: Use Case Diagram

The document describes various UML diagrams including use case diagram, class diagram, activity diagram, state chart diagram, sequence diagram, collaboration diagram, and component diagram. It then provides code examples for an ATM application that utilizes these diagrams. The code implements forms for login, admin home, and withdrawal that allow adding, updating, deleting user accounts and processing transactions through a SQL database.

Uploaded by

CHINNAA R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
105 views9 pages

Uml Diagrams: Use Case Diagram

The document describes various UML diagrams including use case diagram, class diagram, activity diagram, state chart diagram, sequence diagram, collaboration diagram, and component diagram. It then provides code examples for an ATM application that utilizes these diagrams. The code implements forms for login, admin home, and withdrawal that allow adding, updating, deleting user accounts and processing transactions through a SQL database.

Uploaded by

CHINNAA R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

UML DIAGRAMS:

Use case Diagram

Class Diagram:
Activity diagram

State chart
Sequence Diagram

Collaboration diagram:
Component Diagram

Deployment Diagram
OUTPUT:

HOME:

Coding :

Home.cs:

using System.Windows.Forms;
using System.Data.SqlClient;

namespace ATM
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
if(textBox1.Text=="admin"&&textBox2.Text=="admin")
{
Form2 frm2 = new Form2();
frm2.Show();
}
else
{
MessageBox.Show("invalid login");
}

private void button2_Click(object sender, EventArgs e)


{
Form3 frm3 = new Form3();
frm3.Show();
} } }

ADMINHOME:

Coding :-

Adminhome.cs:-

using System.Windows.Forms;
using System.Data.SqlClient;

namespace ATM
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=sow;Integrated
Security=True");
SqlCommand cmd;
private void button1_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insert into Account_details values('" + textBox1.Text + "','" +
textBox2.Text+ "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("added");
}

private void button2_Click(object sender, EventArgs e)


{
comboBox1.Items.Clear();
cmd = new SqlCommand("select accno from Account_details", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
comboBox1.Items.Add(dr[0].ToString());
}
con.Close();
}

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)


{
cmd= new SqlCommand("select pinno,name from Account_details where
accno='"+comboBox1.SelectedItem.ToString()+"'",con);
con.Open();
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
textBox6.Text=dr[0].ToString();
textBox7.Text=dr[1].ToString();
}
con.Close();
}

private void button3_Click(object sender, EventArgs e)


{
cmd=new SqlCommand("update Account_details set
pinno='"+textBox6.Text+"',name='"+textBox1.Text+"' where
accno='"+comboBox1.SelectedItem.ToString()+"'",con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("updated");
}

private void button4_Click(object sender, EventArgs e)


{
cmd=new SqlCommand("delete from Account_details where
accno='"+comboBox1.SelectedItem.ToString()+"'",con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("deleted");
}

private void button5_Click(object sender, EventArgs e)


{
cmd=new SqlCommand("select * from All_transaction",con);
con.Open();
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds);
dataGridView1.DataSource=ds.Tables[0].DefaultView;
con.Close();
}
}
}
WITHDRAW:-

Coding:-

Withdraw.cs:-

using System.Windows.Forms;
using System.Data.SqlClient;

namespace ATM
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=sow;Integrated
Security=True");
SqlCommand cmd;

private void button1_Click(object sender, EventArgs e)


{
cmd = new SqlCommand("insert into All_transaction values('" + textBox1.Text + "','" +
textBox3.Text + "','" + DateTime.Now.ToString() + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
cmd = new SqlCommand("update Account_details set openbal=openbal-" + textBox3.Text +
"where accno='" + textBox1.Text + "'", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("transaction completed");

}
}
}
TABLES:-

Account_details:-

All_transaction:-

You might also like