private void BtnUpdate_Click_1(object sender, EventArgs e) { try { if (MessageBox.Show("Are you sure you want to update this Supplier?", tiltlesataas, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { cn.Open(); cm = new SqlCommand("UPDATE tblSupplier Set supplier = @supplier, address = @address, phone = @phone, telephone = @telephone, lastupdate = @lastupdate WHERE id like '" + lblID.Text + "'", cn); cm.Parameters.AddWithValue("@supplier", txtSupplierName.Text); cm.Parameters.AddWithValue("@address", txtSupplierAddress.Text); cm.Parameters.AddWithValue("@phone", txtSupplierPhone.Text); cm.Parameters.AddWithValue("@telephone", txtSupplierTelephone.Text); cm.Parameters.AddWithValue("@lastupdate", DateTime.Now); cm.ExecuteNonQuery(); cn.Close(); MessageBox.Show("Record has been successfully Updated", tiltlesataas, MessageBoxButtons.OK, MessageBoxIcon.Information); suplist.ShowSuppliers(); this.Dispose(); } } catch (Exception ex) { cn.Close(); MessageBox.Show(ex.Message); } }
private void BtnSuppliers_Click(object sender, EventArgs e) { if (!AdminAdministrator.Instance.PnlContainer.Controls.ContainsKey("AdminSupplier")) { AdminSupplier supp = new AdminSupplier(); supp.Dock = DockStyle.Fill; AdminAdministrator.Instance.PnlContainer.Controls.Add(supp); supp.ShowSuppliers(); } AdminAdministrator.Instance.PnlContainer.Controls["AdminSupplier"].BringToFront(); AdminAdministrator.Instance.BackButton.Visible = true; }