Exemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                //prompts the user
                var confirmResult = MessageBox.Show("Are you sure you want to add this physician?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (confirmResult == DialogResult.Yes)
                {
                    //get the values
                    string fName      = txtFName.Text.Trim();
                    string mInit      = txtMInit.Text.Trim();
                    string lName      = txtLName.Text.Trim();
                    string office     = txtOffice.Text.Trim();
                    string phoneNum   = txtPhoneNum.Text.Trim();
                    int    licenseNum = int.Parse(txtLicenseNum.Text.Trim());

                    //Send it throug the datatier
                    PharmacyDataTier bPharm = new PharmacyDataTier();
                    DataSet          ds1    = new DataSet();
                    ds1 = bPharm.AddPhysicians(fName, mInit, lName, office, phoneNum, licenseNum);
                    MessageBox.Show("Physician succesfully added.", "Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }