private void lblSup_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            this.Hide();
            Supplier_Form sp = new Supplier_Form();

            sp.ShowDialog();
        }
Exemplo n.º 2
0
 private void txtSupplier_Leave(object sender, EventArgs e)
 {
     if (txtSupplier.Text == "")
     {
         MessageBox.Show("Supplier Name Missing", "Pharmacy System");
         txtSupplier.Focus();
     }
     else
     {
         try
         {
             con.Open();
             SqlCommand    cmd   = new SqlCommand("Select SName from tblSupplier where SName='" + txtSupplier.Text + "'", con);
             SqlDataReader rd    = cmd.ExecuteReader();
             int           count = 0;
             while (rd.Read())
             {
                 count++;
             }
             con.Close();
             if (count >= 1)
             {
                 supplier(1);
             }
             else
             {
                 supplier(0);
                 DialogResult dia = MessageBox.Show("The Supplier with the supplied name is not in the database, do you wish to save?", "Pharmacy System", MessageBoxButtons.YesNo);
                 if (dia == DialogResult.Yes)
                 {
                     Supplier_Form sp = new Supplier_Form();
                     sp.ShowDialog();
                 }
                 else if (dia == DialogResult.No)
                 {
                     MessageBox.Show("Kindly Correct The Name Before Proceding", "Pharmacy System");
                 }
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
             con.Close();
         }
     }
 }