Example #1
0
        private void initializeTestsListView()
        {
            this.listViewTests.FullRowSelect = true;
            this.listViewTests.Columns.Add("Code", 100);
            this.listViewTests.Columns.Add("Name", 400);

            if (this.orderSubmitted)
            {
                foreach (LabTest test in LabTestHelpers.GetTestsFromOrder(this.order.OrderId))
                {
                    this.addRowToTestsListView(test.Code, test.Name);
                }
            }
        }
Example #2
0
        private void buttonSubmitOrder_Click(object sender, EventArgs e)
        {
            if (this.listViewTests.Items.Count > 0)
            {
                DialogResult okToProceed = MessageBox.Show("After submitting an order, you will NOT be able to edit it!", "Please confirm you would like to continue", MessageBoxButtons.YesNo);

                if (okToProceed == DialogResult.Yes)
                {
                    if (LabTestOrderDAL.HasTestOrder(this.patientId, this.visitDateTime))
                    {
                        MessageBox.Show("A test order has already been placed for this visit");
                        return;
                    }

                    List <int> testCodes = new List <int>();

                    foreach (ListViewItem item in this.listViewTests.Items)
                    {
                        int code = int.Parse(item.Tag.ToString());
                        testCodes.Add(code);
                    }

                    int orderId = LabTestHelpers.CreateTestOrder(this.patientId, this.visitDateTime, testCodes);

                    if (orderId == -1)
                    {
                        MessageBox.Show("Creating test order failed");
                    }
                    else
                    {
                        this.switchMode(true);
                        LabTestOrder order = new LabTestOrder(orderId, this.patientId, this.visitDateTime);
                        this.order = order;
                    }
                }
            }
            else
            {
                MessageBox.Show("Please add at least one test to the order");
            }
        }