Beispiel #1
0
 private void RequestButtonClick(object sender, EventArgs e)
 {
     if (textBoxQuantity.Text != null && comboBoxBloodGroup.SelectedItem != null)
     {
         string user = textBoxUsrname.Text;
         string reqtype;
         int    quantity   = Int32.Parse(textBoxQuantity.Text);
         string membertype = textBoxMemberStatus.Text;
         string bloodgroup = comboBoxBloodGroup.SelectedItem.ToString();
         var    result     = BloodStockController.CheckRequest(bloodgroup, quantity);
         if (result != 0)
         {
             reqtype = "Accepted";
             MessageBox.Show("Request Accepted. \n" + "Your service charge is : " + quantity * 100, "Success");
         }
         else
         {
             reqtype = "Rejected";
             MessageBox.Show("Request Rejected", "Failed");
         }
         RequestController.InsertRequest(user, membertype, reqtype, bloodgroup, quantity);
         buttonBack.PerformClick();
     }
     else
     {
         MessageBox.Show("All information must be filled", "Alert");
     }
 }
Beispiel #2
0
        private void RequestButtonClick(object sender, EventArgs e)
        {
            string username = mem.Username;
            string memtype  = "Registered";
            int    quantity = Int32.Parse(textBoxQuantity.Text);
            string reqtype;
            string bloodgroup = comboBoxBloodGroup.SelectedItem.ToString();
            var    result     = BloodStockController.CheckRequest(bloodgroup, quantity);

            if (result != 0)
            {
                reqtype = "Accepted";
                MessageBox.Show("Request Accepted \n" + "Your service charge is : " + quantity * 50, "Success");
                comboBoxBloodGroup.Text = null;
                textBoxQuantity.Text    = null;
            }
            else
            {
                reqtype = "Rejected";
                MessageBox.Show("Request Rejected", "Failed");
                textBoxQuantity.Text = null;
            }
            RequestController.InsertRequest(username, memtype, reqtype, bloodgroup, quantity);
        }