private void btnSave_Click(object sender, EventArgs e) { try { sup.sqlselect = "SELECT * From tblsupplier WHERE SupplierId=" + supplierid; sup.Single_Select(sup.sqlselect); if (sup.dt.Rows.Count > 0) { sup.sqledit = "UPDATE tblsupplier SET Supplier='" + txtSupplier.Text + "',ContactNo='" + txtContactNo.Text + "',Company='" + txtCompany.Text + "',CompanyAddress = '" + txtCompanyAddress.Text + "' WHERE SupplierId=" + supplierid; sup.SaveDataMsg(sup.sqledit, "Supplier has been updated in the database."); } else { sup.sqladd = "INSERT INTO tblsupplier (Supplier,ContactNo,Company,CompanyAddress) " + " VALUES ('" + txtSupplier.Text + "','" + txtContactNo.Text + "','" + txtCompany.Text + "','" + txtCompanyAddress.Text + "')"; sup.SaveDataMsg(sup.sqladd, "New Supplier has been saved in the database."); } frmSupplier_Load(sender, e); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { DateTime today = DateTime.Now; double price = double.Parse(txtPrice.Text.ToString()); int qty = int.Parse(txtQty.Text.ToString()); double tot; tot = price * qty; //pro.sql = "Select * From tblorder WHERE "; //pro.Single_Select(pro.sql); //if (pro.dt.Rows.Count > 0) //{ //} //else //{ pro.sqladd = "INSERT INTO tblorder (OrderDate,Barcode,OrderQty,OrderTotal,SupplierId,Rem) " + " VALUES ('" + today + "','" + txtBarcode.Text + "'," + txtQty.Text + ",'" + tot.ToString("n2") + "','" + comboBox1.SelectedValue + "','Ordered')"; pro.SaveDataMsg(pro.sqladd, "New order has been saved in the database."); //} frmPurchaseOrder_Load(sender, e); } catch (Exception ex) { } }
private void btnDelete_Click_1(object sender, EventArgs e) { pro.sql = "DELETE FROM tblproduct WHERE ProductId = '" + dtglist.CurrentRow.Cells[0].Value + "'"; pro.SaveDataMsg(pro.sql, "Product has been deleted in the database."); btnNew_Click_1(sender, e); }
private void btnDelete_Click(object sender, EventArgs e) { user.sql = "DELETE FROM tbluser WHERE UserId = " + dtgList.CurrentRow.Cells[0].Value; user.SaveDataMsg(user.sql, "User has been deleted in the database."); btnNew_Click(sender, e); }
private void btnDelete_Click(object sender, EventArgs e) { try { //SQLConfig config = new SQLConfig(); config.sql = "DELETE FROM tblcategory WHERE CategoryId=" + dtglist.CurrentRow.Cells[0].Value; config.SaveDataMsg(config.sql, "Category has been deleted in the database."); btnNew_Click(sender, e); } catch { } }
private void btnSave_Click(object sender, EventArgs e) { try { if (txtQty.Text != "") { DateTime today = DateTime.Now; double price = double.Parse(txtPrice.Text.ToString()); int qty = int.Parse(txtQty.Text.ToString()); double tot; tot = price * qty; //pro.sql = "Select * From tblorder WHERE "; //pro.Single_Select(pro.sql); //if (pro.dt.Rows.Count > 0) //{ //} //else //{ prolist.sqladd = "INSERT INTO tblorder (OrderDate,Barcode,OrderQty,OrderTotal,SupplierId,Rem) " + " VALUES ('" + today + "','" + txtBarcode.Text + "'," + txtQty.Text + ",'" + tot.ToString("n2") + "','" + comboBox1.SelectedValue + "','Ordered')"; prolist.SaveDataMsg(prolist.sqladd, "New order has been saved in the database."); //} LoadData(); } else { MessageBox.Show("Fields is required.", "Required", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { } }