public void FetchDoctorList()
    {
        DataSet dsDoctor;

        System.Data.SqlClient.SqlCommand cmdSelect = new System.Data.SqlClient.SqlCommand();

        gClass.MakeStoreProcedureName(ref cmdSelect, "sp_Doctors_LoadData", false);
        cmdSelect.Parameters.Add("@OrganizationCode", System.Data.SqlDbType.Int).Value = Convert.ToInt32(gClass.OrganizationCode);
        if (this.blnIsSurgeon.HasValue)
        {
            cmdSelect.Parameters.Add("@vblnIsSurgeon", System.Data.SqlDbType.Bit).Value = this.blnIsSurgeon.Value;
        }

        if (this.blnIsHide.HasValue)
        {
            cmdSelect.Parameters.Add("@vblnIsHide", System.Data.SqlDbType.Bit).Value = this.blnIsHide.Value;
        }
        dsDoctor = gClass.FetchData(cmdSelect, "tblSurgon");

        for (int Xh = 0; Xh < dsDoctor.Tables["tblSurgon"].Rows.Count; Xh++)
        {
            dsDoctor.Tables["tblSurgon"].Rows[Xh]["Doctor_Name"] = dsDoctor.Tables["tblSurgon"].Rows[Xh]["Doctor_Name"].ToString().Replace("`", "'");
        }
        dsDoctor.AcceptChanges();

        DoctorsList.DataSource     = dsDoctor;
        DoctorsList.DataMember     = "tblSurgon";
        DoctorsList.DataValueField = "DoctorID";
        DoctorsList.DataTextField  = "Doctor_Name";
        try { DoctorsList.DataBind(); }catch { }
        DoctorsList.Items.Insert(0, new ListItem("Select ...", "0"));
        return;
    }
