示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string test1        = test.Text;
            string requiredDate = rDate.Value.ToShortDateString();


            if (test1.Trim() != string.Empty)
            {
                if (test1.Equals("Test 4") || test1.Equals("Ionized Calcium") || test1.Equals("Serum Ferritin") || test1.Equals("Vitamine B12-Serum") || test1.Equals("Thyroid Profile") || test1.Equals("Lipid Profile") || test1.Equals("Urine protein ratio"))
                {
                    reportNumber = "R" + primaryKey.RandomString(6);
                    this.allTests.Rows.Add(reportNumber, test1, requiredDate);
                    int index = test.SelectedIndex;
                    test.Items.RemoveAt(index);

                    //****add data to an array***//
                    global.reportStruct details = new global.reportStruct();
                    details.stReportNumber = reportNumber;
                    details.stRequiredDate = requiredDate;
                    details.stTest         = test1;

                    reportList.Add(details);
                }
                else
                {
                    MessageBox.Show("Enter valid Test!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Empty Test Field!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void guna2Button2_Click(object sender, EventArgs e)
        {
            string test1        = test.Text;
            string requiredDate = rDate.Value.ToShortDateString();

            test.Text = "";

            if (test1.Trim() != string.Empty)
            {
                string price1 = "0";
                try
                {
                    DBconnection ob = new DBconnection();
                    price1     = ob.getprice(test1).ToString();
                    totalPrice = totalPrice + ob.getprice(test1);
                    total.Text = totalPrice.ToString();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Get Price Error \n" + ex);
                }


                if (test1.Equals("Test 4") || test1.Equals("Ionized Calcium") || test1.Equals("Serum Ferritin") || test1.Equals("Vitamine B12-Serum") || test1.Equals("Thyroid Profile") || test1.Equals("Lipid Profile") || test1.Equals("Urine protein ratio"))
                {
                    reportNumber = "R" + primaryKey.RandomString(6);
                    this.allTests.Rows.Add(reportNumber, test1, requiredDate, price1);
                    int index = test.SelectedIndex;
                    test.Items.RemoveAt(index);


                    //****add data to an array***//
                    global.reportStruct details = new global.reportStruct();
                    details.stReportNumber = reportNumber;
                    details.stRequiredDate = requiredDate;
                    details.stTest         = test1;
                    details.price          = price1;

                    reportList.Add(details);
                }
                else
                {
                    MessageBox.Show("Enter valid Test!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Empty Test Field!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }