You are on page 1of 16

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Oracle.DataAccess.Types;
using Oracle.DataAccess.Client;

namespace DB
{

public partial class Customer_Portal : Form


{
public string ConnectionString = "Data Source=(DESCRIPTION=" +
"(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))" +
"(CONNECT_DATA=(SERVICE_NAME=XE)));" + "User id=pussy;Password=cat;";
string q1, p1;
public Customer_Portal()
{
InitializeComponent();
}

private void Customer_Portal_Load(object sender, EventArgs e)


{

ComboBox1.SelectedIndex = 0;
comboBox3.SelectedIndex = 0;
comboBox4.SelectedIndex = 0;
comboBox5.SelectedIndex = 0;
comboBox6.SelectedIndex = 0;

try
{

OracleConnection con = new OracleConnection(ConnectionString);


con.Open();
String query = "select item from jewelery_stock";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}
con.Close();

// dataBind();
}
catch (Exception ex)
{
}

private void textBox5_TextChanged(object sender, EventArgs e)


{

private void Button1_Click(object sender, EventArgs e)


{

int j;
int total=0;

if(checkBox1.CheckState==CheckState.Checked )
{

if (TextBox4.Text != "")
{
int q = Convert.ToInt32(TextBox4.Text);

if (ComboBox1.Text == "Diamond")
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=1.3";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;

}
else if (ComboBox1.Text == "Silver")
{

try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=1.2";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}
int price = Convert.ToInt16(p1);
total += price * q;
}
else
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=1.1";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}

}
else
{
MessageBox.Show("Please Enter Quantity Of Locket ");
goto j;
}

}
if (checkBox2.CheckState == CheckState.Checked)
{

if(textBox7.Text!="")
{
int q = Convert.ToInt32(textBox7.Text);

if (comboBox3.Text == "Diamond")
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=2.3";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);

total += price * q;
}
else if (comboBox3.Text == "Silver")
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=2.2";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);

total += price * q;
}
else
{

try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=2.1";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}
con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}

}
else
{
MessageBox.Show("Please Enter Quantity Of Ring ");
goto j;
}

if (checkBox3.CheckState == CheckState.Checked)
{
if (textBox8.Text != "")
{
int q = Convert.ToInt32(textBox8.Text.ToString());

if (comboBox4.Text == "Diamond")
{

try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=3.3";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}
con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);

total += price * q;
}
else if (comboBox4.Text == "Silver")
{

try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=3.2";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);

total += price * q;
}
else
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=3.1";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}
}
else
{
MessageBox.Show("Please Enter Quantity Nacklace");
goto j;
}

}
if (checkBox4.CheckState == CheckState.Checked)
{
if (textBox9.Text != "")
{
int q = Convert.ToInt32(textBox9.Text);

if (comboBox5.Text == "Diamond")
{

try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=4.3";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}
else if (comboBox5.Text == "Silver")
{

try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=4.2";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}
else
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=4.1";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}

}
else
{
MessageBox.Show("Please Enter Quantity Bracelete");
goto j;
}

if (checkBox5.CheckState == CheckState.Checked)
{
if (textBox10.Text != "")
{
int q = Convert.ToInt32(textBox10.Text);

if (comboBox6.Text == "Diamond")
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=5.3";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}
else if (comboBox6.Text == "Silver")
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=5.2";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}
else
{
try
{

OracleConnection con = new


OracleConnection(ConnectionString);
con.Open();
String query = "select price,quantity from
jewelery_stock where id=5.1";
OracleCommand cmd = new OracleCommand(query, con);
OracleDataReader reader = cmd.ExecuteReader();

if (!(reader.HasRows))
{
// txt_query.Text = "No Data Found";
}
else
{
while (reader.Read())
{
p1 = reader["Price"].ToString();
q1 = reader["Quantity"].ToString();
}
}

con.Close();

// dataBind();
}
catch (Exception ex)
{
}

int price = Convert.ToInt16(p1);


total += price * q;
}
}
else
{
MessageBox.Show("Please Enter Quantity Chain");
goto j;
}

j: textBox11.Text =Convert.ToString( total);


int discount = (total * 2) / 100;
textBox13.Text = Convert.ToString(discount);
total = total - discount;
textBox12.Text = Convert.ToString(total);
// MessageBox.Show("count");
}

private void Button2_Click(object sender, EventArgs e)


{
this.Close();
User_Login log = new User_Login();
log.Show();

private void textBox11_TextChanged(object sender, EventArgs e)


{

private void label3_Click(object sender, EventArgs e)


{
Application.Exit();
}

private void Text_Pass_TextChanged(object sender, EventArgs e)


{

private void printDocument1_PrintPage(object sender,


System.Drawing.Printing.PrintPageEventArgs e)
{
e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12 , FontStyle.Regular) , Brushes.Black ,new Point(10,10));
e.Graphics.DrawString("Text_CN", new Font("Arial", 12,
FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));
// e.Graphics.DrawString("\t\t\t\tThanks For Use Our Service ", new
Font("Arial", 12, FontStyle.Regular), Brushes.Black, new Point(10, 10));

private void button3_Click(object sender, EventArgs e)


{
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
}

private void label10_Click(object sender, EventArgs e)


{

private void Text_CN_TextChanged(object sender, EventArgs e)


{

}
}
}

You might also like