Professional Documents
Culture Documents
Home Page: Using Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public
Home Page: Using Using Using Using Using Using Using Using Using Using Namespace Public Partial Class Public
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
Student Registration
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Register : Form
{
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Register()
{
InitializeComponent();
}
//auto increment
query = "select max(reg_no) from student";
con1.Open();
OracleCommand cmd = new OracleCommand(query,con1);
cmd.CommandText = query;
ID = Convert.ToString(cmd.ExecuteScalar());
if((ID.Equals("")))
textBox1.Text = Convert.ToString(20140001);
else
{
long s = Convert.ToInt64(ID) + 1;
textBox1.Text = Convert.ToString(s);
}
con1.Close();
}
con1.Open();
query = "insert into student values('" + textBox1.Text + "','" +
textBox5.Text + "'," + comboBox2.Text + ")";
OracleCommand cmd1 = new OracleCommand(query, con1);
cmd1.CommandType = CommandType.Text;
cmd1.ExecuteNonQuery();
con1.Close();
con1.Open();
query = "insert into user_contact values('" + textBox5.Text + "','" +
textBox6.Text + "')";
OracleCommand cmd2 = new OracleCommand(query, con1);
cmd2.CommandType = CommandType.Text;
cmd2.ExecuteNonQuery();
con1.Close();
Form1 a;
a = new Form1();
a.Show();
Hide();
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
string c1 = null;
int flag = 0;
con1.Open();
query = "select uname from user_details where uname = '"+ textBox5.Text +"'";
OracleCommand cmd = new OracleCommand(query,con1);
OracleDataReader reader;
reader = cmd.ExecuteReader();
while (reader.Read())
{
c1 = (string)reader["uname"];
flag = 1;
}
reader.Close();
if (textBox5.Text == "")
{
MessageBox.Show("Fill the box!!");
}
else
{
if (flag == 1)
MessageBox.Show("Username not avaliable!!");
else
MessageBox.Show("Avaliable!!");
}
con1.Close();
}
}
Admin login
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Alogin : Form
{
OracleConnection con1 = new OracleConnection("Data source=xe;User
ID=gcet;password=gcet");
public Alogin()
{
InitializeComponent();
}
try
{
if ((textBox1.Text == "") || (maskedTextBox1.Text == ""))
{
MessageBox.Show("Enter empty block!!");
}
else
{
string c1, c2 = null;
int flag = 0;
con1.Open();
query = "select * from admin where username = '" + textBox1.Text +
"'";
OracleCommand cmd = new OracleCommand(query, con1);
OracleDataReader reader;
reader = cmd.ExecuteReader();
while (reader.Read())
{
c1 = (string)reader["username"];
c2 = (string)reader["pword"];
flag = 1;
}
reader.Close();
if (flag == 1)
{
if (c2 == maskedTextBox1.Text)
{
Amenu a;
a = new Amenu();
a.Show();
this.Close();
}
else
MessageBox.Show("Invalid password!!");
}
else
MessageBox.Show("Invalid username!!");
con1.Close();
}
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
}
}
}
Admin menu
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GCET_14
{
public partial class Amenu : Form
{
public Amenu()
{
InitializeComponent();
}
else
{
Adelete a;
a = new Adelete();
a.Show();
Hide();
}
}
}
}
View, Search And delete
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Adelete : Form
{
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Adelete()
{
InitializeComponent();
}
}
}
}
Set question Papers
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class setpaper : Form
{
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public setpaper()
{
InitializeComponent();
}
con1.Open();
query = "insert into objective values('" + comboBox1.Text + "','" +
textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text +
"')";
OracleCommand cmd1 = new OracleCommand(query, con1);
cmd1.CommandType = CommandType.Text;
cmd1.ExecuteNonQuery();
con1.Close();
MessageBox.Show("Questions Inserted successfully!!");
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
}
}
}
Student Login
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Slogin : Form
{
OracleConnection con1 = new OracleConnection("Data source =xe;User
ID=gcet;password=gcet");
public Slogin()
{
InitializeComponent();
}
con1.Open();
query = "select * from student where reg_no = '" + textBox1.Text + "'";
OracleCommand cmd = new OracleCommand(query, con1);
OracleDataReader reader;
reader = cmd.ExecuteReader();
while (reader.Read())
{
c1 = (string)reader["reg_no"];
c2 = (string)reader["u_id"];
flag = 1;
}
reader.Close();
if (flag == 1)
{
if (c2 == textBox2.Text)
{
MyGlobals.reg = textBox1.Text;
MyGlobals.uname = textBox2.Text;
Smenu a;
a = new Smenu();
a.Show();
this.Close();
}
else
MessageBox.Show("Invalid user ID!!");
}
else
MessageBox.Show("Invalid registration ID!!");
con1.Close();
}
}
}
Student menu
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Smenu : Form
{
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Smenu()
{
InitializeComponent();
}
if (dt1.Date == dt2.Date)
{
if (time > new TimeSpan(00, 00, 00) && time < new TimeSpan(23, 59,
00)) //Hours, Minutes, Seconds
{
string query2 = "Select score from result where reg_no = '" +
MyGlobals.reg + "'";
con1.Open();
OracleCommand cmd1 = new OracleCommand(query2, con1);
cmd1.CommandText = query2;
string ID = Convert.ToString(cmd1.ExecuteScalar());
con1.Close();
if ((ID.Equals("")))
{
Instructions a;
a = new Instructions();
a.Show();
Hide();
}
else
{
MessageBox.Show("You have answered exam!!");
}
}
else
MessageBox.Show("Examination Time over!!");
}
else
MessageBox.Show("You cannot answer now!!");
}
else if (radioButton2.Checked)
{
string query2 = "Select score from result where reg_no = '"+
MyGlobals.reg +"'";
con1.Open();
OracleCommand cmd1 = new OracleCommand(query2, con1);
cmd1.CommandText = query2;
string ID = Convert.ToString(cmd1.ExecuteScalar());
con1.Close();
if ((ID.Equals("")))
{
MessageBox.Show("You have not answered exam!!");
}
else
{
Result a;
a = new Result();
a.Show();
Hide();
}
con1.Close();
}
else if (radioButton3.Checked)
{
DateTime dt1 = DateTime.Parse("10/31/2013");
DateTime dt2 = DateTime.Now;
if (dt2 <= dt1)
{
UpdateRegister a;
a = new UpdateRegister();
a.Show();
Hide();
}
else
MessageBox.Show("Registration date is over!!");
}
}
}
Update Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class UpdateRegister : Form
{
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public UpdateRegister()
{
InitializeComponent();
}
textBox1.Text = MyGlobals.uname;
textBox2.Text = MyGlobals.reg;
}
Smenu a;
a = new Smenu();
a.Show();
Hide();
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
}
}
}
Instructions
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace GCET_14
{
public partial class Instructions : Form
{
public Instructions()
{
InitializeComponent();
}
}
}
Physics Paper
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Physics : Form
{
int flag = 0, count = 0;
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Physics()
{
InitializeComponent();
}
//showing questions
try
{
string query = null;
con1.Open();
query = "SELECT question FROM paper WHERE q_no BETWEEN 1 AND 5 ORDER BY
q_no ASC";
OracleCommand cmd = new OracleCommand(query, con1);
cmd.CommandType = CommandType.Text;
OracleDataReader reader;
reader = cmd.ExecuteReader();
reader.Read();
label1.Text = (string)reader[0];
reader.Read();
label2.Text = (string)reader[0];
reader.Read();
label3.Text = (string)reader[0];
reader.Read();
label4.Text = (string)reader[0];
reader.Read();
label5.Text = (string)reader[0];
reader.Close();
//show options
query = "select * from objective where q_no BETWEEN 1 AND 5 ORDER BY q_no
ASC";
OracleCommand cmd1 = new OracleCommand(query, con1);
OracleDataReader reader1;
reader1 = cmd1.ExecuteReader();
//question 1
reader1.Read();
radioButton1.Text = (string)reader1["ob1"];
radioButton2.Text = (string)reader1["ob2"];
radioButton3.Text = (string)reader1["ob3"];
radioButton4.Text = (string)reader1["ob4"];
//question 2
reader1.Read();
radioButton5.Text = (string)reader1["ob1"];
radioButton6.Text = (string)reader1["ob2"];
radioButton7.Text = (string)reader1["ob3"];
radioButton8.Text = (string)reader1["ob4"];
//question 3
reader1.Read();
radioButton9.Text = (string)reader1["ob1"];
radioButton10.Text = (string)reader1["ob2"];
radioButton11.Text = (string)reader1["ob3"];
radioButton12.Text = (string)reader1["ob4"];
//question 4
reader1.Read();
radioButton13.Text = (string)reader1["ob1"];
radioButton14.Text = (string)reader1["ob2"];
radioButton15.Text = (string)reader1["ob3"];
radioButton16.Text = (string)reader1["ob4"];
//question 5
reader1.Read();
radioButton17.Text = (string)reader1["ob1"];
radioButton18.Text = (string)reader1["ob2"];
radioButton19.Text = (string)reader1["ob3"];
radioButton20.Text = (string)reader1["ob4"];
reader1.Close();
con1.Close();
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
}
timer1.Stop();
Maths a = new Maths();
a.Show();
Hide();
}
}
}
Maths Paper
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Maths : Form
{
int flag = 0, count = 0;
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Maths()
{
InitializeComponent();
}
//showing questions
try
{
string query = null;
con1.Open();
query = "SELECT question FROM paper WHERE q_no BETWEEN 6 AND 10 ORDER BY
q_no ASC";
OracleCommand cmd = new OracleCommand(query, con1);
OracleDataReader reader;
reader = cmd.ExecuteReader();
reader.Read();
label1.Text = (string)reader["question"];
reader.Read();
label2.Text = (string)reader["question"];
reader.Read();
label3.Text = (string)reader["question"];
reader.Read();
label4.Text = (string)reader["question"];
reader.Read();
label5.Text = (string)reader["question"];
reader.Close();
//show options
query = "select * from objective where q_no BETWEEN 6 AND 10 ORDER BY
q_no ASC";
OracleCommand cmd1 = new OracleCommand(query, con1);
OracleDataReader reader1;
reader1 = cmd1.ExecuteReader();
//question 1
reader1.Read();
radioButton1.Text = (string)reader1["ob1"];
radioButton2.Text = (string)reader1["ob2"];
radioButton3.Text = (string)reader1["ob3"];
radioButton4.Text = (string)reader1["ob4"];
//question 2
reader1.Read();
radioButton5.Text = (string)reader1["ob1"];
radioButton6.Text = (string)reader1["ob2"];
radioButton7.Text = (string)reader1["ob3"];
radioButton8.Text = (string)reader1["ob4"];
//question 3
reader1.Read();
radioButton9.Text = (string)reader1["ob1"];
radioButton10.Text = (string)reader1["ob2"];
radioButton11.Text = (string)reader1["ob3"];
radioButton12.Text = (string)reader1["ob4"];
//question 4
reader1.Read();
radioButton13.Text = (string)reader1["ob1"];
radioButton14.Text = (string)reader1["ob2"];
radioButton15.Text = (string)reader1["ob3"];
radioButton16.Text = (string)reader1["ob4"];
//question 5
reader1.Read();
radioButton17.Text = (string)reader1["ob1"];
radioButton18.Text = (string)reader1["ob2"];
radioButton19.Text = (string)reader1["ob3"];
radioButton20.Text = (string)reader1["ob4"];
reader1.Close();
con1.Close();
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
}
timer1.Stop();
Chem a = new Chem();
a.Show();
Hide();
}
}
}
Chemistry Paper
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Chem : Form
{
int flag = 0, count = 0;
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Chem()
{
InitializeComponent();
}
//showing questions
try
{
string query = null;
con1.Open();
query = "SELECT question FROM paper WHERE q_no BETWEEN 11 AND 15 ORDER BY
q_no ASC";
OracleCommand cmd = new OracleCommand(query, con1);
OracleDataReader reader;
reader = cmd.ExecuteReader();
reader.Read();
label1.Text = (string)reader["question"];
reader.Read();
label2.Text = (string)reader["question"];
reader.Read();
label3.Text = (string)reader["question"];
reader.Read();
label4.Text = (string)reader["question"];
reader.Read();
label5.Text = (string)reader["question"];
reader.Close();
//show options
query = "select * from objective where q_no BETWEEN 11 AND 15 ORDER BY
q_no ASC";
OracleCommand cmd1 = new OracleCommand(query, con1);
OracleDataReader reader1;
reader1 = cmd1.ExecuteReader();
//question 1
reader1.Read();
radioButton1.Text = (string)reader1["ob1"];
radioButton2.Text = (string)reader1["ob2"];
radioButton3.Text = (string)reader1["ob3"];
radioButton4.Text = (string)reader1["ob4"];
//question 2
reader1.Read();
radioButton5.Text = (string)reader1["ob1"];
radioButton6.Text = (string)reader1["ob2"];
radioButton7.Text = (string)reader1["ob3"];
radioButton8.Text = (string)reader1["ob4"];
//question 3
reader1.Read();
radioButton9.Text = (string)reader1["ob1"];
radioButton10.Text = (string)reader1["ob2"];
radioButton11.Text = (string)reader1["ob3"];
radioButton12.Text = (string)reader1["ob4"];
//question 4
reader1.Read();
radioButton13.Text = (string)reader1["ob1"];
radioButton14.Text = (string)reader1["ob2"];
radioButton15.Text = (string)reader1["ob3"];
radioButton16.Text = (string)reader1["ob4"];
//question 5
reader1.Read();
radioButton17.Text = (string)reader1["ob1"];
radioButton18.Text = (string)reader1["ob2"];
radioButton19.Text = (string)reader1["ob3"];
radioButton20.Text = (string)reader1["ob4"];
reader1.Close();
con1.Close();
}
catch (Exception er)
{
con1.Close();
MessageBox.Show(er.Message);
}
}
timer1.Stop();
Smenu a = new Smenu();
a.Show();
Hide();
}
}
}
Result
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
using System.IO;
namespace GCET_14
{
public partial class Result : Form
{
OracleConnection con1 = new OracleConnection("Data Source=xe;User
ID=gcet;password=gcet");
public Result()
{
InitializeComponent();
}