示例#1
0
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            BloodDonerController.InsertDonateInfo(u);
            BloodStckController.UpdateStock(ResisterController.GetInfo(u.Info_Id));
            MessageBox.Show("Thank you for your donation", "Message");
            //buttonBack.PerformClick();
            this.Hide();
            RegisteredMember f1 = new RegisteredMember(u);

            f1.Show();
        }
        private void ReqClicked(object sender, EventArgs e)
        {
            string errors = "";

            errors += comboBoxBloodGroup.SelectedItem == null ? "\nPlease Provide Blood Group\n" : "";
            errors += textBoxQuantity.Text.Length == 0 ? "Please Provide Quantity\n" : "";
            if (textBoxQuantity.Text.Length != 0)
            {
                errors += Int32.Parse(textBoxQuantity.Text) < 0 ? "Quantity can not be negetive\n" : "";
            }



            if (errors == "")
            {
                string user = u.Username;
                string reqtype;
                int    quantity   = Int32.Parse(textBoxQuantity.Text);
                string membertype = "Registered";
                string bloodgroup = comboBoxBloodGroup.SelectedItem.ToString();
                var    result     = BloodStckController.CheckRequest(bloodgroup, quantity);
                if (result != 0)
                {
                    textBoxQuantity.Text = null;
                    reqtype = "Accepted";
                    MessageBox.Show("Request Accepted. \n" + "Your service charge is : " + quantity * 50, "Success");
                }
                else
                {
                    textBoxQuantity.Text = null;
                    reqtype = "Rejected";
                    MessageBox.Show("Request Rejected", "Failed");
                }
                RequestController.InsertRequest(user, membertype, reqtype, bloodgroup, quantity);
            }
            else
            {
                MessageBox.Show(errors, "Filled the flowing!");
                return;
            }
        }
示例#3
0
        private void BloodStockFormLoad(object sender, EventArgs e)
        {
            var bloodstock = BloodStckController.GetAllBloodGroup();

            dataGridViewStock.DataSource = bloodstock;
        }