示例#1
0
        private void submitEditDoctorButton_Click(object sender, EventArgs e)
        {
            try
            {
                DoctorProcedureClassDataContext editDocSetupContext = new DoctorProcedureClassDataContext();
                DataClasses1DataContext         editDocContext      = new DataClasses1DataContext();

                var doctorSetups = (from setups in editDocSetupContext.DoctorsProcedures
                                    where setups.doctorName == oldDoctorName.Text
                                    select setups);

                var doctor = (from docs in editDocContext.Doctors
                              where docs.doctorName == oldDoctorName.Text
                              select docs).First();

                if (!String.IsNullOrWhiteSpace(newDoctorName.Text) &&
                    !String.IsNullOrWhiteSpace(newInitials.Text) &&
                    !String.IsNullOrWhiteSpace(newGloves.Text))
                {
                    foreach (DoctorsProcedure setup in doctorSetups)
                    {
                        setup.doctorName = newDoctorName.Text;
                        setup.gloveSize  = Decimal.Parse(newGloves.Text);
                    }

                    doctor.doctorName = newDoctorName.Text;
                    doctor.gloveSize  = Decimal.Parse(newGloves.Text);

                    editDocSetupContext.SubmitChanges();
                    editDocContext.SubmitChanges();
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;

                    MessageBox.Show("Updated", "Setup",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Please fill out all data", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch
            {
                MessageBox.Show("Something went wrong, try again", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#2
0
        private void submitEditDoctorButton_Click(object sender, EventArgs e)
        {
            try
            {
                DoctorProcedureClassDataContext editDocSetupContext = new DoctorProcedureClassDataContext();
                DataClasses1DataContext editDocContext = new DataClasses1DataContext();

                var doctorSetups = (from setups in editDocSetupContext.DoctorsProcedures
                                    where setups.doctorName == oldDoctorName.Text
                                    select setups);

                var doctor = (from docs in editDocContext.Doctors
                              where docs.doctorName == oldDoctorName.Text
                              select docs).First();

                if (!String.IsNullOrWhiteSpace(newDoctorName.Text) &&
                    !String.IsNullOrWhiteSpace(newInitials.Text) &&
                    !String.IsNullOrWhiteSpace(newGloves.Text))
                {
                    foreach (DoctorsProcedure setup in doctorSetups)
                    {
                        setup.doctorName = newDoctorName.Text;
                        setup.gloveSize = Decimal.Parse(newGloves.Text);
                    }

                    doctor.doctorName = newDoctorName.Text;
                    doctor.gloveSize = Decimal.Parse(newGloves.Text);

                    editDocSetupContext.SubmitChanges();
                    editDocContext.SubmitChanges();
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;

                    MessageBox.Show("Updated", "Setup",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Please fill out all data", "Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch
            {
                MessageBox.Show("Something went wrong, try again", "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void deleteButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?", "Delete",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                DoctorProcedureClassDataContext setupContext = new DoctorProcedureClassDataContext();

                if (!String.IsNullOrEmpty(procedureBox.Text) &&
                    !String.IsNullOrEmpty(doctorBox.Text))
                {
                    var setup = (from docset in setupContext.DoctorsProcedures
                                 where docset.procedureName == procedureBox.Text &&
                                 docset.doctorName == doctorBox.Text
                                 select docset).First();
                    setupContext.DoctorsProcedures.DeleteOnSubmit(setup);

                    setupContext.SubmitChanges();
                    clearInfo();
                    Form1.DoctorProceduresList.Clear();
                    Form1.GetDoctorsProcedures();

                    MessageBox.Show("Entry Deleted", "Delete",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Please select a doctor and procedure...", "Error",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (result == DialogResult.No)
            {
                MessageBox.Show("No Changes Made", "Delete",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void submitButton_Click(object sender, EventArgs e)
        {
            DoctorProcedureClassDataContext setupContext  = new DoctorProcedureClassDataContext();
            DataClasses1DataContext         doctorContext = new DataClasses1DataContext();

            try
            {
                var checkDB = (from setupCheck in setupContext.DoctorsProcedures
                               where setupCheck.doctorName == doctorBox.Text &&
                               setupCheck.procedureName == procedureBox.Text
                               select setupCheck).Any();

                var doctor = (from initials in doctorContext.Doctors
                              where initials.doctorName == doctorBox.Text
                              select initials).First();

                if (checkDB == true)
                {
                    var doctorSetup = (from setupCheck in setupContext.DoctorsProcedures
                                       where setupCheck.doctorName == doctorBox.Text &&
                                       setupCheck.procedureName == procedureBox.Text
                                       select setupCheck).First();

                    doctorSetup.doctorName         = doctorBox.Text;
                    doctorSetup.doctorID           = doctor.doctorID;
                    doctorSetup.gloveSize          = doctor.gloveSize;
                    doctorSetup.procedureName      = procedureBox.Text;
                    doctorSetup.modality           = modalityBox.Text;
                    doctorSetup.patientOrientation = patientOrientationBox.Text;
                    doctorSetup.ifBilateral        = ifBilateralBox.Text;
                    doctorSetup.syringes1mL        = Decimal.Parse(syringes1mLBox.Text);
                    doctorSetup.syringes3mL        = Decimal.Parse(syringes3mLBox.Text);
                    doctorSetup.syringes5mL        = Decimal.Parse(syringes5mLBox.Text);
                    doctorSetup.syringes10mL       = Decimal.Parse(syringes10mLBox.Text);
                    doctorSetup.needleDrawingUp    = Decimal.Parse(needleDrawingUpBox.Text);
                    doctorSetup.needle25g          = Decimal.Parse(needle25gBox.Text);
                    doctorSetup.needle19g          = Decimal.Parse(needle19gBox.Text);
                    doctorSetup.needle22g50mm      = Decimal.Parse(needle22g50mmBox.Text);
                    doctorSetup.needle22g90mm      = Decimal.Parse(needle22g90mmBox.Text);
                    doctorSetup.contrast           = contrastBox.Text;
                    doctorSetup.lignocaine         = Decimal.Parse(lignocaineBox.Text);
                    doctorSetup.bupivacaine        = Decimal.Parse(bupivacaineBox.Text);
                    doctorSetup.steroidType        = steroidTypeBox.Text;
                    doctorSetup.steroidAmount      = Decimal.Parse(steroidAmountBox.Text);
                    doctorSetup.otherEquipment     = otherEquipmentBox.Text;
                    doctorSetup.comments           = commentsBox.Text;

                    setupContext.SubmitChanges();
                    Form1.DoctorProceduresList.Clear();
                    Form1.GetDoctorsProcedures();

                    MessageBox.Show("Updated", "Setup",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    DoctorsProcedure setup = new DoctorsProcedure();
                    try
                    {
                        setup.doctorName         = doctorBox.Text;
                        setup.doctorID           = doctor.doctorID;
                        setup.gloveSize          = doctor.gloveSize;
                        setup.procedureName      = procedureBox.Text;
                        setup.modality           = modalityBox.Text;
                        setup.patientOrientation = patientOrientationBox.Text;
                        setup.ifBilateral        = ifBilateralBox.Text;
                        setup.syringes1mL        = Decimal.Parse(syringes1mLBox.Text);
                        setup.syringes3mL        = Decimal.Parse(syringes3mLBox.Text);
                        setup.syringes5mL        = Decimal.Parse(syringes5mLBox.Text);
                        setup.syringes10mL       = Decimal.Parse(syringes10mLBox.Text);
                        setup.needleDrawingUp    = Decimal.Parse(needleDrawingUpBox.Text);
                        setup.needle25g          = Decimal.Parse(needle25gBox.Text);
                        setup.needle19g          = Decimal.Parse(needle19gBox.Text);
                        setup.needle22g50mm      = Decimal.Parse(needle22g50mmBox.Text);
                        setup.needle22g90mm      = Decimal.Parse(needle22g90mmBox.Text);
                        setup.contrast           = contrastBox.Text;
                        setup.lignocaine         = Decimal.Parse(lignocaineBox.Text);
                        setup.bupivacaine        = Decimal.Parse(bupivacaineBox.Text);
                        setup.steroidType        = steroidTypeBox.Text;
                        setup.steroidAmount      = Decimal.Parse(steroidAmountBox.Text);
                        setup.otherEquipment     = otherEquipmentBox.Text;
                        setup.comments           = commentsBox.Text;

                        setupContext.DoctorsProcedures.InsertOnSubmit(setup);

                        setupContext.SubmitChanges();
                        Form1.DoctorProceduresList.Clear();
                        Form1.GetDoctorsProcedures();

                        MessageBox.Show("Added", "Setup",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch
                    {
                        MessageBox.Show("Please make sure all fields are filled out correctly...", "Error",
                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch
            {
                MessageBox.Show("Please select a doctor and procedure...", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void submitButton_Click(object sender, EventArgs e)
        {
            DoctorProcedureClassDataContext setupContext = new DoctorProcedureClassDataContext();
            DataClasses1DataContext doctorContext = new DataClasses1DataContext();

            try
            {
                var checkDB = (from setupCheck in setupContext.DoctorsProcedures
                               where setupCheck.doctorName == doctorBox.Text &&
                               setupCheck.procedureName == procedureBox.Text
                               select setupCheck).Any();

                var doctor = (from initials in doctorContext.Doctors
                                      where initials.doctorName == doctorBox.Text
                                      select initials).First();

                if (checkDB == true)
                {
                    var doctorSetup = (from setupCheck in setupContext.DoctorsProcedures
                                       where setupCheck.doctorName == doctorBox.Text &&
                                       setupCheck.procedureName == procedureBox.Text
                                       select setupCheck).First();

                    doctorSetup.doctorName = doctorBox.Text;
                    doctorSetup.doctorID = doctor.doctorID;
                    doctorSetup.gloveSize = doctor.gloveSize;
                    doctorSetup.procedureName = procedureBox.Text;
                    doctorSetup.modality = modalityBox.Text;
                    doctorSetup.patientOrientation = patientOrientationBox.Text;
                    doctorSetup.ifBilateral = ifBilateralBox.Text;
                    doctorSetup.syringes1mL = Decimal.Parse(syringes1mLBox.Text);
                    doctorSetup.syringes3mL = Decimal.Parse(syringes3mLBox.Text);
                    doctorSetup.syringes5mL = Decimal.Parse(syringes5mLBox.Text);
                    doctorSetup.syringes10mL = Decimal.Parse(syringes10mLBox.Text);
                    doctorSetup.needleDrawingUp = Decimal.Parse(needleDrawingUpBox.Text);
                    doctorSetup.needle25g = Decimal.Parse(needle25gBox.Text);
                    doctorSetup.needle19g = Decimal.Parse(needle19gBox.Text);
                    doctorSetup.needle22g50mm = Decimal.Parse(needle22g50mmBox.Text);
                    doctorSetup.needle22g90mm = Decimal.Parse(needle22g90mmBox.Text);
                    doctorSetup.contrast = contrastBox.Text;
                    doctorSetup.lignocaine = Decimal.Parse(lignocaineBox.Text);
                    doctorSetup.bupivacaine = Decimal.Parse(bupivacaineBox.Text);
                    doctorSetup.steroidType = steroidTypeBox.Text;
                    doctorSetup.steroidAmount = Decimal.Parse(steroidAmountBox.Text);
                    doctorSetup.otherEquipment = otherEquipmentBox.Text;
                    doctorSetup.comments = commentsBox.Text;

                    setupContext.SubmitChanges();
                    Form1.DoctorProceduresList.Clear();
                    Form1.GetDoctorsProcedures();

                    MessageBox.Show("Updated", "Setup",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    DoctorsProcedure setup = new DoctorsProcedure();
                    try
                    {
                        setup.doctorName = doctorBox.Text;
                        setup.doctorID = doctor.doctorID;
                        setup.gloveSize = doctor.gloveSize;
                        setup.procedureName = procedureBox.Text;
                        setup.modality = modalityBox.Text;
                        setup.patientOrientation = patientOrientationBox.Text;
                        setup.ifBilateral = ifBilateralBox.Text;
                        setup.syringes1mL = Decimal.Parse(syringes1mLBox.Text);
                        setup.syringes3mL = Decimal.Parse(syringes3mLBox.Text);
                        setup.syringes5mL = Decimal.Parse(syringes5mLBox.Text);
                        setup.syringes10mL = Decimal.Parse(syringes10mLBox.Text);
                        setup.needleDrawingUp = Decimal.Parse(needleDrawingUpBox.Text);
                        setup.needle25g = Decimal.Parse(needle25gBox.Text);
                        setup.needle19g = Decimal.Parse(needle19gBox.Text);
                        setup.needle22g50mm = Decimal.Parse(needle22g50mmBox.Text);
                        setup.needle22g90mm = Decimal.Parse(needle22g90mmBox.Text);
                        setup.contrast = contrastBox.Text;
                        setup.lignocaine = Decimal.Parse(lignocaineBox.Text);
                        setup.bupivacaine = Decimal.Parse(bupivacaineBox.Text);
                        setup.steroidType = steroidTypeBox.Text;
                        setup.steroidAmount = Decimal.Parse(steroidAmountBox.Text);
                        setup.otherEquipment = otherEquipmentBox.Text;
                        setup.comments = commentsBox.Text;

                        setupContext.DoctorsProcedures.InsertOnSubmit(setup);

                        setupContext.SubmitChanges();
                        Form1.DoctorProceduresList.Clear();
                        Form1.GetDoctorsProcedures();

                        MessageBox.Show("Added", "Setup",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch
                    {
                        MessageBox.Show("Please make sure all fields are filled out correctly...", "Error",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }

                }
            }
            catch
            {
                MessageBox.Show("Please select a doctor and procedure...", "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        private void deleteButton_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?", "Delete",
                MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (result == DialogResult.Yes)
            {
                DoctorProcedureClassDataContext setupContext = new DoctorProcedureClassDataContext();

                if (!String.IsNullOrEmpty(procedureBox.Text) &&
                    !String.IsNullOrEmpty(doctorBox.Text))
                {
                    var setup = (from docset in setupContext.DoctorsProcedures
                                     where docset.procedureName == procedureBox.Text &&
                                     docset.doctorName == doctorBox.Text
                                     select docset).First();
                    setupContext.DoctorsProcedures.DeleteOnSubmit(setup);

                    setupContext.SubmitChanges();
                    clearInfo();
                    Form1.DoctorProceduresList.Clear();
                    Form1.GetDoctorsProcedures();

                    MessageBox.Show("Entry Deleted", "Delete",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Please select a doctor and procedure...", "Error",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (result == DialogResult.No)
            {
                MessageBox.Show("No Changes Made", "Delete",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }