コード例 #1
0
        public ActionResult PatientLogIn(FormCollection collection)
        {
            DoctorEntities dd = new DoctorEntities();

            try
            {
                Patient p    = dd.Patients.Find(collection["email"]);
                string  pass = new Encryption().Decrypt(p.password);

                if (collection["password"].Equals(pass))
                {
                    Session["email"] = collection["email"];

                    Response.Write("database password" + pass + "and given password is" + collection["password"]);

                    return(RedirectToAction("Index", "Patient"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ee)
            {
                Response.Write("Invalid credentials....");
            }
            return(View());
        }
コード例 #2
0
        public ActionResult DoctorLogin(FormCollection collection)
        {
            DoctorEntities dd = new DoctorEntities();

            try
            {
                Doctor d = dd.Doctors.Find(collection["regid"]);

                string pass;

                pass = new Encryption().Decrypt(d.password);
                if (collection["password"].Equals(pass))
                {
                    Session["regid"] = collection["regid"];



                    return(View());
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception e)
            {
                Response.Write(e.Message);
                return(View());
            }
        }
コード例 #3
0
        public void Publish(FormCollection collection)
        {
            DoctorEntities dd = new DoctorEntities();
            article        a  = new article();



            HttpPostedFileBase file = Request.Files["image"];

            if (file != null)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    file.InputStream.CopyTo(ms);
                    byte[] array = ms.GetBuffer();
                    a.picture = array;
                }
            }
            a.title   = collection["title"];
            a.genre   = collection["genre"];
            a.context = collection["context"];
            a.author  = collection["regid"];
            dd.articles.Add(a);


            dd.SaveChanges();

            Response.Redirect("DoctorLogin");
        }
コード例 #4
0
        public ActionResult delete(int pid)
        {
            DoctorEntities dd = new DoctorEntities();
            //Response.Write(pid);
            Prescription pr = dd.Prescriptions.Find(pid.ToString());

            dd.Prescriptions.Remove(pr);
            dd.SaveChanges();
            return(View("prescribe"));
        }
コード例 #5
0
        public void comment(FormCollection collection)
        {
            DoctorEntities dd  = new DoctorEntities();
            comment        com = new Models.comment();

            com.pid     = Session["email"].ToString();
            com.message = collection["message"];
            com.aid     = int.Parse(collection["aid"]);
            dd.comments.Add(com);
            dd.SaveChanges();



            Response.Redirect("Index");
        }
コード例 #6
0
        public ActionResult comment(FormCollection collection)
        {
            DoctorEntities dd  = new DoctorEntities();
            comment        com = new Models.comment();

            com.regid   = Session["regid"].ToString();
            com.message = collection["message"];
            com.aid     = int.Parse(collection["aid"]);
            dd.comments.Add(com);
            dd.SaveChanges();



            return(View("DoctorLogin"));
        }
コード例 #7
0
        public void Register(FormCollection collection)
        {
            DoctorEntities dd  = new DoctorEntities();
            Doctor         doc = new Doctor();



            HttpPostedFileBase file = Request.Files["image"];

            if (file != null)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    file.InputStream.CopyTo(ms);
                    byte[] array = ms.GetBuffer();
                    doc.image = array;
                }
            }
            string[] st    = collection["start_time"].Split(':');
            string[] et    = collection["end_time"].Split(':');
            int      st_hr = int.Parse(st[0]);
            int      st_mn = int.Parse(st[1]);
            int      en_hr = int.Parse(et[0]);
            int      en_mn = int.Parse(et[1]);

            doc.latitude       = float.Parse(collection["lat"]);
            doc.city           = collection["city"];
            doc.email          = collection["email"];
            doc.end_time       = en_hr * 60 + en_mn;
            doc.interval       = int.Parse(collection["interval"]);
            doc.longitude      = float.Parse(collection["lng"]);
            doc.mobile         = int.Parse(collection["mobile"]);
            doc.name           = collection["name"];
            doc.password       = new Encryption().Encrypt(collection["password"]);
            doc.regid          = collection["regid"];
            doc.specialization = collection["special"];
            doc.start_time     = st_hr * 60 + st_mn;;
            dd.Doctors.Add(doc);
            dd.SaveChanges();
            string imageBase64Data = Convert.ToBase64String(doc.image);
            string imageDataURL    = string.Format("data:image/jpg;base64,{0}", imageBase64Data);



            Response.Write("<img src='" + @imageDataURL + "' height='200' width='200'/>");

            Response.Write("<h1>Welcome...!" + doc.name + "</h1>");
        }
