Exemple #1
0
        // GET: Patients
        public ActionResult Index()
        {
            IBL bl       = new BL.BL();
            var patients = bl.GetPatients();

            return(View(patients));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            IBL bl = new BL.BL();

            bl.DeletePatient(id);
            return(RedirectToAction("Index"));
        }
Exemple #3
0
        public ActionResult InviteDoctor(Doctor doctor)
        {
            Session["ErrorId"] = "";
            IBL bl = new BL.BL();

            if (ModelState.IsValid)
            {
                if (!bl.IsId(doctor.Id.ToString()))
                {
                    Session["ErrorId"] = "Invalid ID";
                    return(View("Create", new DoctorViewModel(doctor)));
                }
                if (bl.GetDoctorById(doctor.Id) != null)
                {
                    Session["ErrorId"] = "ID already exists";
                    return(View("Create", new DoctorViewModel(doctor)));
                }
                bl.AddDoctor(doctor);
                string link = $"http://{Request.Url.Host}:{Request.Url.Port}/Account/EnterId";
                bl.SendMail(doctor.Mail, "", $"You are invited to sign up for Medical :) <a href='{link}'> Sign up </a>");
                ViewBag.IsSucceeded = true;
                return(View("Create", new DoctorViewModel(doctor)));
            }
            return(View("Create", new DoctorViewModel(doctor)));
        }
Exemple #4
0
        private void BindControl()
        {
            try
            {
                BL.BL MAHAITDBAccess    = ((MAHAITMasterPage)this.Page.Master).MAHAITDBAccess;
                NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();

                if (Convert.ToString(Session["VisitorId"]) == "" || Convert.ToString(Session["VisitorId"]) == null)
                {
                    objBannerControlSchema.UserName = MAHAITDBAccess.UserName;
                    Session["VisitorId"]            = MAHAITDBAccess.UserName;
                }
                else
                {
                    objBannerControlSchema.UserName = Convert.ToString(Session["VisitorId"]);
                }


                ds = objBannerBL.GetVisitorCount(objBannerControlSchema);
                if (ds != null)
                {
                    dt = ds.Tables[0];
                }


                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        string no         = dt.Rows[0]["TOTALCOUNT"].ToString();
                        string todaycount = dt.Rows[0]["TodayVisit"].ToString();


                        lblTotalVisitHeading.Text = _MahaITUC.GetResourceValue("Common", "lblTotalVisitor", "");
                        lblTodayVisitHeading.Text = _MahaITUC.GetResourceValue("Common", "lblTodaysVisitor", "");
                        //lblStartDate.Text = _MahaITUC.GetResourceValue("Common", "lblStartDate", "");


                        if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString().ToLower() == Convert.ToString("en-IN").ToLower())
                        {
                            lblCounter.Text    = no.ToString();
                            lbltodayCount.Text = todaycount.ToString();
                        }
                        else if (System.Threading.Thread.CurrentThread.CurrentCulture.ToString().ToLower() == Convert.ToString("mr-IN").ToLower())
                        {
                            lblCounter.Text    = no.Replace("0", "०").Replace("1", "१").Replace("2", "२").Replace("3", "३").Replace("4", "४").Replace("5", "५").Replace("6", "६").Replace("7", "७").Replace("8", "८").Replace("9", "९");
                            lbltodayCount.Text = todaycount.Replace("0", "०").Replace("1", "१").Replace("2", "२").Replace("3", "३").Replace("4", "४").Replace("5", "५").Replace("6", "६").Replace("7", "७").Replace("8", "८").Replace("9", "९");
                        }
                        else
                        {
                            lblCounter.Text    = no.Replace("0", "०").Replace("1", "१").Replace("2", "२").Replace("3", "३").Replace("4", "४").Replace("5", "५").Replace("6", "६").Replace("7", "७").Replace("8", "८").Replace("9", "९");
                            lbltodayCount.Text = todaycount.Replace("0", "0").Replace("1", "१").Replace("2", "२").Replace("3", "३").Replace("4", "४").Replace("5", "५").Replace("6", "६").Replace("7", "७").Replace("8", "८").Replace("9", "९");
                        }
                    }
                }
            }
            finally
            {
            }
        }
