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 Create2(int idee, bookyourdoctor.Models.gmailsent model)
        {
            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";

            return(RedirectToAction("Index2", "Clinic_request"));
            //return RedirectToAction("Index1");
        }
Example #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Hospital_request hospital_request = db.Hospital_request.Find(id);

            db.Hospital_request.Remove(hospital_request);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #4
0
 public ActionResult Edit([Bind(Include = "Hospital_start_time,hospital_end_time,patient_name,Hospital_day,id,doctor_id")] Hospital_request hospital_request)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hospital_request).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hospital_request));
 }
Example #5
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 #6
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 #7
0
            public static IEnumerable <SelectListItem> slots(String doctorid)
            {
                IList <SelectListItem> items = new List <SelectListItem>();
                Hospital_request       hr    = new Hospital_request();
                List <DateTime>        dt    = hr.timeslots(doctorid);

                foreach (DateTime item in dt)
                {
                    items.Add(new SelectListItem {
                        Text = item.Hour.ToString(), Value = item.Hour.ToString()
                    });
                }
                return(items);
            }
Example #8
0
        // GET: Hospital_request/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Hospital_request hospital_request = db.Hospital_request.Find(id);

            if (hospital_request == null)
            {
                return(HttpNotFound());
            }
            return(View(hospital_request));
        }
Example #9
0
        public ActionResult Create1(int idee)
        {
            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);
            return(RedirectToAction("Index1", "Clinic_request"));
        }
        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"));
        }