Esempio n. 1
0
 public void AddDispatchReport(Dispatch_Report xDR)
 {
     DispatchReports.Add(xDR);
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            double Bill;

            dis.SetStatus("Finished");

            dis.GetResponseTeam().SetStatusByDispatch("Available");


            // Existence checks
            if (txtHospital.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Enter Hospital", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtHospital.Focus();
                return;
            }
            else if (txtProcedureDetails.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Enter Procedure Details", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtHospital.Focus();
                return;
            }

            else if (txtBill.Text.Trim() == string.Empty)
            {
                MessageBox.Show("Enter Bill Amount", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtBill.Focus();
                return;
            }

            //Type Check
            if (double.TryParse(txtBill.Text, out Bill) == false)
            {
                MessageBox.Show("Enter a number for Fee.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);

                txtBill.Focus();
                return;
            }

            else // All checks are satisfied
            {
                txtHospital.Enabled         = false;
                txtProcedureDetails.Enabled = false;
                chkVital.Enabled            = false;
                txtBill.Enabled             = false;

                btnSubmit.Visible = false;

                Dispatch_Report DispatchReport = new Dispatch_Report();

                DispatchReport.SetHospital(txtHospital.Text);
                DispatchReport.SetProcedureDetail(txtProcedureDetails.Text);
                DispatchReport.SetVitalSign(chkVital.Checked);
                DispatchReport.SetBill(double.Parse(txtBill.Text));


                DispatchReports.AddItem(DispatchReport);

                SendStatusUpdate(true, "Report Saved!", "success");
            }
        }