Esempio n. 1
0
        public void Doctor_Update_UpdateDoctorInfo()
        {
            Doctor doctor = new Doctor("John", "john567", "567", "Physician");

            doctor.Save();

            doctor.Update("Tom", "tom567", "123", "Cardiology");

            Doctor controlDoctor = new Doctor("Tom", "tom567", "123", "Cardiology", doctor.Id);

            Assert.Equal(controlDoctor, doctor);
        }
Esempio n. 2
0
        private void ultraBtnSave_Click(object sender, EventArgs e)
        {
            objHospitalDB = new MyCompany.MyProject.Db.HospitalDB();
            Doctor    objDoctor    = new Doctor(objHospitalDB);
            DoctorRow objDoctorRow = new MyCompany.MyProject.Db.DoctorRow();

            objDoctorRow.FullName    = ultraTextFullName.Text;
            objDoctorRow.Phone       = ultraTextPhoneNumber.Text;
            objDoctorRow.Doc_Address = ultraTextAddress.Text;

            if (strFormMode == "NEW")
            {
                objDoctor.Insert(objDoctorRow);
            }
            else if (strFormMode == "EDIT")
            {
                objDoctorRow.Doctor_ID = Convert.ToInt32(ultraTextEditorID.Text);
            }

            objDoctor.Update(objDoctorRow);
            //string query = "insert into Doctor Values('" + ultraTextFullName.Text + "','" + ultraTextAddress.Text + "','" + ultraTextPhoneNumber.Text + "')";


            //SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-89LF16D;Initial Catalog=Hospital;Integrated Security=True");

            /* if (strFormMode == "NEW")
             * {
             *   try
             *   {
             *
             *       objHospitalDB = new HospitalDB();
             *       string query1 = "insert into Doctor Values('" + ultraTextFullName.Text + "','" + ultraTextAddress.Text + "','" + ultraTextPhoneNumber.Text + "')";
             *       SqlCommand cmd = objHospitalDB.CreateCommand(query1, false);
             *       //  cmd.Parameters.Add(new SqlParameter("@images", images));
             *       int p = cmd.ExecuteNonQuery();
             *
             *       MessageBox.Show(p.ToString() + "registerd");
             *       this.Close();
             *   }
             *   catch (Exception ex)
             *   {
             *       MessageBox.Show(ex.Message);
             *       if (objHospitalDB != null)
             *       {
             *           objHospitalDB.Dispose();
             *       }
             *   }
             * }
             * else
             * {
             *   try
             *   {
             *
             *       objHospitalDB = new HospitalDB();
             *       SqlCommand cmd = objHospitalDB.CreateCommand("update Doctor set FullName='" + ultraTextFullName.Text + "',Doc_Address='" + ultraTextAddress.Text + "',Phone='" + ultraTextPhoneNumber.Text + "' where Doctor_ID= '" + ultraTextEditorID.Text + "'",false);
             *       int o = cmd.ExecuteNonQuery();
             *
             *       MessageBox.Show(o + ":updated");
             *       this.Close();
             *   }
             *   catch (Exception ex)
             *   {
             *       MessageBox.Show(ex.Message);
             *       if (objHospitalDB != null)
             *       {
             *           objHospitalDB.Dispose();
             *       }
             *   }
             * }*/
        }