UML DIAGRAMS:
Use case diagram:
Class Diagram:
Sequence diagram:
Collaboration diagram:
Activity diagram:
State chart diagram:
Component diagram:
OUTPUT:
HOME:
CODING:
Home.cs
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text == "STOCK" && textBox2.Text == "STOCK")
{
Form2 frm1 = new Form2();
frm1.Show();
}
else
{
MessageBox.Show("Password Incorrect!!\n Try again!");
}
}
}
}
ADMINHOME:
Coding:
Adminhome.cs
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form3 frmadd = new Form3();
frmadd.Show();
}
private void button2_Click(object sender, EventArgs e)
{
Form4 frmsal = new Form4();
frmsal.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Form5 frmsin = new Form5();
frmsin.Show();
}
private void button4_Click(object sender, EventArgs e)
{
Form6 frmsin = new Form6();
frmsin.Show();
}
}
}
ADDITEM:
Coding:
Adminhome.cs
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication3
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=user-pc;Initial
Catalog=stock;Integrated Security=True");
SqlCommand cmd;
private void button1_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insert into itemdetails1 values('" +textBox1.Text + "','" +
textBox2.Text + "','" +
textBox3.Text + "','" + textBox4.Text + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Product Added");
clearr();
}
public void clearr()
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
}
private void button2_Click(object sender, EventArgs e)
{
Form2 frmadmn = new Form2();
frmadmn.Show();
}
}}
SALE:
Coding:
Sale.cs
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication3
{
public partial class Form4 : Form
{
public Form4()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=user-pc;Initial
Catalog=stock;Integrated Security=True");
SqlCommand cmd;
private void button1_Click(object sender, EventArgs e)
{cmd = new SqlCommand("insert into saledetails values('" +
comboBox1.SelectedItem.ToString() + "','" +
textBox1.Text + "','" + textBox4.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" +
DateTime.Now.ToString() + "') ", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
cmd = new SqlCommand("update itemdetails1 set quantity =quantity-" + textBox2.Text +
"where itemid='"
+comboBox1.Text+ "'", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Product Sold");
}
private void button2_Click(object sender, EventArgs e)
{
Form2 frmadmn1 = new Form2();
frmadmn1.Show();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
cmd = new SqlCommand("select itemname,price from itemdetails1 where itemid='" +
comboBox1.SelectedItem.ToString() + "'", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr[0].ToString();
textBox4.Text = dr[1].ToString();
}
con.Close();
}
private void Form4_Load(object sender, EventArgs e)
{
cmd = new SqlCommand("select itemid from itemdetails1", con);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
comboBox1.Items.Add(dr[0]);
}
con.Close();
}
}}
STOCKINFO:
Coding:
Stockinfo.cs
using System.Data.SqlClient;
namespace WindowsFormsApplication3
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=user-pc;Initial
Catalog=stock;Integrated Security=True");
SqlCommand cmd1;
private void button1_Click(object sender, EventArgs e)
{Form2 salead = new Form2();
salead.Show();
}
{SqlCommand cmd1 = new SqlCommand("select * from saledetails", con);
con.Open();
SqlDataAdapter da1 = new SqlDataAdapter(cmd1);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
dataGridView1.DataSource = ds1.Tables[0].DefaultView;
con.Close();
}
}}
SALEINFO:
Coding:
Saleinfo.cs
using System.Windows.Forms;
using System.Data.SqlClient;
namespace WindowsFormsApplication3
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=user-pc;Initial
Catalog=stock;Integrated Security=True");
SqlCommand cmd1;
private void Form6_Load(object sender, EventArgs e)
{
SqlCommand cmd1 = new SqlCommand("select * from saledetails", con);
con.Open();
SqlDataAdapter da1 = new SqlDataAdapter(cmd1);
DataSet ds1 = new DataSet();
da1.Fill(ds1);
dataGridView1.DataSource = ds1.Tables[0].DefaultView;
con.Close();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 salead = new Form2();
salead.Show();
}
}
}
TABLE VIEW:
Itemdetails:
Saledetails :