private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                int bloodbankId = int.Parse(textBox1.Text.ToString());


                Bloodbanks k = new Bloodbanks();



                int result = k.DeleteBloodbank(bloodbankId);
                if (result > 0)
                {
                    label2.Text = "Bloodbank deleted";
                }
                else
                {
                    label2.Text = "Bloodbank Not deleted";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
 private void LISTToolStripMenuItem3_Click(object sender, EventArgs e)
 {
     try
     {
         Bloodbanks n = new Bloodbanks();
         dgvStaff.DataSource = n.ListBloodbanks();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #3
0
 private void LISTToolStripMenuItem3_Click(object sender, EventArgs e)
 {
     try
     {
         Bloodbanks n = new Bloodbanks();
         dgvDonors.DataSource = n.ListBloodbanks();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                int    bloodbankId   = int.Parse(tb1.Text.ToString());
                int    addressId     = int.Parse(tb2.Text.ToString());
                string name          = tb3.Text;
                int    bankTelnumber = int.Parse(tb4.Text.ToString());



                Bloodbanks d = new Bloodbanks();


                d.BloodbankId   = bloodbankId;
                d.AddressId     = addressId;
                d.Name          = name;
                d.BankTelnumber = bankTelnumber;



                int result = d.AddBloodbank(d);
                if (result > 0)
                {
                    lblMessg.Text = "Bloodbank Added";
                    tb1.Text      = "";
                    tb2.Text      = "";
                    tb3.Text      = "";
                    tb4.Text      = "";
                }
                else
                {
                    lblMessg.Text = "Blood bank Not Added";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Bloodbanks s = new Bloodbanks();
                s.BloodbankId   = int.Parse(textBox1.Text.ToString());
                s.AddressId     = int.Parse(textBox2.Text.ToString());
                s.Name          = textBox3.Text.Trim();
                s.BankTelnumber = int.Parse(textBox4.Text.ToString());



                int result = s.UpdateBloodbank(s);
                if (result > 0)
                {
                    MessageBox.Show("Update successsfully.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }