コード例 #1
0
ファイル: Form1.cs プロジェクト: TrustLRon/DoctorProcedures
        public static void GetDoctorsProcedures()
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                string queryString = "SELECT * FROM DoctorsProcedures";

                using (SqlCommand command = new SqlCommand(queryString, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {

                            DoctorsProcedure doctorProcedure = new DoctorsProcedure();

                            doctorProcedure.doctorName = (!reader.IsDBNull(reader.GetOrdinal("doctorName"))) ? reader.GetString(0) : "null";
                            doctorProcedure.doctorID = (!reader.IsDBNull(reader.GetOrdinal("doctorID"))) ? reader.GetString(1) : "null";
                            doctorProcedure.gloveSize = reader.GetDecimal(2);

                            doctorProcedure.procedureName = (!reader.IsDBNull(reader.GetOrdinal("procedureName"))) ? reader.GetString(3) : "null";
                            doctorProcedure.modality = (!reader.IsDBNull(reader.GetOrdinal("modality"))) ? reader.GetString(4) : "null";
                            doctorProcedure.patientOrientation = (!reader.IsDBNull(reader.GetOrdinal("patientOrientation"))) ? reader.GetString(5) : "null";
                            doctorProcedure.ifBilateral = (!reader.IsDBNull(reader.GetOrdinal("ifBilateral"))) ? reader.GetString(6) : "null";

                            doctorProcedure.syringes1mL = (!reader.IsDBNull(reader.GetOrdinal("syringes1mL"))) ? reader.GetDecimal(7) : 0;
                            doctorProcedure.syringes3mL = (!reader.IsDBNull(reader.GetOrdinal("syringes3mL"))) ? reader.GetDecimal(8) : 0;
                            doctorProcedure.syringes5mL = (!reader.IsDBNull(reader.GetOrdinal("syringes5mL"))) ? reader.GetDecimal(9) : 0;
                            doctorProcedure.syringes10mL = (!reader.IsDBNull(reader.GetOrdinal("syringes10mL"))) ? reader.GetDecimal(10) : 0;
                            doctorProcedure.needleDrawingUp = (!reader.IsDBNull(reader.GetOrdinal("needleDrawingUp"))) ? reader.GetDecimal(11) : 0;
                            doctorProcedure.needle25g = (!reader.IsDBNull(reader.GetOrdinal("needle25g"))) ? reader.GetDecimal(12) : 0;
                            doctorProcedure.needle19g = (!reader.IsDBNull(reader.GetOrdinal("needle19g"))) ? reader.GetDecimal(13) : 0;
                            doctorProcedure.needle22g50mm = (!reader.IsDBNull(reader.GetOrdinal("needle22g50mm"))) ? reader.GetDecimal(14) : 0;
                            doctorProcedure.needle22g90mm = (!reader.IsDBNull(reader.GetOrdinal("needle22g90mm"))) ? reader.GetDecimal(15) : 0;
                            doctorProcedure.contrast = (!reader.IsDBNull(reader.GetOrdinal("contrast"))) ? reader.GetString(16) : "null";

                            doctorProcedure.lignocaine = (!reader.IsDBNull(reader.GetOrdinal("lignocaine"))) ? reader.GetDecimal(17) : 0;
                            doctorProcedure.bupivacaine = (!reader.IsDBNull(reader.GetOrdinal("bupivacaine"))) ? reader.GetDecimal(18) : 0;
                            doctorProcedure.steroidType = (!reader.IsDBNull(reader.GetOrdinal("steroidType"))) ? reader.GetString(19) : "null";
                            doctorProcedure.steroidAmount = (!reader.IsDBNull(reader.GetOrdinal("steroidAmount"))) ? reader.GetDecimal(20) : 0;

                            doctorProcedure.otherEquipment = (!reader.IsDBNull(reader.GetOrdinal("otherEquipment"))) ? reader.GetString(21) : "null";
                            doctorProcedure.comments = (!reader.IsDBNull(reader.GetOrdinal("comments"))) ? reader.GetString(22) : "null";

                            DoctorProceduresList.Add(doctorProcedure);

                        }
                    }
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: TrustLRon/DoctorProcedures
        public static void GetDoctorsProcedures()
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                connection.Open();
                string queryString = "SELECT * FROM DoctorsProcedures";

                using (SqlCommand command = new SqlCommand(queryString, connection))
                {
                    using (SqlDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            DoctorsProcedure doctorProcedure = new DoctorsProcedure();

                            doctorProcedure.doctorName = (!reader.IsDBNull(reader.GetOrdinal("doctorName"))) ? reader.GetString(0) : "null";
                            doctorProcedure.doctorID   = (!reader.IsDBNull(reader.GetOrdinal("doctorID"))) ? reader.GetString(1) : "null";
                            doctorProcedure.gloveSize  = reader.GetDecimal(2);

                            doctorProcedure.procedureName      = (!reader.IsDBNull(reader.GetOrdinal("procedureName"))) ? reader.GetString(3) : "null";
                            doctorProcedure.modality           = (!reader.IsDBNull(reader.GetOrdinal("modality"))) ? reader.GetString(4) : "null";
                            doctorProcedure.patientOrientation = (!reader.IsDBNull(reader.GetOrdinal("patientOrientation"))) ? reader.GetString(5) : "null";
                            doctorProcedure.ifBilateral        = (!reader.IsDBNull(reader.GetOrdinal("ifBilateral"))) ? reader.GetString(6) : "null";

                            doctorProcedure.syringes1mL     = (!reader.IsDBNull(reader.GetOrdinal("syringes1mL"))) ? reader.GetDecimal(7) : 0;
                            doctorProcedure.syringes3mL     = (!reader.IsDBNull(reader.GetOrdinal("syringes3mL"))) ? reader.GetDecimal(8) : 0;
                            doctorProcedure.syringes5mL     = (!reader.IsDBNull(reader.GetOrdinal("syringes5mL"))) ? reader.GetDecimal(9) : 0;
                            doctorProcedure.syringes10mL    = (!reader.IsDBNull(reader.GetOrdinal("syringes10mL"))) ? reader.GetDecimal(10) : 0;
                            doctorProcedure.needleDrawingUp = (!reader.IsDBNull(reader.GetOrdinal("needleDrawingUp"))) ? reader.GetDecimal(11) : 0;
                            doctorProcedure.needle25g       = (!reader.IsDBNull(reader.GetOrdinal("needle25g"))) ? reader.GetDecimal(12) : 0;
                            doctorProcedure.needle19g       = (!reader.IsDBNull(reader.GetOrdinal("needle19g"))) ? reader.GetDecimal(13) : 0;
                            doctorProcedure.needle22g50mm   = (!reader.IsDBNull(reader.GetOrdinal("needle22g50mm"))) ? reader.GetDecimal(14) : 0;
                            doctorProcedure.needle22g90mm   = (!reader.IsDBNull(reader.GetOrdinal("needle22g90mm"))) ? reader.GetDecimal(15) : 0;
                            doctorProcedure.contrast        = (!reader.IsDBNull(reader.GetOrdinal("contrast"))) ? reader.GetString(16) : "null";

                            doctorProcedure.lignocaine    = (!reader.IsDBNull(reader.GetOrdinal("lignocaine"))) ? reader.GetDecimal(17) : 0;
                            doctorProcedure.bupivacaine   = (!reader.IsDBNull(reader.GetOrdinal("bupivacaine"))) ? reader.GetDecimal(18) : 0;
                            doctorProcedure.steroidType   = (!reader.IsDBNull(reader.GetOrdinal("steroidType"))) ? reader.GetString(19) : "null";
                            doctorProcedure.steroidAmount = (!reader.IsDBNull(reader.GetOrdinal("steroidAmount"))) ? reader.GetDecimal(20) : 0;

                            doctorProcedure.otherEquipment = (!reader.IsDBNull(reader.GetOrdinal("otherEquipment"))) ? reader.GetString(21) : "null";
                            doctorProcedure.comments       = (!reader.IsDBNull(reader.GetOrdinal("comments"))) ? reader.GetString(22) : "null";

                            DoctorProceduresList.Add(doctorProcedure);
                        }
                    }
                }
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 partial void DeleteDoctorsProcedure(DoctorsProcedure instance);
コード例 #6
0
 partial void UpdateDoctorsProcedure(DoctorsProcedure instance);
コード例 #7
0
 partial void InsertDoctorsProcedure(DoctorsProcedure instance);
コード例 #8
0
 partial void DeleteDoctorsProcedure(DoctorsProcedure instance);
コード例 #9
0
 partial void UpdateDoctorsProcedure(DoctorsProcedure instance);
コード例 #10
0
 partial void InsertDoctorsProcedure(DoctorsProcedure instance);