private void idelete_btn_Click_1(object sender, EventArgs e) { if (iid_txt.Text == "") { MessageBox.Show("Please enter item id...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { string insertquery = "DELETE FROM items WHERE id='" + iid_txt.Text + "'"; MySqlCommand cmd = new MySqlCommand(insertquery, conn); conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record is deleted...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Information); conn.Close(); Grideloaditem(); autovalueadded(); autovalueaddedBar(); Main_Menu mn = new Main_Menu(); mn.autovalueaddedID(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } conn.Close(); }
private void customerBill_Load(object sender, EventArgs e) { Grideloaditem(); Main_Menu mn = new Main_Menu(); cid_txt.Text = mn.cus_id_txt.Text; this.cid_txt_TextChanged("", e); }
private void save_btn_Click(object sender, EventArgs e) { if (id_txt.Text == "") { MessageBox.Show("Please enter customer id...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (name_txt.Text == "") { MessageBox.Show("Please enter customer name...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (phone_txt.Text == "") { MessageBox.Show("Please enter customer phone Number...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (adress_txt.Text == "") { MessageBox.Show("Please enter customer Address...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { MemoryStream ms = new MemoryStream(); pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat); byte[] img = ms.ToArray(); ms.Close(); string insertquery = "INSERT INTO customer(id,name,phone,address,image) VALUES (@id,@name,@phone,@address,@image)"; MySqlCommand cmd = new MySqlCommand(insertquery, conn); cmd.Parameters.AddWithValue("@id", id_txt.Text); cmd.Parameters.AddWithValue("@name", name_txt.Text); cmd.Parameters.AddWithValue("@phone", phone_txt.Text); cmd.Parameters.AddWithValue("@address", adress_txt.Text); cmd.Parameters.AddWithValue("@image", img); conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record is added...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Information); conn.Close(); Grideloaditem(); autovalueaddedId(); Main_Menu mn = new Main_Menu(); mn.autovalueadded(); } catch (Exception ex) { MessageBox.Show(ex.Message); } conn.Close(); } conn.Close(); }
private void iupdate_btn_Click_1(object sender, EventArgs e) { if (iid_txt.Text == "") { MessageBox.Show("Please enter item id...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (barcodeid_txt.Text == "") { MessageBox.Show("Please enter Barcode id...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (iname_txt.Text == "") { MessageBox.Show("Please enter item name...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (qty_txt.Text == "") { MessageBox.Show("Please enter item quentity...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (realprice_txt.Text == "") { MessageBox.Show("Please enter item Real price...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (saleprice_txt.Text == "") { MessageBox.Show("Please enter item Sale price...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { try { MemoryStream ms = new MemoryStream(); pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat); byte[] img = ms.ToArray(); ms.Close(); string insertquery = "UPDATE items SET item_id=@item_id,barcode_id=@barcode_id,name=@name,brand=@brand, qty=@qty,price_real=@price_real,price_sale=@price_sale,description=@description,image=@image WHERE id='" + iid_txt.Text + "'"; MySqlCommand cmd = new MySqlCommand(insertquery, conn); cmd.Parameters.AddWithValue("@item_id", iid_txt.Text); cmd.Parameters.AddWithValue("@barcode_id", barcodeid_txt.Text); cmd.Parameters.AddWithValue("@name", iname_txt.Text); cmd.Parameters.AddWithValue("@brand", bname_combo.SelectedItem); cmd.Parameters.AddWithValue("@qty", qty_txt.Text); cmd.Parameters.AddWithValue("@price_real", realprice_txt.Text); cmd.Parameters.AddWithValue("@price_sale", saleprice_txt.Text); cmd.Parameters.AddWithValue("@description", idec_txt.Text); cmd.Parameters.AddWithValue("@image", img); conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Record is updated...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Information); conn.Close(); Grideloaditem(); autovalueadded(); autovalueaddedBar(); Main_Menu mn = new Main_Menu(); mn.autovalueaddedID(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } conn.Close(); }
public void logi_register() { string username = username_txt.Text; string password = password_txt.Text; string datetime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); if (username == "") { MessageBox.Show("Please enter your username...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (password == "") { MessageBox.Show("Please enter your password...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (login_btn.Text == "Login") { string query = "SELECT * FROM register where username ='******' && password = '******'"; MySqlDataAdapter adapt = new MySqlDataAdapter(query, conn); DataTable dt = new DataTable(); adapt.Fill(dt); if (dt.Rows.Count == 1) { string queryadd = "INSERT INTO login(username,password)VALUES(@username,@password)"; MySqlCommand cmd = new MySqlCommand(queryadd, conn); cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@password", password); //cmd.Parameters.AddWithValue("@datetime", datetime); conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Welcome to POS...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Information); Main_Menu mn = new Main_Menu(); mn.Show(); this.Hide(); conn.Close(); } else { MessageBox.Show("Please register in the software...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { try { //check duplicate values DataSet ds = new DataSet(); string querycheck = "select * from register where username = '******'"; MySqlCommand cmdchech = new MySqlCommand(querycheck, conn); MySqlDataAdapter da = new MySqlDataAdapter(cmdchech); da.Fill(ds); int i = ds.Tables[0].Rows.Count; if (i == 1) { MessageBox.Show("This username is already exists...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { string queryadd = "INSERT INTO register(username,password)VALUES(@username,@password)"; MySqlCommand cmd = new MySqlCommand(queryadd, conn); cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@password", password); //cmd.Parameters.AddWithValue("@datetime", datetime); conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Registered your Account...", "POS Info", MessageBoxButtons.OK, MessageBoxIcon.Information); conn.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } conn.Close(); } } }