public List <CheckStatusViewModel> GetAllRejectedAppointment()
        {
            string     query = @"SELECT a.Id, a.PatientId,a.ScheduleId, convert(varchar, a.Date) as date,a.StartTime,a.EndTime,a.Status,p.DoctorName,s.SpecialityName
                            FROM [dbo].[Appointment] a inner join [dbo].[DrRegistration] p on a.DoctorId=p.Id
                            inner join [dbo].[Speciality]  s on s.Id=p.SpecialityId
                            where Status='Reject'";
            SqlCommand cmd   = new SqlCommand(query, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            List <CheckStatusViewModel> alList = new List <CheckStatusViewModel>();

            while (reader.Read())
            {
                CheckStatusViewModel appointment = new CheckStatusViewModel();
                appointment.AppointmentId   = (int)reader["Id"];
                appointment.PatientId       = (int)reader["PatientId"];
                appointment.ScheduleId      = (int)reader["ScheduleId"];
                appointment.DoctorName      = reader["DoctorName"].ToString();
                appointment.Speciality      = reader["SpecialityName"].ToString();
                appointment.AppointmentDate = reader["date"].ToString();
                appointment.StartTime       = reader["StartTime"].ToString();
                appointment.EndTime         = reader["EndTime"].ToString();
                appointment.Status          = reader["Status"].ToString();
                alList.Add(appointment);
            }
            reader.Close();
            con.Close();
            return(alList);
        }
        public List <CheckStatusViewModel> GetsubmitedEmail(int appointmentId)
        {
            string     query = @"select convert(varchar, a.Date,101) as date,a.StartTime,a.EndTime,p.PatientName,p.Email
                            from [dbo].[PtRegistration] p
                            inner join [dbo].[Appointment] a on p.Id=a.PatientId
                            where p.Id='" + appointmentId + "'";
            SqlCommand cmd   = new SqlCommand(query, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            List <CheckStatusViewModel> alList = new List <CheckStatusViewModel>();

            while (reader.Read())
            {
                CheckStatusViewModel appointment = new CheckStatusViewModel();
                appointment.PatientName     = reader["PatientName"].ToString();
                appointment.AppointmentDate = reader["date"].ToString();
                appointment.StartTime       = reader["StartTime"].ToString();
                appointment.EndTime         = reader["EndTime"].ToString();
                appointment.PatientEmail    = reader["Email"].ToString();
                alList.Add(appointment);
            }
            reader.Close();
            con.Close();
            return(alList);
        }
        public List <CheckStatusViewModel> GetAppointmentById(int id)
        {
            string     query = @"SELECT CONVERT(varchar, a.Date, 101) as Date ,a.StartTime,a.EndTime,a.Status,p.DoctorName,s.SpecialityName
FROM [dbo].[Appointment] a inner join [dbo].[DrRegistration] p on a.DoctorId=p.Id
inner join [dbo].[Speciality]  s on s.Id=p.SpecialityId
                   where a.PatientId='" + id + "'";
            SqlCommand cmd   = new SqlCommand(query, con);

            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            List <CheckStatusViewModel> alList = new List <CheckStatusViewModel>();

            while (reader.Read())
            {
                CheckStatusViewModel appointment = new CheckStatusViewModel();
                appointment.DoctorName      = reader["DoctorName"].ToString();
                appointment.Speciality      = reader["SpecialityName"].ToString();
                appointment.AppointmentDate = (reader["Date"]).ToString();
                appointment.StartTime       = reader["StartTime"].ToString();
                appointment.EndTime         = reader["EndTime"].ToString();
                appointment.Status          = reader["Status"].ToString();
                alList.Add(appointment);
            }
            reader.Close();
            con.Close();
            return(alList);
        }