Пример #1
0
        public IEnumerable <Doctor> GetDoctorByClinic(int id, string floor)
        {
            string f = "";

            List <Int32> listInt = new List <int>();

            if (floor == "الدور الأرضي")
            {
                f = "DoctorsVIEW";
            }

            else if (floor == "الدور الأول")
            {
                f = "DoctorsVIEW1";
            }

            List <Doctor> list = new List <Doctor>();

            string CommandText = $"SELECT [Name], [code] FROM [ALDar_Hospital].[dbo].[{f}] Where [Spec] = cast({id} as varchar(50)) ORDER BY [code]";

            string Commandbool = $"SELECT ISNULL([isClinicOpen], 0) as OnDuty FROM [ALDar_Hospital].[dbo].[Doctors] Where [DoctorSpecialtyID] = cast({id} as varchar(50)) ORDER BY [code]";

            DataTable DataTable01 = connect.Command(Commandbool, "Doctors");

            List <DataRow> row01 = new List <DataRow>();

            foreach (DataRow r in DataTable01.Rows)
            {
                listInt.Add(Convert.ToInt32(r["OnDuty"]));
            }

            DataTable myDataTable = connect.Command(CommandText, "DoctorsVIEW");

            List <DataRow> rows = new List <DataRow>();

            for (int i = 0; i < myDataTable.Rows.Count; i++)
            {
                list.Add(new Doctor
                {
                    Name   = myDataTable.Rows[i]["Name"].ToString(),
                    Code   = (myDataTable.Rows[i]["code"]).ToString(),
                    status = (listInt[i] == 1) ? true : false
                });
            }

            return(list);
        }
Пример #2
0
        public Clinic Get(int spec)
        {
            Clinic clinic = new Clinic();

            string CommandText = "SELECT [ID], [ArbName],[Remarks] FROM [ALDar_Hospital].[dbo].[DoctorsSpecialties] where [REMARKS] IS NOT NULL AND [ID] = " + spec;

            DataTable myDataTable = connect.Command(CommandText, "DoctorsSpecialties");

            List <DataRow> rows = new List <DataRow>();

            foreach (DataRow row in myDataTable.Rows)
            {
                clinic.Speciality = Convert.ToInt32(row["ID"]);
                clinic.Name       = row["ArbName"].ToString();
                clinic.Floor      = Convert.ToInt32(row["Remarks"]);
            }

            return(clinic);
        }