Example #1
0
        public bool ConditionDeleteOffice()
        {
            IEnumerable <ClassTerm> query =
                from elem in ClassSqlCalendar.ListOfTerms()
                where elem.Office.OfficeId == ((ClassOffice)DataGridListOfOffice.SelectedItem).OfficeId
                select elem;

            if (query.Any())
            {
                string data = "This office cannot be removed because at this days meetings are being hosted in said of it: \n";
                foreach (ClassTerm queryResult in query)
                {
                    data += queryResult.Date.ToShortDateString() + "\n";
                }
                MessageBox.Show(data);
                return(false);
            }

            IEnumerable <ClassDoctor> query2 =
                from elem in ClassSQLConnections.DoctorList()
                where elem.OfficeNumber == ((ClassOffice)DataGridListOfOffice.SelectedItem).OfficeId
                select elem;

            if (query2.Any())
            {
                MessageBox.Show("This Office is currently occupied by " + query2.First().Name + " " + query2.First().Surname);
                return(false);
            }
            return(true);
        }
Example #2
0
 private void LoadDataToDataGrid()
 {
     //Load data to DataGrid
     try
     {
         DataGridListOfDoctors.ItemsSource = ClassSQLConnections.DoctorList();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + "\n Try again later", "Error");
     }
 }
        private static List <ClassDoctor> ListOfActiveDoctors()
        {
            List <ClassDoctor> allDoctorList = ClassSQLConnections.DoctorList();
            List <ClassDoctor> DoctorList    = new List <ClassDoctor>();

            foreach (ClassDoctor item in allDoctorList)
            {
                if (item.Active == true)
                {
                    DoctorList.Add(item);
                }
            }
            return(DoctorList);
        }
 public List <ClassDoctor> DoctorList()
 {
     return(ClassSQLConnections.DoctorList());
 }