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 System.Data.SqlClient;
namespace StockPOS
{
public partial class Cashys : Form
{
SqlDataAdapter adapter;
DataTable table;
SqlCommand cmd;
public Cashys()
{
InitializeComponent();
}
private void TextBox10_TextChanged(object sender, EventArgs e)
{
}
private void Button1_Click(object sender, EventArgs e)
{
this.Hide();
Form1 dish = new Form1();
dish.Show();
}
private void Productsbutton_Click(object sender, EventArgs e)
{
this.Hide();
Products dish = new Products();
dish.Show();
}
private void Depositsbutton_Click(object sender, EventArgs e)
{
this.Hide();
Deposits dish = new Deposits();
dish.Show();
}
private void Button3_Click(object sender, EventArgs e)
{
this.Hide();
Form1 dish = new Form1();
dish.Show();
}
private void Panel1_Paint(object sender, PaintEventArgs e)
{
}
private void Cashys_Load(object sender, EventArgs e)
{
listView1.GridLines = true;
listView1.View = View.Details;
listView1.FullRowSelect = true;
listView1.Columns.Add("Product Name", 150);
listView1.Columns.Add("Price", 150);
listView1.Columns.Add("Qty",150);
listView1.Columns.Add("Total", 150);
}
public void SearchData(String ValueToSearch)
{
using (SqlConnection con = new SqlConnection(Properties.ApplicationSetting.ConnectionString()))
{
using (SqlCommand Query = new SqlCommand("usp_query", con))
{
con.Open();
adapter = new SqlDataAdapter(cmd);
table = new DataTable();
adapter.Fill(table);
con.Close();
}
}
}
private void Search_Click(object sender, EventArgs e)
{
String Source = "Data Source=KAKASHI; Initial Catalog=SunvicDesigns; Trusted_Connection=Yes";
SqlConnection con = new SqlConnection(Source);
con.Open();
MessageBox.Show("Connected to database");
String SqlSelectQuery = "SELECT ProductName,ProductSize,ProductPrice FROM ProductDetails WHERE ProductID = " + int.Parse(ProductIDtxtBox3.Text);
SqlCommand cmd = new SqlCommand(SqlSelectQuery, con);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
pname.Text = (dr.GetValue(0).ToString());
ProductsSizetextBox1.Text = (dr.GetValue(1).ToString());
pricy.Text = (dr.GetValue(2).ToString());
}
con.Close();
}
private void Void_Click(object sender, EventArgs e)
{
String[] arr = new String[4];
arr[0] = pname.Text ;
arr[2] = qtytextBox.Text;
arr[1] = pricy.Text ;
;
double f1, g1, j;
double.TryParse(qtytextBox.Text, out f1); double.TryParse(pricy.Text, out g1);
j = f1 * g1;
if (j > 0)
arr[3] = j.ToString();
ListViewItem listy = new ListViewItem(arr);
listView1.Items.Add(listy);
}
private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void TottextBox_TextChanged(object sender, EventArgs e)
{
}
}
}