Ejemplo n.º 2
0
 public void AddDoctor(string name, string surname)
 {
     if (!ContainsDoctor(name))
     {
         var doctor = new Doctor(name, surname);
         DoctorsList.Add(doctor);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Accepts Doctors object, batch delete row(s) from Doctors table
 ///
 /// return docID of deleted row(s)
 /// </summary>
 /// <param name="Doctors">Doctors object</param>
 /// <param name="sqlCmd">SqlCommand object</param>
 /// <returns>docID of deleted row(s)</returns>
 public static int Delete(DoctorsList objDoctorsList, SqlCommand sqlCmd)
 {
     try
     {
         foreach (Doctors item in objDoctorsList)
         {
             Delete(item, sqlCmd);
         }
         return(objDoctorsList.Count);
     }
     catch (Exception ex) { throw ex; }
 }
        public void RemoveDr()
        {
            String       text   = "Do You Want To Remove " + ListSelectedDoctor.Value + " ?";
            DialogResult answer = System.Windows.Forms.MessageBox.Show(text, "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (answer == DialogResult.Yes)
            {
                DoctorsComboBox.Add(new ComboBoxPairs(ListSelectedDoctor.Key, ListSelectedDoctor.Value));
                Hospital.Patients[PatientID].removeDoctor(ListSelectedDoctor.Key);
                ((Doctor)Hospital.Employees[ListSelectedDoctor.Key]).Patients.Remove(PatientID);
                HospitalDB.DeleteDoctorPatient(ListSelectedDoctor.Key, PatientID);
                DoctorsList.Remove(ListSelectedDoctor);
                DoctorsNumber = "Doctors: " + Hospital.Patients[PatientID].Doctors.Count().ToString();
            }
        }
        public void AssignDoctor()
        {
            DoctorsList.Add(new ComboBoxPairs(DoctorComboBox.Key, DoctorComboBox.Value));
            foreach (Doctor doctor in Hospital.Employees.Values)
            {
                if (doctor.ID == DoctorComboBox.Key)
                {
                    Hospital.Patients[PatientID].Doctors.Add(doctor.ID, doctor);
                    HospitalDB.InsertDoctorPatient(doctor.ID, PatientID);
                    DoctorsNumber = "Doctors: " + Hospital.Patients[PatientID].Doctors.Count().ToString();
                    break;
                }
            }
            ((Doctor)Hospital.Employees[DoctorComboBox.Key]).Patients.Add(PatientID, Hospital.Patients[PatientID]);
            DoctorsComboBox.Remove(DoctorComboBox);

            Home.ViewModel.CloseRootDialog();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Accepts Doctors object, batch delete row(s) from Doctors table
        ///
        /// return docID of deleted row(s)
        /// </summary>
        /// <param name="Doctors">Doctors object</param>
        /// <returns>docID of deleted row(s)</returns>
        public static int Delete(DoctorsList objDoctorsList)
        {
            SqlCommand sqlCmd = new SqlCommand(Doctors_Delete, SqlHelper.DefaultSqlConnection);

            try
            {
                sqlCmd.Connection.Open();
                sqlCmd.Transaction = sqlCmd.Connection.BeginTransaction();
                Delete(objDoctorsList, sqlCmd);
                sqlCmd.Transaction.Commit();
                return(objDoctorsList.Count);
            }
            catch (Exception ex)
            {
                sqlCmd.Transaction.Rollback();
                throw ex;
            }
            finally { sqlCmd.Connection.Close(); }
        }
Ejemplo n.º 7
0
        //Submit Add Form
        protected void AddDoctorButton_Click(object sender, EventArgs e)
        {
            Button btn   = (Button)sender;
            String btnId = btn.ID;

            if (btnId.Equals("AddDoctorButton"))
            {
                if (IsValid)
                {
                    System.Threading.Thread.Sleep(3000);
                    var name     = NameTextBox.Text;
                    var gender   = GenderRadioButtonList1.SelectedItem.Value;
                    var genderId = long.Parse(gender);
                    var dob      = Convert.ToDateTime(DOBTextBox.Text);
                    var address  = AddressTextBox.Text;
                    var license  = LicenseTextBox.Text;

                    var doctor = new Doctor()
                    {
                        doctorName = name, genderId = genderId, dob = dob, address = address, license = license
                    };
                    _dataContext.Doctors.InsertOnSubmit(doctor);
                    _dataContext.SubmitChanges();
                    DoctorsList.DataBind();

                    ResetInputField();

                    //Use For checking Data
                    //Debug.WriteLine("name: " + name);
                    //Debug.WriteLine("gender: " + gender);
                    //Debug.WriteLine("dob: " + dob);
                    //Debug.WriteLine("address: " + address);
                    //Debug.WriteLine("license: " + license);
                }
                else if (btnId.Equals("ResetDoctorButton"))
                {
                    ResetInputField();
                }
            }
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Accepts DoctorsList object, batch updated row(s) into Doctors table
 ///
 /// return docID of updated row(s)
 /// </summary>
 /// <param name="Doctors">Doctors object</param>
 /// <param name="sqlCmd">SqlCommand object</param>
 /// <returns>docID of updated row(s)</returns>
 public static int Update(DoctorsList objDoctorsList, SqlCommand sqlCmd)
 {
     try
     {
         foreach (Doctors item in objDoctorsList)
         {
             if (item.docID == 0)
             {
                 item.docID = Insert(item, sqlCmd);
             }
             else if (item.docID > 0)
             {
                 Update(item, sqlCmd);
             }
             else
             {
                 throw new InvalidOperationException("Doctors object was not in specified format");
             }
         }
         return(objDoctorsList.Count);
     }
     catch (Exception ex) { throw ex; }
 }
Ejemplo n.º 9
0
 public Doctor GetDoctorInList(string doctorName)
 {
     return(DoctorsList.FirstOrDefault(x => x.Fullname == doctorName));
 }
Ejemplo n.º 10
0
 public bool ContainsDoctor(string doctorName)
 {
     return(DoctorsList.Any(x => x.Name == doctorName));
 }