Exemple #5
0
        static void Main(string[] args)
        {
            string cs = System.Configuration.ConfigurationManager.ConnectionStrings["LingoCS"].ConnectionString;

            BL.BL  bl         = new BL.BL(cs);
            string randomWord = bl.GetRandomWord();
        }
Exemple #6
0
        public ActionResult GetPrescriptionsOfPatient(int Id)
        {
            IBL bl     = new BL.BL();
            var result = bl.GetPrescriptionsOfPatient(Id).Select(item => new PrescriptionViewModel(item));

            return(View("~/Views/Prescriptions/Index.cshtml", result));
        }
        // GET: Medicines
        public ActionResult Index()
        {
            IBL bl        = new BL.BL();
            var medicines = bl.GetMedicines().Select(item => new MedicineViewModel(item));

            return(View(medicines));
        }
Exemple #8
0
        public ActionResult GetWarningsByJson(int medicineId, int patientId)
        {
            IBL           bl        = new BL.BL();
            string        NDCId     = bl.GetMedicineByPrimaryId(medicineId).NDCId;
            List <string> medicines = bl.GetMedicinesOfPatient(patientId).ToList();

            medicines.Add(NDCId);
            DrugIntractionLogic drugIntractionLogic = new DrugIntractionLogic();
            List <string>       warningsStrings     = new List <string>();

            warningsStrings = drugIntractionLogic.checkInteractions(medicines);
            Warning warning = new Warning();

            if (warningsStrings.Count() == 1)
            {
                return(Json(new List <Warning>(), JsonRequestBehavior.AllowGet));
            }
            warning.ConflictingMedicines = warningsStrings[0];
            warning.LevelOfRisk          = warningsStrings[1];
            warning.Description          = warningsStrings[2];
            string[] helper = warning.Description.Split('.');
            warning.Description = helper[0];
            var result = new List <Warning>();

            result.Add(warning);
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public ActionResult Create(Medicine medicine, HttpPostedFileBase file)
 {
     try
     {
         IBL bl = new BL.BL();
         if (file == null)
         {
             bl.AddMedicine(medicine);
             return(RedirectToAction("Index"));
         }
         GoogleDriveAPIHelper googleDrive = new GoogleDriveAPIHelper();
         googleDrive.UploadFileOnDrive(file);
         medicine.ImagePath = googleDrive.DownloadGoogleFileByName(file.FileName);
         ImageValidate imageValidate = new ImageValidate();
         bool          result        = true;
         if (medicine.ImagePath != null)
         {
             result = imageValidate.Validate(medicine.ImagePath);
         }
         if (result)
         {
             medicine.ImagePath = $"/GoogleDriveFiles/{file.FileName}";
             //add image to drive
             bl.AddMedicine(medicine);
         }
         else
         {
             Session["Error"] = "This image isn't valid";
             return(View("AddImage", new MedicineViewModel(medicine)));
         }
         return(RedirectToAction("Index"));
     }catch (Exception e) { return(View()); }
 }
Exemple #10
0
        public ActionResult ChoosePatient()
        {
            IBL bl = new BL.BL();

            ViewBag.IsSelectView = true;
            return(View("~/Views/Patients/Index.cshtml", bl.GetPatients()));
        }
Exemple #11
0
        // GET: Doctors
        public ActionResult Index()
        {
            IBL bl      = new BL.BL();
            var doctors = bl.GetDoctors();

            return(View(doctors));
        }
Exemple #12
0
 public ActionResult Edit(Patient patient, int Id)
 {
     if (ModelState.IsValid)
     {
         IBL bl = new BL.BL();
         bl.UpdatePatient(patient, Id);
         return(RedirectToAction("ChoosePatient", "Prescriptions"));
     }
     return(View(new PatientViewModel(patient)));
 }
Exemple #13
0
        public ActionResult Edit([Bind(Include = "Id,LicenseNum,Specialty,UserName,Password,Phone,Mail,Birthday,UserType")] Doctor doctor)
        {
            IBL bl = new BL.BL();

            if (ModelState.IsValid)
            {
                bl.UpdateDoctor(doctor, doctor.Id);
                return(RedirectToAction("Index"));
            }
            return(View(doctor));
        }
Exemple #14
0
        // GET: Patients/Edit/5
        public ActionResult EditPersonalDetails()
        {
            IBL bl = new BL.BL();

            if (RouteConfig.user == null)
            {
                return(HttpNotFound());
            }
            Session["Error"] = "";
            return(View(new UserViewModel(RouteConfig.user)));
        }
Exemple #15
0
        public ActionResult Details(int id)
        {
            IBL          bl           = new BL.BL();
            Prescription prescription = bl.GetPrescriptionById(id);

            if (prescription == null)
            {
                return(HttpNotFound());
            }
            return(View(new PrescriptionViewModel(prescription)));
        }
Exemple #16
0
        public ActionResult PdfViewer(int id)
        {
            IBL bl           = new BL.BL();
            var prescription = bl.GetPrescriptionById(id);

            if (prescription == null)
            {
                return(View("Error"));
            }
            return(View("PdfViewer", new PrescriptionViewModel(prescription)));
        }
        // GET: Medicines/Delete/5
        public ActionResult Delete(string id)
        {
            IBL      bl       = new BL.BL();
            Medicine medicine = bl.GetMedicineById(id);

            if (medicine == null)
            {
                return(HttpNotFound());
            }
            return(View(new MedicineViewModel(medicine)));
        }
Exemple #18
0
        // GET: Patients/Delete/5
        public ActionResult Delete(int id)
        {
            IBL     bl      = new BL.BL();
            Patient patient = bl.GetPatientById(id);

            if (patient == null)
            {
                return(HttpNotFound());
            }
            return(View(new PatientViewModel(patient)));
        }
Exemple #19
0
 public ActionResult SignUpDoctor(Doctor doctor)
 {
     try
     {
         IBL bl = new BL.BL();
         bl.UpdateDoctor(doctor, doctor.Id);
         RouteConfig.user = bl.SignIn(doctor.Id, doctor.Password);
         //which view you want him to go to
         return(View("Index"));
     }
     catch (ArgumentNullException) { return(View()); }
 }
Exemple #20
0
        public ActionResult AddPrescriptionToPatient(int patientId)
        {
            IBL          bl = new BL.BL();
            var          primaryDoctorId = bl.GetDoctorById(RouteConfig.user.Id).PrimaryId;
            Prescription prescription    = new Prescription()
            {
                PatientId = patientId,
                DoctorId  = primaryDoctorId
            };

            return(View("Create", new PrescriptionViewModel(prescription)));
        }
        // GET: Medicines/Edit/5
        public ActionResult Edit(string id)
        {
            IBL      bl       = new BL.BL();
            Medicine medicine = bl.GetMedicineById(id);

            if (medicine == null)
            {
                return(HttpNotFound());
            }
            Session["Error"] = "";
            return(View("Details", new MedicineViewModel(medicine)));
        }
Exemple #22
0
        static public MvcHtmlString DropDownEnumListForMedicines(this HtmlHelper htmlHelper, string name)
        {
            IBL    bl        = new BL.BL();
            var    medicines = bl.GetMedicines();
            string options   = "<option>Choose medicine...</option>";

            foreach (var item in medicines)
            {
                options += $"<option id='medicine{item.Id}' value ='{item.Id}' data-Name='{item.Name}' data-ServingOption='{item.ServingOption}'> {item.GenericName} </option>";
            }
            return(new MvcHtmlString($"<select required name='{name}' id='medicines' class='medicinesSelect' >{options}</select>"));
        }
Exemple #23
0
 public ActionResult SignUpPatient(Patient patient)
 {
     try
     {
         IBL bl = new BL.BL();
         bl.UpdatePatient(patient, patient.Id);
         RouteConfig.user = bl.SignIn(patient.Id, patient.Password);
         //which view you want him to go to
         return(View("Index"));
     }
     catch (ArgumentNullException) { return(View()); }
 }
Exemple #24
0
        public ActionResult Create([Bind(Include = "Id,FullName,Birthday,Background,BloodType,Phone,Mail")] Patient patient)
        {
            if (ModelState.IsValid)
            {
                IBL bl = new BL.BL();
                patient.UserType = UserTypeEnum.Patient;
                bl.AddPatient(patient);
                return(RedirectToAction("Index"));
            }

            return(View(new PatientViewModel(patient)));
        }
Exemple #25
0
        public ActionResult Create([Bind(Include = "Id,LicenseNum,Specialty,UserName,Password,Phone,Mail,Birthday,UserType")] Doctor doctor)
        {
            IBL bl = new BL.BL();

            //doctor.PersonId = 211466370;
            if (ModelState.IsValid)
            {
                doctor.UserType = UserTypeEnum.Doctor;
                bl.AddDoctor(doctor);
                return(RedirectToAction("Index"));
            }
            return(View(new DoctorViewModel(doctor)));
        }
        public ActionResult GetStatisticsByJson(int medicineId, DateTime start, DateTime end)
        {
            IBL bl            = new BL.BL();
            var statisticDict = bl.GetStatisticMedicine(medicineId, start, end);
            var result        = from item in statisticDict
                                select new
            {
                Month = item.Key,
                Count = item.Value
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemple #27
0
 public ActionResult SignIn(int Id, string Password)
 {
     try
     {
         IBL  bl   = new BL.BL();
         User user = bl.SignIn(Id, Password);
         RouteConfig.user = user;
         return(View("Index"));
     }
     catch (Exception e) {
         Session["Error"] = e.Message;
         return(View());
     }
 }
Exemple #28
0
        // GET: Doctors/Edit/5
        public ActionResult Edit(int id)
        {
            IBL bl = new BL.BL();

            if (id == -1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Doctor doctor = bl.GetDoctorById(id);

            if (doctor == null)
            {
                return(HttpNotFound());
            }
            return(View(doctor));
        }
Exemple #29
0
        public ActionResult Create(Prescription prescription)
        {
            if (ModelState.IsValid)
            {
                IBL bl = new BL.BL();
                prescription.PrescriptionDate = DateTime.Now;
                bl.AddPrescription(prescription);
                string  link    = $"http://{Request.Url.Host}:{Request.Url.Port}/Account/SignIn";
                Patient patient = prescription.GetPatient();
                bl.SendSMS(patient.Phone, patient.UserName, "You have a new prescription!");
                bl.SendMail(patient.Mail, patient.UserName, $"You have a new prescription!\n<a href='{link}'> Go to your account </a>");
                return(PdfViewer(prescription.Id));
            }

            return(View(new PrescriptionViewModel(prescription)));
        }
Exemple #30
0
        public ActionResult CheckCode(string CorrectCode, string Code, User user)
        {
            IBL bl = new BL.BL();

            //sending error
            if (CorrectCode != Code)
            {
                Session["Error"] = "please try again!";
                return(View("EnterCode", new UserViewModel(user)));
            }
            //correct
            if (user.UserType == UserTypeEnum.Doctor)
            {
                return(View("SignUpDoctor", new DoctorViewModel(bl.ConvertUserToDoctor(user))));
            }
            return(View("SignUpPatient", new PatientViewModel(bl.ConvertUserToPatient(user))));
        }