Ejemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageBox.Show("Are you sure to save this Vandor?", "Save Product", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             //Saving Product
             cn.Open();
             cm = new SqlCommand("INSERT INTo tblVendor(vendor, address, contactperson, telephone, email, fax)VALUES(@vendor, @address, @contactperson, @telephone, @email, @fax)", cn);
             cm.Parameters.AddWithValue("@vendor", txtVendor.Text);
             cm.Parameters.AddWithValue("@address", txtAddress.Text);
             cm.Parameters.AddWithValue("@contactperson", txtContactPerson.Text);
             cm.Parameters.AddWithValue("@telephone", txtVendor.Text);
             cm.Parameters.AddWithValue("@email", txtEmail.Text);
             cm.Parameters.AddWithValue("@fax", txtFax.Text);
             cm.ExecuteNonQuery();
             cn.Close();
             MessageBox.Show("Product has been successfully saved.", "Product Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
             clear();
             f.LoadVandors();
         }
     }
     catch (Exception ex)
     {
         cn.Close();
         MessageBox.Show(ex.Message);
     }
 }
Ejemplo n.º 2
0
        private void btnVendor_Click(object sender, EventArgs e)
        {
            ReferenceBtn.Enabled = true;
            ReferenceFrm.Close();
            btnVendor.Enabled = false;
            frmVendorList frm = new frmVendorList();

            ReferenceFrm = frm;
            ReferenceBtn = btnVendor;
            frm.TopLevel = false;
            frm.LoadVandors();
            MainPanel.Controls.Add(frm);
            frm.BringToFront();
            frm.Show();
        }