コード例 #8
0
        public void Store(FormCollection collection)
        {
            DoctorEntities dd = new DoctorEntities();
            Patient        p  = new Patient();
            SendEmail      se = new SendEmail();

            HttpPostedFileBase file = Request.Files["image"];

            if (file != null)
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    file.InputStream.CopyTo(ms);
                    byte[] array = ms.GetBuffer();
                    p.image = array;
                }
            }


            p.email    = collection["email"];
            p.name     = collection["name"];
            p.password = new Encryption().Encrypt(collection["password"]);
            p.city     = collection["city"];
            p.mobile   = collection["mobile"];
            se.SendMail(p.email, p.name);
            dd.Patients.Add(p);
            dd.SaveChanges();
            string imageBase64Data = Convert.ToBase64String(p.image);
            string imageDataURL    = string.Format("data:image/jpg;base64,{0}", imageBase64Data);



            Response.Write("<img src='" + @imageDataURL + "' height='200' width='200'/>");

            Response.Write("<h1>Welcome...!" + p.name + "</h1> We will soon redirect you tp log in page");
            for (int i = 0; i < 1000000; i++)
            {
            }
            Response.Redirect("~");
        }
コード例 #9
0
        public void schedule(FormCollection collection)
        {
            DoctorEntities dd        = new DoctorEntities();
            Schedule       a         = new Schedule();
            DateTime       UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);


            a.date  = Convert.ToDateTime(collection["date"]);
            a.regid = Request["regid"];
            a.email = Request["email"];
            //a.regid = collection["regid"];
            a.time = Convert.ToInt32(Request["time"]);
            DateTime localDateTime, univDateTime;

            localDateTime = DateTime.Now;
            univDateTime  = localDateTime.ToUniversalTime();
            string temp = "" + (long)(univDateTime - UnixEpoch).TotalMilliseconds;

            a.sid  = temp.Substring(5);
            a.date = Convert.ToDateTime(Request["date"]);
            Response.Write("reg=" + a.regid + "<br/>sid=" + a.sid);
            dd.Schedules.Add(a);
            Response.Write("Your appointment has been scheduled.. Soon we will redirect  you to home page");
            Session["email"] = Request["email"];
            System.Threading.Thread.Sleep(5000);



            try
            {
                dd.SaveChanges();
                Response.Redirect("Index");
            }
            catch (Exception e)
            {
                Response.Write(e.Message);
            }
        }
コード例 #10
0
        public ActionResult medicate(FormCollection collection)
        {
            DateTime UnixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
            DateTime localDateTime, univDateTime;

            localDateTime = DateTime.Now;
            univDateTime  = localDateTime.ToUniversalTime();
            string temp = "" + (long)(univDateTime - UnixEpoch).TotalMilliseconds;


            DoctorEntities dd = new DoctorEntities();
            Prescription   pr = new Prescription();

            pr.pid = temp.Substring(5);
            pr.sid = collection["sid"];
            pr.prescription_name = collection["medicine_name"];
            pr.random            = int.Parse(collection["random"]);
            pr.quantity          = int.Parse(collection["quantity"]);
            if (collection["times"].Contains("morning"))
            {
                pr.morning = true;
            }
            if (collection["times"].Contains("afternoon"))
            {
                pr.afternoon = true;
            }
            if (collection["times"].Contains("night"))
            {
                pr.night = true;
            }
            dd.Prescriptions.Add(pr);
            dd.SaveChanges();
            //Response.Redirect("prescribe");

            return(View("prescribe"));
        }