Beispiel #1
0
 public JsonResult activation(Guid id)
 {/*this method activate doctor profile to be accepted for seeing by patients on site*/
     try
     {
         doctorInfo doctorInfo = db.doctorInfoes.Single(doc => doc.doctorID == id);
         //only set at first time function is called
         if (!doctorInfo.profileIsAccepted)
         {
             doctorInfo.profileIsAccepted = true;
         }
         doctorInfo.stat            = !doctorInfo.stat;
         db.Entry(doctorInfo).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         string to          = doctorInfo.doctor.mail;
         string subject     = "your profile is accepted by tabeebek website adminstration";
         string messageBody =
             "<html>" +
             "<body>" +
             "<h2>hi " + doctorInfo.doctor.username + "</h2>" +
             "<p>" +
             "Your profile is revisited and accepted by tabeebak website adminstration and" +
             "<br>from now you can start setting your appointements of examins and bookings,then start your work on tabeebek</p>" +
             "<a href=localhost/doctors/doctor/doctorPage'>Go to doctor page</a>" +
             "</body>" +
             "</html>";
         globalController.sendMailTo(to, subject, messageBody, "sync");
         return(Json(new { result = true }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { result = false }, JsonRequestBehavior.AllowGet));
     }
 }
Beispiel #2
0
 public static doctorCard getDoctorCard(this doctorInfo docInfo, string language)
 {
     if (docInfo == null)
     {
         return(null);
     }
     try
     {
         doctorCard ProfileCard       = new doctorCard();
         var        patientViewsCount = docInfo.doctor.patientViews.Count;
         ProfileCard.spName = docInfo.doctor.getSpecialityName(language);
         double rate       = (patientViewsCount > 0) ?docInfo.doctor.patientViews.Average(p => p.rate):0;
         string image      = docInfo.image;
         Guid   doctorID   = docInfo.doctorID;
         var    examinFees = docInfo.examinFees;
         var    viewers    = docInfo.doctor.patientViews.Count();
         ProfileCard.waitingTime = docInfo.waitingTime;
         if (language == "ar")
         {
             //this is for arabic profile
             ProfileCard.rate            = rate;
             ProfileCard.viewers         = viewers;
             ProfileCard.timing          = docInfo.availableTimeAr;
             ProfileCard.price           = examinFees;
             ProfileCard.fname           = docInfo.fnameAr;
             ProfileCard.lname           = docInfo.lnameAr;
             ProfileCard.image           = image;
             ProfileCard.id              = doctorID;
             ProfileCard.professionTitle = docInfo.profTitleAr;
             ProfileCard.clinicAddress   = docInfo.clinicAddressAr;
         }
         else
         {
             //this is for english profile
             ProfileCard.rate            = rate;
             ProfileCard.viewers         = viewers;
             ProfileCard.timing          = docInfo.availableTimeEng;
             ProfileCard.price           = examinFees;
             ProfileCard.fname           = docInfo.fnameEng;
             ProfileCard.lname           = docInfo.lnameEng;
             ProfileCard.image           = image;
             ProfileCard.id              = doctorID;
             ProfileCard.professionTitle = docInfo.profTitleEng;
             ProfileCard.clinicAddress   = docInfo.clinicAddressEng;
         }
         return(ProfileCard);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Beispiel #3
0
 //appointements setting page
 public ActionResult appointementPage()
 {
     try
     {
         doctor     currentDoctor = getCurrentDoctor();
         doctorInfo currDocInfo   = currentDoctor.doctorInfo;
         bool       bookingtype   = currDocInfo.reservingType;
         List <appointementData> doctorAppointements = currentDoctor.appointements.Select(a =>
                                                                                          new appointementData
         {
             interval = a.interval, dateOfBooking = a.dateOfBooking
         }).ToList();
         Tuple <bool, List <appointementData>, byte> data = new Tuple <bool, List <appointementData>, byte>
                                                                (bookingtype, doctorAppointements, currDocInfo.numberOfScedualedDayes);
         return(View(data));
     }
     catch (Exception)
     {
         return(Redirect("/" + globalController.defaultPathForDoctorsArea));
     }
 }
Beispiel #4
0
        //doctor information page
        public ActionResult profile()
        {
            /*
             * this function show information page that contains all information that related with
             * doctor's clinic ,clinic address,doctor profile ,and so on....
             * this info is required for doctor card that will be displayed for patients
             */
            //data needed for page to be displayed
            ViewBag.professions = (currentLanguage == "en")?engEducationsNames:arEducationsNames;
            if (!isDoctorAuthenticated)
            {
                return(RedirectToAction("register"));
            }
            doctorInfo currentDocInfo = null;

            try
            {
                doctor doc = getCurrentDoctor();
                currentDocInfo = doc.doctorInfo;
                if (currentDocInfo != null)
                {
                    //true if profile is completed or already created
                    ViewBag.profileStat = true;
                    return(View(currentDocInfo));
                }
                else
                {
                    //false if profile is not completed or not created
                    ViewBag.profileStat = false;
                    return(View());
                }
            }
            catch (Exception)
            {
                ViewBag.profileStat = false;
                return(View());
            }
        }
Beispiel #5
0
        //update doctor information page
        public ActionResult profile(doctorInfo docInfo)
        {
            //data needed for page to be dispalyed
            ViewBag.professions = (currentLanguage == "en") ? engEducationsNames : arEducationsNames;
            string operation = "add";

            try
            {
                if (ModelState.IsValid)
                {
                    doctor doc = getCurrentDoctor();
                    docInfo.doctorID = doc.id;
                    //get old doctorInfo record if exists
                    doctorInfo isfoundDocInfo = db.doctorInfoes.Find(doc.id);
                    if (isfoundDocInfo == null)
                    {//add newdoctor info record
                        string imageName = "";
                        //validate if image profile is not valid
                        if (validateProfileImage(doc.id.ToString(), ref imageName))
                        {
                            docInfo.image = imageName;
                        }
                        else
                        {
                            //false if profile is not completed or not created
                            ViewBag.profileStat = false;
                            ModelState.AddModelError("image", Resource1.imgNotValid);
                            ModelState.AddModelError(string.Empty, Resource1.profileRegisterAddingFailed);
                            return(View(docInfo));
                        }
                        db.doctorInfoes.Add(docInfo);
                        db.SaveChanges();
                        //true if profile is completed or already created
                        ViewBag.profileStat = true;
                        return(View(docInfo));
                    }//end of add record
                    else
                    {//doctorInfo record will be updated
                        operation = "update";
                        string oldImage = isfoundDocInfo.image;
                        if (!validateProfileImage(doc.id.ToString(), ref oldImage, oldImage, operation))
                        {//image is invalid
                            ModelState.AddModelError(string.Empty, Resource1.imgNotUpdated);
                        }
                        else
                        {//image is updated
                            docInfo.image = oldImage;
                        }
                        docInfo.stat = isfoundDocInfo.stat;
                        docInfo.profileIsAccepted = isfoundDocInfo.profileIsAccepted;
                        ((IObjectContextAdapter)db).ObjectContext.Detach(isfoundDocInfo);
                        db.Entry(docInfo).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                        //true if profile is completed or already created
                        ViewBag.profileStat = true;
                        return(View(docInfo));
                    }//end of update record
                }
                else
                {//modelstate is invalid
                    if (operation == "add")
                    {
                        ModelState.AddModelError(string.Empty, Resource1.profileRegisterAddingFailed);
                        ViewBag.profileStat = false;
                    }
                    else
                    {
                        ModelState.AddModelError(string.Empty, Resource1.profileNotUpdated);
                    }
                    return(View(docInfo));
                }
            }
            catch (Exception)
            {
                ViewBag.profileStat = false;
                ModelState.AddModelError(string.Empty, Resource1.serverOperationProblem);
                return(View(docInfo));
            }
        }