private void button5_Click(object sender, EventArgs e) { if (skutboxmain.Text.Length == 0) { MessageBox.Show("Please Enter The SKU in SKU box"); } else { progressBar1.Value = 30; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 70; string query = "DELETE FROM inventory WHERE sku='" + skutboxmain.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); cmd.ExecuteNonQuery(); } catch (Exception e1) { MessageBox.Show(e1.Message); } progressBar1.Value = 100; MessageBox.Show("Sucessfully Delete" + skutboxmain.Text); inventorygrid.Update(); inventorygrid.Refresh(); } }
private void search_click(object sender, EventArgs e) { if (skutboxmain.Text.Length == 0) { MessageBox.Show("Please Enter The SKU in SKU box"); } else { progressBar1.Value = 10; var mydbconnection = new dbconnection();//new code progressBar1.Value = 30; string query = "SELECT sku,productname,costprice,sellingprice,stockunit FROM inventory WHERE sku='" + skutboxmain.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 50; MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmd; DataTable dataset = new DataTable(); sda.Fill(dataset); progressBar1.Value = 80; BindingSource bsource = new BindingSource(); bsource.DataSource = dataset; inventorygrid.DataSource = dataset; sda.Update(dataset); progressBar1.Value = 100; } }
private void searchb_Click(object sender, EventArgs e) { try { sales.dataset.Clear(); progressBar1.Value = 0; MySqlDataReader dr; var mydbconnection = new dbconnection();//new code progressBar1.Value = 40; string query = "SELECT invdate,invno,paisapayid,phonenumber,emailid,paymentrecdate,customername,buyerid,billingaddress,shippingaddress,shippingpatner,awbno,shippingdate,shippingfees,total,status FROM ebayerp_sales WHERE paisapayid='" + long.Parse(paisapayidtbox.Text) + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); dr = cmd.ExecuteReader(); while (dr.Read()) { invdatetbox.Text = dr[0].ToString(); invnotbox.Text = dr[1].ToString(); paisapayidtbox.Text = dr[2].ToString(); phonenumbertbox.Text = dr[3].ToString(); emailidtbox.Text = dr[4].ToString(); paymentrecdatetbox.Text = dr[5].ToString(); customernametbox.Text = dr[6].ToString(); buyeridtbox.Text = dr[7].ToString(); billingaddresstbox.Text = dr[8].ToString(); shippingaddresstbox.Text = dr[9].ToString(); shippingpatnertbox.Text = dr[10].ToString(); awbnotbox.Text = dr[11].ToString(); shippingdatetbox.Text = dr[12].ToString(); shippingfeestbox.Text = dr[13].ToString(); totaltbox.Text = dr[14].ToString(); statustbox.Text = dr[15].ToString(); } progressBar1.Value = 50; } catch (Exception e2) { MessageBox.Show(e2.Message); } try { progressBar1.Value = 55; var mydbconnection = new dbconnection(); progressBar1.Value = 70; string query2 = "SELECT SKU,productname,price,qty,withouttaxtotal,itemtax,itemtotal FROM solditem WHERE paisapayidglobal='" + long.Parse(paisapayidtbox.Text) + "'"; MySqlCommand cmd1 = new MySqlCommand(query2, mydbconnection.getconnect); MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmd1; //DataTable dataset = new DataTable(); sda.Fill(dataset); BindingSource bsource = new BindingSource(); bsource.DataSource = dataset; saleslistgrid.DataSource = dataset; sda.Update(dataset); progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } }
private void button4_Click(object sender, EventArgs e) { try { progressBar1.Value = 15; var mydbconnection = new dbconnection(); progressBar1.Value = 30; string query = "SELECT * FROM inventory"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 50; MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmd; DataTable dataset = new DataTable(); sda.Fill(dataset); progressBar1.Value = 80; //BindingSource bsource = new BindingSource(); //bsource.DataSource = dataset; inventorygrid.DataSource = dataset; sda.Update(dataset); progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } }
private void button6_Click(object sender, EventArgs e) { if (skutboxkey.Text.Length == 0) { MessageBox.Show("Please Enter the SKU In SKUKEY box"); } else { progressBar1.Value = 10; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 20; //MySqlDataReader dr; string query = "SELECT sku,productname,costprice,sellingprice,stockunit FROM inventory WHERE sku='" + skutboxkey.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 30; MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmd; //dr = cmd.ExecuteReader(); DataTable dataset = new DataTable(); progressBar1.Value = 40; sda.Fill(dataset); BindingSource bsource = new BindingSource(); bsource.DataSource = dataset; inventorylistgrid.DataSource = dataset; sda.Update(dataset); } catch (Exception e1) { MessageBox.Show(e1.Message); } progressBar1.Value = 50; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 60; MySqlDataReader dr; string query = "SELECT sku,productname,costprice,sellingprice,stockunit FROM inventory WHERE sku='" + skutboxkey.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); dr = cmd.ExecuteReader(); progressBar1.Value = 70; while (dr.Read()) { skutbox.Text = dr[0].ToString(); productnametbox.Text = dr[1].ToString(); costpricetbox.Text = dr[2].ToString(); sellingpricetbox.Text = dr[3].ToString(); stockunittbox.Text = dr[4].ToString(); } progressBar1.Value = 80; dr.Close(); } catch (Exception e2) { MessageBox.Show(e2.Message); } updatebutton.Enabled = true; progressBar1.Value = 100; } }
public void button1_Click(object sender, EventArgs e) { DialogResult ans = MessageBox.Show("Payment Received Date :-----"+paymentrecdatetbox.Text+"\n"+"Shipping Date :------"+shippingdatetbox.Text,"Is it Correct ?",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button1); if (ans == DialogResult.Yes) { try { progressBar1.Value = 10; var mydbconnection = new dbconnection();//new code string query = "INSERT INTO ebayerp_sales (invdate,invno,paisapayid,phonenumber,emailid,paymentrecdate,customername,buyerid,billingaddress,shippingaddress,shippingpatner,awbno,shippingdate,shippingfees,total,status) VALUES('" + invdate.Text + "','" + int.Parse(invnotbox.Text) + "','" + long.Parse(paisapayidtbox.Text) + "','" + long.Parse(phonenumbertbox.Text) + "','" + emailidtbox.Text + "','" + paymentrecdatetbox.Text + "','" + customernametbox.Text + "','" + buyeridtbox.Text + "','" + billingaddresstbox.Text + "','" + shippingaddresstbox.Text + "','" + shippingpatnertbox.Text + "','" + awbnotbox.Text + "','" + shippingdatetbox.Text + "','" + double.Parse(shippingfeestbox.Text) + "','" + double.Parse(totaltbox.Text) + "','" + statustbox.Text + "')"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 40; cmd.ExecuteNonQuery(); progressBar1.Value = 50; } catch (Exception e1) { MessageBox.Show(e1.Message); } try { progressBar1.Value = 55; var mydbconnection = new dbconnection(); string query, sku; string itemname; int itemqty; double itemprice, total, withouttax, itemtax; for (int i = 0; i < inventorylist.saleslist.Rows.Count; i++) { sku = Convert.ToString(inventorylist.saleslist.Rows[i][0].ToString()); itemname = Convert.ToString(inventorylist.saleslist.Rows[i][1].ToString()); itemprice = Convert.ToDouble(inventorylist.saleslist.Rows[i][2].ToString()); itemqty = Convert.ToInt32(inventorylist.saleslist.Rows[i][3].ToString()); withouttax = Convert.ToDouble(inventorylist.saleslist.Rows[i][4].ToString()); itemtax = Convert.ToDouble(inventorylist.saleslist.Rows[i][5].ToString()); total = Convert.ToDouble(inventorylist.saleslist.Rows[i][6].ToString()); query = "INSERT INTO solditem(SKU,productname,price,qty,withouttaxtotal,itemtax,itemtotal,paisapayidglobal) VALUES('" + sku + "','" + itemname + "','" + itemprice + "','" + itemqty + "','" + withouttax + "','" + itemtax + "','" + total + "'," + paisapayid2 + ")"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 80; cmd.ExecuteNonQuery(); } progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } } }
public void button1_Click(object sender, EventArgs e) { DialogResult ans = MessageBox.Show("Payment Received Date :-----" + paymentrecdatetbox.Text + "\n" + "Shipping Date :------" + shippingdatetbox.Text, "Is it Correct ?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (ans == DialogResult.Yes) { try { progressBar1.Value = 10; var mydbconnection = new dbconnection();//new code string query = "INSERT INTO ebayerp_sales (invdate,invno,paisapayid,phonenumber,emailid,paymentrecdate,customername,buyerid,billingaddress,shippingaddress,shippingpatner,awbno,shippingdate,shippingfees,total,status) VALUES('" + invdate.Text + "','" + int.Parse(invnotbox.Text) + "','" + long.Parse(paisapayidtbox.Text) + "','" + long.Parse(phonenumbertbox.Text) + "','" + emailidtbox.Text + "','" + paymentrecdatetbox.Text + "','" + customernametbox.Text + "','" + buyeridtbox.Text + "','" + billingaddresstbox.Text + "','" + shippingaddresstbox.Text + "','" + shippingpatnertbox.Text + "','" + awbnotbox.Text + "','" + shippingdatetbox.Text + "','" + double.Parse(shippingfeestbox.Text) + "','" + double.Parse(totaltbox.Text) + "','" + statustbox.Text + "')"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 40; cmd.ExecuteNonQuery(); progressBar1.Value = 50; } catch (Exception e1) { MessageBox.Show(e1.Message); } try { progressBar1.Value = 55; var mydbconnection = new dbconnection(); string query, sku; string itemname; int itemqty; double itemprice, total, withouttax, itemtax; for (int i = 0; i < inventorylist.saleslist.Rows.Count; i++) { sku = Convert.ToString(inventorylist.saleslist.Rows[i][0].ToString()); itemname = Convert.ToString(inventorylist.saleslist.Rows[i][1].ToString()); itemprice = Convert.ToDouble(inventorylist.saleslist.Rows[i][2].ToString()); itemqty = Convert.ToInt32(inventorylist.saleslist.Rows[i][3].ToString()); withouttax = Convert.ToDouble(inventorylist.saleslist.Rows[i][4].ToString()); itemtax = Convert.ToDouble(inventorylist.saleslist.Rows[i][5].ToString()); total = Convert.ToDouble(inventorylist.saleslist.Rows[i][6].ToString()); query = "INSERT INTO solditem(SKU,productname,price,qty,withouttaxtotal,itemtax,itemtotal,paisapayidglobal) VALUES('" + sku + "','" + itemname + "','" + itemprice + "','" + itemqty + "','" + withouttax + "','" + itemtax + "','" + total + "'," + paisapayid2 + ")"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 80; cmd.ExecuteNonQuery(); } progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } } }
private void update_click(object sender, EventArgs e) { if (skutboxkey.Text.Length == 0) { MessageBox.Show("Please Enter the SKU In SKUKEY box"); } else { progressBar1.Value = 10; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 20; string query = "UPDATE inventory SET sku='" + skutbox.Text + "',productname='" + productnametbox.Text + "',costprice='" + int.Parse(costpricetbox.Text) + "',sellingprice='" + int.Parse(sellingpricetbox.Text) + "',stockunit='" + stockunittbox.Text + "' WHERE sku='" + skutboxkey.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 30; cmd.ExecuteNonQuery(); progressBar1.Value = 40; } catch (Exception e1) { MessageBox.Show(e1.Message); } progressBar1.Value = 50; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 60; string query = "SELECT sku,productname,costprice,sellingprice,stockunit FROM inventory WHERE sku='" + skutbox.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); MySqlDataAdapter sda = new MySqlDataAdapter(); progressBar1.Value = 70; sda.SelectCommand = cmd; DataTable dataset = new DataTable(); sda.Fill(dataset); //BindingSource bsource = new BindingSource(); // bsource.DataSource = dataset; inventorylistgrid.DataSource = dataset; sda.Update(dataset); } catch (Exception e1) { MessageBox.Show(e1.Message); } progressBar1.Value = 100; } }
private void update_click(object sender, EventArgs e) { try { progressBar1.Value = 10; var mydbconnection = new dbconnection();//new code progressBar1.Value = 40; string query = "UPDATE ebayerp_sales SET invdate='" + invdatetbox.Text + "',invno='" + invnotbox.Text + "',paisapayid='" + long.Parse(paisapayidtbox.Text) + "',phonenumber='" + long.Parse(phonenumbertbox.Text) + "',emailid='" + emailidtbox.Text + "',paymentrecdate='" + paymentrecdatetbox.Text + "',customername='" + customernametbox.Text + "',buyerid='" + buyeridtbox.Text + "',billingaddress='" + billingaddresstbox.Text + "',shippingaddress='" + shippingaddresstbox.Text + "',shippingpatner='" + shippingpatnertbox.Text + "',awbno='" + awbnotbox.Text + "',shippingdate='" + shippingdatetbox.Text + "',shippingfees='" + int.Parse(shippingfeestbox.Text) + "',total='" + int.Parse(totaltbox.Text) + "',status='" + statustbox.Text + "' WHERE paisapayid='" + long.Parse(paisapayidtbox.Text) + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); cmd.ExecuteNonQuery(); progressBar1.Value = 50; } catch (Exception e1) { MessageBox.Show(e1.Message); } try { progressBar1.Value = 60; var mydbconnection = new dbconnection(); string query, sku; string itemname; int itemqty; double itemprice, total, withouttax, itemtax; for (int i = 0; i < (saleslistgrid.Rows.Count - 1); i++) { sku = Convert.ToString(saleslistgrid.Rows[i].Cells[0].Value); itemname = Convert.ToString(saleslistgrid.Rows[i].Cells[0].Value); itemprice = Convert.ToDouble(saleslistgrid.Rows[i].Cells[1].Value); itemqty = Convert.ToInt32(saleslistgrid.Rows[i].Cells[2].Value); withouttax = Convert.ToDouble(saleslistgrid.Rows[i].Cells[3].Value); itemtax = Convert.ToDouble(saleslistgrid.Rows[i].Cells[4].Value); total = Convert.ToDouble(saleslistgrid.Rows[i].Cells[5].Value); query = "UPDATE solditem SET price='" + itemprice + "',qty='" + itemqty + "',productname='" + itemname + "',withouttaxtotal='" + withouttax + "',itemtax='" + itemtax + "',itemtotal='" + total + "' WHERE paisapayidglobal='" + sku + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 80; cmd.ExecuteNonQuery(); } progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } }
private void inventorylist_Load(object sender, EventArgs e) { paisapayidprimarykeytbox.Text = salesentry.paisapayid2.ToString(); var mydbconnection = new dbconnection(); string query = "SELECT * FROM inventory"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); MySqlDataAdapter sda = new MySqlDataAdapter(); sda.SelectCommand = cmd; DataTable dataset = new DataTable(); sda.Fill(dataset); BindingSource bsource = new BindingSource(); bsource.DataSource = dataset; dataGridView1.DataSource = dataset; sda.Update(dataset); ///////////////////////////////////////////////////////////////////////////// DataColumn Item_SKU = new DataColumn("SKU", Type.GetType("System.String")); DataColumn Item_Name = new DataColumn("Item Name", Type.GetType("System.String")); DataColumn Item_Price = new DataColumn("Item_Price", Type.GetType("System.Decimal")); DataColumn Item_Qty = new DataColumn("Item_Qty", Type.GetType("System.Decimal")); DataColumn Item_totalwt = new DataColumn("With Out Tax", Type.GetType("System.Decimal")); DataColumn Item_Tax = new DataColumn("Item_tax", Type.GetType("System.Decimal")); // "Item_Tax" column is calculated (10% Tax) Item_Tax.Expression = "(Item_Price * Item_Qty)" + "/100" + "*" + Properties.Settings.Default.tax; Item_totalwt.Expression = "Item_Price * Item_Qty"; DataColumn Item_Total = new DataColumn("Item_Total", Type.GetType("System.Decimal")); // "Item_Total" column is calculated as (Price * Qty + Tax) Item_Total.Expression = "Item_Price * Item_Qty + Item_Tax"; saleslist.Columns.Add(Item_SKU); // saleslist.Columns.Add(Item_Name); // Add 4 saleslist.Columns.Add(Item_Price); // Columns saleslist.Columns.Add(Item_Qty); // to saleslist.Columns.Add(Item_totalwt); saleslist.Columns.Add(Item_Tax); // the saleslist.Columns.Add(Item_Total); // Datatable }
private void button2_Click(object sender, EventArgs e) { progressBar1.Value = 10; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 30; string query = "INSERT INTO inventory (sku,productname,costprice,sellingprice,stockunit) VALUES('" + skutbox.Text + "','" + productnametbox.Text + "','" + float.Parse(costpricetbox.Text) + "','" + float.Parse(sellingpricetbox.Text) + "','" + int.Parse(stockunittbox.Text) + "')"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 40; cmd.ExecuteNonQuery(); progressBar1.Value = 60; } catch (Exception e3) { MessageBox.Show(e3.Message); } progressBar1.Value = 100; }
private void button5_Click(object sender, EventArgs e) { try { MessageBox.Show("You are going to delete this Transaction"); progressBar1.Value = 30; var mydbconnection = new dbconnection();//new code string query = "DELETE FROM ebayerp_sales WHERE paisapayid='" + int.Parse(paisapayidtbox.Text) + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); progressBar1.Value = 60; cmd.ExecuteNonQuery(); String query2 = "DELETE FROM solditem WHERE paisapayidglobal='" + int.Parse(paisapayidtbox.Text) + "'"; MySqlCommand cmd2 = new MySqlCommand(query2, mydbconnection.getconnect); progressBar1.Value = 80; cmd2.ExecuteNonQuery(); progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } }
private void button6_Click(object sender, EventArgs e) { if (skutbox.Text.Length == 0) { MessageBox.Show("Please Enter The SKU in SKU box"); } else { progressBar1.Value = 30; try { var mydbconnection = new dbconnection();//new code progressBar1.Value = 70; string query = "DELETE FROM solditem WHERE sku='" + skutbox.Text + "'and paisapayidglobal='" + long.Parse(paisapayidtbox.Text) + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); cmd.ExecuteNonQuery(); progressBar1.Value = 100; } catch (Exception e1) { MessageBox.Show(e1.Message); } } }
private void button5_Click(object sender, EventArgs e) { if (skutboxmain.Text.Length == 0) { MessageBox.Show("Please Enter The SKU in SKU box"); } else { progressBar1.Value = 30; try { var mydbconnection = new dbconnection();//new code progressBar1.Value=70; string query = "DELETE FROM inventory WHERE sku='" + skutboxmain.Text + "'"; MySqlCommand cmd = new MySqlCommand(query, mydbconnection.getconnect); cmd.ExecuteNonQuery(); } catch (Exception e1) { MessageBox.Show(e1.Message); } progressBar1.Value = 100; MessageBox.Show("Sucessfully Delete"+skutboxmain.Text); inventorygrid.Update(); inventorygrid.Refresh(); } }