Example #1
0
        public ActionResult Create1(int idee)
        {
            try
            {
                Hospital_request p = new Hospital_request();
                doctor_scedule   doctor_shedule = db.doctor_scedule.Find(idee);
                p.doctor_id           = doctor_shedule.doctor_id;
                p.Hospital_day        = doctor_shedule.hospial_day;
                p.patient_name        = ideee;
                p.Hospital_start_time = doctor_shedule.hospital_start_time;
                p.hospital_end_time   = doctor_shedule.hospital_end_time;

                db.Hospital_request.Add(p);

                db.SaveChanges();
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        // raise a new exception nesting
                        // the current instance as InnerException
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                throw raise;
            }
            return(RedirectToAction("Index1", "Clinic_request"));
        }
Example #2
0
        public ActionResult Create1(int idee, bookyourdoctor.Models.gmailsent model)
        {
            clinic_view    p = new clinic_view();
            Clinic_request clinic_request = db.Clinic_request.Find(idee);

            p.Clinic_day        = clinic_request.clinic_day;
            p.patient_name      = clinic_request.patient_name;
            p.clinic_start_time = clinic_request.clinic_start_time;
            p.clinic_end_time   = clinic_request.clinic_end_time;

            db.clinic_view.Add(p);
            db.SaveChanges();
            MailMessage mm = new MailMessage("*****@*****.**", ideee);//model.To ki jagah patient i

            mm.Subject    = "APPOINTMENT STATUS";
            model.Subject = mm.Subject;
            mm.Body       = p.patient_name + "" + "Your request has been accepted" + ". " + "You need to come to the hospital at time" + "" + model.startTime + " " + "to" + model.endTime + "" + "on" + "" + p.Clinic_day;
            model.Body    = mm.Body;

            mm.IsBodyHtml = false;
            SmtpClient smtp = new SmtpClient();

            smtp.Host      = "smtp.gmail.com";
            smtp.EnableSsl = true;
            smtp.Port      = 587;
            NetworkCredential nc = new NetworkCredential("*****@*****.**", "maham180598");

            smtp.UseDefaultCredentials = true;
            smtp.Credentials           = nc;
            smtp.Send(mm);
            ViewBag.Message = "Mail has been sent successfully";

            return(RedirectToAction("Index2", "Clinic_request"));
        }
Example #3
0
        public ActionResult Create([Bind(Include = "Hospital_start_time,hospital_end_time,patient_name,Hospital_day,id,doctor_id")] Hospital_request hospital_request)
        {
            if (ModelState.IsValid)
            {
                db.Hospital_request.Add(hospital_request);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hospital_request));
        }
Example #4
0
        public ActionResult Create([Bind(Include = "doctor_id,name,date_of_birth,adress,phone,MBBS_Code,email,password,confirm_password,clinic_name,hospital_address,hospital_name,clinic_address,city,specialization,practising_years")] doctor doctor)
        {
            if (ModelState.IsValid)
            {
                db.doctors.Add(doctor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctor));
        }
        public ActionResult Create([Bind(Include = "clinic_start_time,hospital_start_time,clinic_end_time,hospital_end_time,is_avalible,Clinic_day,hospial_day,doctor_id")] doctor_scedule doctor_scedule)
        {
            if (ModelState.IsValid)
            {
                db.doctor_scedule.Add(doctor_scedule);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(doctor_scedule));
        }
Example #6
0
        public ActionResult Create([Bind(Include = "name,email,contact_number,password,Confirm_password")] patient patient)
        {
            if (ModelState.IsValid)
            {
                db.patients.Add(patient);
                db.SaveChanges();
                return(RedirectToAction("PatientWelcome", "patients", new { ide = patient.email.ToString() }));
            }

            return(View(patient));
        }
Example #7
0
        public ActionResult Create([Bind(Include = "email,password")] admin admin)
        {
            if (ModelState.IsValid)
            {
                db.admins.Add(admin);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(admin));
        }
Example #8
0
        public ActionResult Create1(int idee, bookyourdoctor.Models.gmailsent model)
        {
            try
            {
                hospital_view    p = new hospital_view();
                Hospital_request hospital_Request = db.Hospital_request.Find(idee);

                p.Hospital_day        = hospital_Request.Hospital_day;
                p.patient_name        = hospital_Request.patient_name;
                p.hospital_start_time = hospital_Request.Hospital_start_time;
                p.hospital_end_time   = hospital_Request.hospital_end_time;

                db.hospital_view.Add(p);
                db.SaveChanges();

                MailMessage mm = new MailMessage("*****@*****.**", ideee);//model.To ki jagah patient i

                mm.Subject    = "APPOINTMENT STATUS";
                model.Subject = mm.Subject;
                mm.Body       = p.patient_name + "" + "Your request has been rejected" + ". " + "You need to come to the hospital at time" + "" + model.startTime + " " + "to" + model.endTime + "" + "on" + "" + p.Hospital_day;
                model.Body    = mm.Body;

                mm.IsBodyHtml = false;
                SmtpClient smtp = new SmtpClient();
                smtp.Host      = "smtp.gmail.com";
                smtp.EnableSsl = true;
                smtp.Port      = 587;
                NetworkCredential nc = new NetworkCredential("*****@*****.**", "maham180598");
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = nc;
                smtp.Send(mm);
                ViewBag.Message = "Mail has been sent successfully";
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException dbEx)
            {
                Exception raise = dbEx;
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        string message = string.Format("{0}:{1}",
                                                       validationErrors.Entry.Entity.ToString(),
                                                       validationError.ErrorMessage);
                        // raise a new exception nesting
                        // the current instance as InnerException
                        raise = new InvalidOperationException(message, raise);
                    }
                }
                throw raise;
            }

            return(RedirectToAction("Index2", "Clinic_request"));
        }
Example #9
0
        public ActionResult Create1(int idee)
        {
            clinic_view    p = new clinic_view();
            Clinic_request clinic_request = db.Clinic_request.Find(idee);

            p.Clinic_day        = clinic_request.clinic_day;
            p.patient_name      = clinic_request.patient_name;
            p.clinic_start_time = clinic_request.clinic_start_time;
            p.clinic_end_time   = clinic_request.clinic_end_time;
            db.SaveChanges();
            db.clinic_view.Add(p);
            return(RedirectToAction("Index1"));
        }
        public ActionResult Create1(int idee)
        {
            hospital_view    p = new hospital_view();
            Hospital_request hospital_Request = db.Hospital_request.Find(idee);

            p.Hospital_day        = hospital_Request.Hospital_day;
            p.patient_name        = hospital_Request.patient_name;
            p.hospital_start_time = hospital_Request.Hospital_start_time;
            p.hospital_end_time   = hospital_Request.hospital_end_time;

            db.hospital_view.Add(p);
            db.SaveChanges();
            return(RedirectToAction("Index1"));
        }
Example #11
0
        // GET: Clinic_request/Create
        public ActionResult Create1(int idee)
        {
            Clinic_request p = new Clinic_request();
            doctor_scedule doctor_shedule = db.doctor_scedule.Find(idee);

            p.doctor_id         = doctor_shedule.doctor_id;
            p.clinic_day        = doctor_shedule.Clinic_day;
            p.patient_name      = ideee;
            p.clinic_start_time = doctor_shedule.clinic_start_time;
            p.clinic_end_time   = doctor_shedule.clinic_end_time;
            db.Clinic_request.Add(p);
            db.SaveChanges();
            return(RedirectToAction("Index1"));
        }