private void add_btn_Click(object sender, EventArgs e) { if (cb_container.Text == "" || dud_quantity.Text == "" || cb_desc.Text == "") { Invalid inv = new Invalid(); inv.Show(); } else { try { con.Open(); sda = new SqlDataAdapter("INSERT INTO unit_tbl (Unit_Description, Quantity)" + "values ('" + cb_container.Text + " (" + dud_quantity.Text + cb_desc.Text + " )" + "', '" + dud_quantity.Text + "' )", con); DataTable dt = new DataTable(); sda.Fill(dt); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } txt_unitID.Clear(); cb_container.ResetText(); dud_quantity.ResetText(); cb_desc.ResetText(); loadtabletodatagridview(); } }
private void update_btn_Click(object sender, EventArgs e) { if (txt_SuppID.Text == "" /*|| txt_prodname.Text == "" || cb_ProdLine.Text == "" || cb_netwt.Text == "" || cb_unit.Text == ""*/) { Invalid inv = new Invalid(); inv.Show(); } else { try { con.Open(); sda = new SqlDataAdapter("UPDATE supplier_tbl SET Contact_Person = '" + txt_contactperson.Text + "', Telephone_No = '" + txt_telNo.Text + "', Cellphone_No = '" + txt_mobNo.Text + "', Address = '" + txt_compAdd.Text + "', Supplier_Name = '" + txt_suppName.Text + "', Supplier_Email = '" + txt_emailadd.Text + "', Lead_Time = '" + txt_leadT.Text + "' where Supplier_ID = '" + txt_SuppID.Text + "'", con); dt = new DataTable(); sda.Fill(dt); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } txt_SuppID.Clear(); txt_contactperson.Clear(); txt_telNo.Clear(); txt_mobNo.Clear(); txt_emailadd.Clear(); txt_suppName.Clear(); txt_compAdd.Clear(); txt_leadT.Clear(); loadtabletodatagridview(); } }
private void add_btn_Click(object sender, EventArgs e) { if (txt_prodline.Text == "") { Invalid inv = new Invalid(); inv.Show(); } else { try { con.Open(); sda = new SqlDataAdapter("INSERT INTO productline_tbl (Product_Line)" + "values ('" + txt_prodline.Text + "')", con); DataTable dt = new DataTable(); sda.Fill(dt); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } txt_prodlineID.Clear(); txt_prodline.Clear(); loadtabletodatagridview(); } }
private void add_btn_Click(object sender, EventArgs e) { if (txt_contactperson.Text == "" || txt_suppName.Text == "" || txt_compAdd.Text == "" || txt_leadT.Text == "") { Invalid inv = new Invalid(); inv.Show(); } else { try { con.Open(); sda = new SqlDataAdapter("INSERT INTO supplier_tbl (Supplier_Name, Contact_Person, Telephone_No, Cellphone_No, Address, Supplier_Email, Lead_Time)" + "values ('" + txt_suppName.Text + "','" + txt_contactperson.Text + "','" + txt_telNo.Text + "', '" + txt_mobNo.Text + "', '" + txt_compAdd.Text + "', '" + txt_emailadd.Text + "', '" + txt_leadT.Text + "')", con); DataTable dt = new DataTable(); sda.Fill(dt); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } txt_SuppID.Clear(); txt_contactperson.Clear(); txt_telNo.Clear(); txt_mobNo.Clear(); txt_emailadd.Clear(); txt_suppName.Clear(); txt_compAdd.Clear(); txt_leadT.Clear(); loadtabletodatagridview(); } }
private void button1_Click(object sender, EventArgs e) { string prodname = txt_prodname.Text + cb_netwt.Text; string price = txt_Price.Text; string pp = txt_perpiece.Text; string prodline = cb_ProdLine.Text; string unit = cb_unit.Text; double mrkup = Convert.ToDouble(nud_markUp.Value); string mrkupt = mrkup.ToString(); string supp = cb_supplier.Text; if (txt_prodname.Text == "" || cb_ProdLine.Text == "" || cb_unit.Text == "" || cb_supplier.Text == "" || txt_Price.Text == "") { Invalid inv = new Invalid(); inv.Show(); } else { try { bcodesn = txt_prodname.Text + cb_netwt.Text; con.Open(); sda = new SqlDataAdapter("INSERT INTO product_tbl (Product_Name, ProductLineID, UnitID, SupplierID, warehouse_quantity, store_quantity, Mark_Up, Price, Price_per_piece)" + "values ('" + prodname + "',(Select ProductLineID from productline_tbl where Product_Line = '" + prodline + "'),(Select UnitID from unit_tbl where Unit_Description = '" + unit + "'),(Select SupplierID from supplier_tbl where Supplier_Name = '" + supp + "'), '" + "0" + "', '" + "0" + "', '" + mrkupt + "', '" + price + "', '" + pp + "')", con); DataTable dt = new DataTable(); sda.Fill(dt); con.Close(); BarcodeSerialNumber bcsn = new BarcodeSerialNumber(); bcsn.MdiParent = this.ParentForm; bcsn.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } txt_prodID.Clear(); txt_prodname.Clear(); cb_netwt.ResetText(); cb_ProdLine.ResetText(); cb_unit.ResetText(); cb_supplier.ResetText(); txt_Price.Clear(); txt_perpiece.Clear(); loadtabletodatagridview(); } }