示例#1
0
        public ActionResult EditGeneralInfoDoctor(DoctorInform doctorInform, HttpPostedFileBase uploadImage)
        {
            SelectList clinics = new SelectList(db.Clinics, "Id", "Name");

            ViewBag.Clinics = clinics;
            if (ModelState.IsValid)
            {
                ApplicationUser user      = db.Users.Find(User.Identity.GetUserId());
                DoctorInform    newDoctor = db.DoctorInforms.Find(user.DoctorInformId);
                if (uploadImage != null)
                {
                    byte[] imageData = null;
                    using (var binaryReader = new BinaryReader(uploadImage.InputStream))
                    {
                        imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
                    }
                    newDoctor.Image = imageData;
                }
                newDoctor.ClinicId       = doctorInform.ClinicId;
                newDoctor.Practiced      = doctorInform.Practiced;
                newDoctor.Skills         = doctorInform.Skills;
                newDoctor.Specialization = doctorInform.Specialization;
                newDoctor.Education      = doctorInform.Education;
                newDoctor.Category       = doctorInform.Category;
                newDoctor.Guardian       = doctorInform.Guardian;
                db.SaveChanges();
                return(RedirectToAction("MyAccount"));
            }
            return(View(doctorInform));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,Specialization,Category_,Guardian,Id_clinic,Education,Skills,Practiced,Photo")] DoctorInform doctorInform)
 {
     if (ModelState.IsValid)
     {
         db.Entry(doctorInform).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Id_clinic = new SelectList(db.Clinics, "Id_clinic", "Name", doctorInform.ClinicId);
     return(View(doctorInform));
 }
示例#3
0
        // GET: DoctorInforms/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DoctorInform doctorInform = db.DoctorInforms.Find(id);

            if (doctorInform == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id_clinic = new SelectList(db.Clinics, "Id_clinic", "Name", doctorInform.ClinicId);
            return(View(doctorInform));
        }
示例#4
0
 public ActionResult RegisterDoctor(RegisterDoctorModel model, HttpPostedFileBase uploadImage)
 {
     ViewBag.ClinicId = new SelectList(db.Clinics, "Id", "Name");
     if (ModelState.IsValid)
     {
         if (uploadImage != null)
         {
             byte[] imageData = null;
             using (var binaryReader = new BinaryReader(uploadImage.InputStream))
             {
                 imageData = binaryReader.ReadBytes(uploadImage.ContentLength);
             }
             ApplicationUser user         = db.Users.Find(User.Identity.GetUserId());
             DoctorInform    doctorInform = new DoctorInform
             {
                 Category       = model.Category,
                 Education      = model.Education,
                 Guardian       = model.Guardian,
                 Practiced      = false,
                 Specialization = model.Specialization,
                 ClinicId       = model.СlinicId,
                 Skills         = model.Skills,
                 Image          = imageData
             };
             db.DoctorInforms.Add(doctorInform);
             db.SaveChanges();
             user.DoctorInformId = doctorInform.Id;
             user.DoctorInform   = doctorInform;
             user.Name           = model.Name;
             user.Gender         = model.Gender;
             user.Bithday        = model.Birthday;
             db.SaveChanges();
             return(RedirectToAction("MyAccount"));
         }
         else
         {
             ModelState.AddModelError("", "Оберіть зображення");
         }
     }
     return(View(model));
 }
示例#5
0
        // GET: DoctorInforms/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DoctorInform doctorInform = db.DoctorInforms.Find(id);

            if (doctorInform == null)
            {
                return(HttpNotFound());
            }

            ViewBag.doctorId = id;
            if (Request.IsAuthenticated)
            {
                ApplicationUser user = db.Users.Find(User.Identity.GetUserId());
                ViewBag.Role = db.Roles.Find(user.Roles.FirstOrDefault().RoleId).Name;
            }
            var ID        = doctorInform.ApplicationUsers.FirstOrDefault().Id;
            var feedbacks = db.Feedbacks.Where(u => u.DoctorId == ID).ToList();

            ViewBag.Feedbacks = feedbacks;
            if (feedbacks.Count != 0)
            {
                ViewBag.Average = feedbacks.Average(u => u.Stars) * 20;
            }
            var scheduler = new DHXScheduler(this);

            scheduler.Skin                = DHXScheduler.Skins.Material;
            scheduler.LoadData            = true;
            scheduler.EnableDataprocessor = true;
            scheduler.Config.first_hour   = 6;
            scheduler.Config.last_hour    = 20;

            scheduler.Data.Loader.AddParameter("id", id);
            scheduler.Localization.Set(SchedulerLocalization.Localizations.Ukrainian);
            scheduler.Config.drag_lightbox = true;
            scheduler.Lightbox.Clear();
            var select   = new LightboxSelect("service", "Послуга");
            var services = new List <object>();

            foreach (TypeOfService type in doctorInform.ApplicationUsers.FirstOrDefault().TypeOfServices)
            {
                services.Add(new { key = type.Id, label = type.Name });
            }
            scheduler.Config.icons_select = new EventButtonList()
            {
                EventButtonList.Details
            };
            scheduler.Config.drag_create     = false;
            scheduler.Config.drag_lightbox   = false;
            scheduler.Config.drag_resize     = false;
            scheduler.Config.drag_move       = false;
            scheduler.Config.dblclick_create = false;
            scheduler.Config.show_loading    = true;
            var items = services;

            select.AddOptions(items);
            scheduler.Lightbox.Add(select);
            scheduler.Config.buttons_left = new LightboxButtonList
            {
                new EventButton
                {
                    Label   = "Записатися на прийом",
                    OnClick = "appointment",
                    Name    = "appointment"
                },
                LightboxButtonList.Cancel,
            };
            scheduler.Config.buttons_right = new LightboxButtonList();
            if (!User.Identity.IsAuthenticated)
            {
                scheduler.Config.isReadonly = true;
            }
            ViewBag.Scheduler = scheduler;
            return(View(doctorInform));
        }