Esempio n. 1
0
        public ActionResult Register(DataModel dm)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();

            System.Data.Entity.Core.Objects.ObjectParameter Memberid = new System.Data.Entity.Core.Objects.ObjectParameter("id", typeof(int));

            if (ModelState.IsValid)
            {
                db.AddMember(dm.Email, dm.Password, dm.RoleId, Memberid);
                db.SaveChanges();
                dm.MemberId         = Convert.ToInt32(Memberid.Value);
                Session["MemberId"] = dm.MemberId;

                ViewBag.text = "Registerd Successfuly";
            }
            List <SelectListItem> lst = new List <SelectListItem>();
            var getdata = db.RoleDetails.ToList();

            for (int i = 0; i < 3; i++)
            {
                lst.Add(new SelectListItem
                {
                    Text  = getdata[i].RoleName,
                    Value = getdata[i].RoleId.ToString()
                });
            }
            dm.RoleList = lst;


            return(View(dm));
        }
        public ActionResult ViewAllMessage(string docmail, string pmail, string subject)
        {
            DataModel dt = new DataModel();

            dt.DMail   = docmail;
            dt.PMail   = pmail;
            dt.Subject = subject;


            List <DataModel> dlst = new List <DataModel>();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id      = Convert.ToInt32(Session["MemberId"]);
            var getdata = db.Inboxes.Where(m => (m.FromEmailId == pmail && m.ToEmailId == docmail) || (m.FromEmailId == docmail && m.ToEmailId == pmail)).ToList();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    dlst.Add(new DataModel
                    {
                        From           = item.FromEmailId,
                        MessageDetails = item.MessageDetail,
                        MsgDate        = item.MessageDate
                    });
                }
                dt.MsgViewList = dlst;
            }
            else
            {
                ViewBag.text = "No new messages";
            }
            return(View(dt));
        }
Esempio n. 3
0
        public ActionResult OrderDrug()
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var                   getdata       = db.Drugs.Where(m => m.IsDeleted == false).ToList();
            DrugModel             dm            = new DrugModel();
            List <SelectListItem> lst           = new List <SelectListItem>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    lst.Add(new SelectListItem
                    {
                        Text  = item.DrugName,
                        Value = item.DrugId.ToString()
                    });
                }
                dm.DrugNameList = lst;
            }
            else
            {
                ViewBag.text = "No Drugs Available";
            }
            return(View(dm));
        }
        public ActionResult ViewAllMessage(DataModel dt)
        {
            List <DataModel> dlst = new List <DataModel>();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            Inbox obj = new Inbox();

            obj.FromEmailId   = dt.DMail;
            obj.ToEmailId     = dt.PMail;
            obj.Subject       = dt.Subject;
            obj.MessageDetail = dt.MessageDetails;
            obj.MessageDate   = DateTime.Now;
            obj.ReplyId      += 1;
            db.Inboxes.Add(obj);
            db.SaveChanges();
            var getdata = db.Inboxes.Where(m => (m.FromEmailId == dt.DMail && m.ToEmailId == dt.PMail) || (m.FromEmailId == dt.PMail && m.ToEmailId == dt.DMail)).ToList();

            foreach (var item in getdata)
            {
                dlst.Add(new DataModel
                {
                    From           = item.FromEmailId,
                    MessageDetails = item.MessageDetail,
                    MsgDate        = item.MessageDate
                });
            }

            dt.MsgViewList = dlst;

            return(View(dt));
        }
        public ActionResult ViewEditDrugs()
        {
            DrugModel dm = new DrugModel();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            List <DrugModel> dmlist             = new List <DrugModel>();
            var getdata = db.Drugs.ToList();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    dmlist.Add(new DrugModel
                    {
                        DrugId          = item.DrugId,
                        DrugName        = item.DrugName,
                        ManufactureDate = item.ManufactureDate,
                        ExpiryDate      = item.ExpiryDate,
                        TotalQuantity   = item.TotalQuantityAvailable,
                        UsedFor         = item.UsedFor,
                        SideEffects     = item.SideEffects,
                        IsDeleted       = item.IsDeleted
                    });

                    dm.DrugList = dmlist;
                }
            }
            else
            {
                ViewBag.text = "No drug available";
            }

            return(View(dm));
        }
        public ActionResult EditProfile(DataModel dt)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id = Convert.ToInt32(Session["MemberId"]);

            dt.MemberId = id;

            Doctor objDoctor = new Doctor();

            var getdata = db.Doctors.Where(m => m.MemberId == id).FirstOrDefault();

            if (getdata != null)
            {
                getdata.FirstName       = dt.FirstName;
                getdata.LastName        = dt.LastName;
                getdata.Gender          = dt.Gender;
                getdata.SpecializedId   = dt.SpecializationId;
                getdata.TotalExperience = dt.TotalExperience;
            }
            else
            {
                objDoctor.FirstName       = dt.FirstName;
                objDoctor.LastName        = dt.LastName;
                objDoctor.TotalExperience = dt.TotalExperience;
                objDoctor.Gender          = dt.Gender;
                objDoctor.SpecializedId   = dt.SpecializationId;
                objDoctor.MemberId        = dt.MemberId;
                db.Doctors.Add(objDoctor);
            }


            db.SaveChanges();
            ViewBag.text = "data inserted";
            List <SelectListItem> lst = new List <SelectListItem>();// LOCAL LIST
            var getSpec = db.SpecializedDetails.ToList();

            foreach (var item in getSpec)
            {
                lst.Add(new SelectListItem
                {
                    Text  = item.SpecializedName,
                    Value = item.SpecializedId.ToString()
                });
                dt.SpecList = lst;
            }

            var chkname = db.Doctors.Where(m => m.MemberId == id).FirstOrDefault();

            if (chkname != null)
            {
                Session["name"] = chkname.FirstName;
            }
            else
            {
                Session["name"] = null;
            }

            return(View(dt));
        }
Esempio n. 7
0
        public JsonResult GetQuantity(int id)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.Drugs.Where(m => m.DrugId == id).FirstOrDefault();
            var qty     = getdata.TotalQuantityAvailable;

            return(Json(qty, JsonRequestBehavior.AllowGet));
        }
        public ActionResult UpdateAppointments(int id, string str)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var obj = db.DoctorAppointments.Where(m => m.AppointmentId == (id)).FirstOrDefault();

            obj.AppointmentStatus = str;

            db.SaveChanges();
            return(RedirectToAction("ViewAppointment", "Doctor"));
        }
        public ActionResult DeleteDrug(string id)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var did     = Convert.ToInt32(id);
            var getdata = db.Drugs.Where(m => m.DrugId == did).FirstOrDefault();

            getdata.IsDeleted = true;
            db.SaveChanges();
            return(RedirectToAction("ViewEditDrugs", "Admin"));
        }
Esempio n. 10
0
        public ActionResult TakeAppointment(DataModel dm, string datet)
        {
            //to save the date value entered by the patient  pass the id of the input in the action result
            //and then assign that value to dt
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id = Convert.ToInt32(Session["MemberId"]);

            DateTime date = Convert.ToDateTime(datet);
            var      chk  = date.Hour;

            if (chk < 9 || chk > 17)
            {
                ViewBag.text = "Time should be chosen between 9 AM to 5 PM";
            }
            else
            {
                var sysdate = DateTime.Now;
                var getpid  = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();
                dm.PatientId = getpid.PatientId;

                if (date > sysdate)
                {
                    dm.AppointmentDate = Convert.ToDateTime(date);
                    //call procedure AddAppointment() to insert values in the db
                    db.AddAppointment(dm.PatientId, dm.DoctorId, dm.Subject, dm.Description, dm.AppointmentDate);
                    ViewBag.text = "Appointment recieved by the doctor";
                }
                else
                {
                    ViewBag.text = "Date incorrect";
                }
            }


            var getdata = db.Doctors.ToList();
            List <SelectListItem> lst = new List <SelectListItem>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    string name = String.Concat(item.FirstName, " ", item.LastName);
                    lst.Add(new SelectListItem
                    {
                        Text  = name,
                        Value = item.DoctorId.ToString()
                    }
                            );;
                }
            }

            dm.ListD = lst;
            return(View(dm));
        }
        public ActionResult ViewAppointment()
        {
            DataModel dm = new DataModel();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();

            var id     = Convert.ToInt32(Session["MemberId"]);
            var getpid = db.Doctors.Where(m => m.MemberId == id).FirstOrDefault();

            var getdata = from a in db.DoctorAppointments
                          join p in db.Patients
                          on a.PatientId equals p.PatientId
                          select new
            {
                a.AppointmentDate,
                a.AppointmentStatus,
                a.Subject,
                a.Description,
                a.AppointmentId,
                a.DoctorId,
                p.FirstName,
                p.Gender
            }
            ;
            List <DataModel> dmlist = new List <DataModel>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    if (item.DoctorId == getpid.DoctorId)
                    {
                        dmlist.Add(new DataModel
                        {
                            FirstName         = item.FirstName,
                            AppointmentDate   = item.AppointmentDate,
                            Gender            = item.Gender,
                            AppointmentStatus = item.AppointmentStatus,
                            Subject           = item.Subject,
                            Description       = item.Description,
                            AppointmentId     = item.AppointmentId
                        });
                    }
                }

                dm.AppointmentList = dmlist;
            }
            else
            {
                ViewBag.text = "No Appointments yet";
            }
            return(View(dm));
        }
        public ActionResult ViewMessage()
        {
            DataModel        dt   = new DataModel();
            List <DataModel> dlst = new List <DataModel>();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id       = Convert.ToInt32(Session["MemberId"]);
            var docemail = db.MemberLogins.Where(m => m.MemberId == id).FirstOrDefault();
            var getdata  = (from i in db.Inboxes
                            join M in db.MemberLogins
                            on i.FromEmailId equals M.Email
                            join P in db.Patients
                            on M.MemberId equals P.MemberId
                            where i.ToEmailId == docemail.Email && i.ReplyId == 0
                            select new
            {
                P.FirstName,
                i.FromEmailId,
                i.ToEmailId,
                i.MessageDate,
                i.MessageDetail,
                i.MessageId,
                i.Subject
            }).ToList();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    dlst.Add(new DataModel
                    {
                        MessageDetails = item.MessageDetail,
                        Subject        = item.Subject,
                        FromEmail      = item.FromEmailId,
                        ToEmail        = item.ToEmailId,
                        MsgDate        = item.MessageDate,
                        FirstName      = item.FirstName
                    });
                }
            }
            else
            {
                ViewBag.text = "No Messages to View";
            }

            dt.MsgList = dlst;
            return(View(dt));
        }
        // GET: Admin
        public ActionResult Home()
        {
            var id = Convert.ToInt32(Session["MemberId"]);
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var chkname = db.Admins.Where(m => m.MemberId == id).FirstOrDefault();

            if (chkname == null)
            {
                Session["name"] = null;
            }
            else
            {
                Session["name"] = chkname.FirstName;
            }

            return(View());
        }
        public ActionResult EditDrug(string id)
        {
            DrugModel dm = new DrugModel();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            int did     = Convert.ToInt32(id);
            var getdata = db.Drugs.Where(m => m.DrugId == did).FirstOrDefault();

            dm.DrugName        = getdata.DrugName;
            dm.ManufactureDate = getdata.ManufactureDate;
            dm.ExpiryDate      = getdata.ExpiryDate;
            dm.SideEffects     = getdata.SideEffects;
            dm.UsedFor         = getdata.UsedFor;
            dm.TotalQuantity   = getdata.TotalQuantityAvailable;
            dm.IsDeleted       = getdata.IsDeleted;
            dm.DrugId          = getdata.DrugId;
            return(View(dm));
        }
Esempio n. 15
0
        public ActionResult SendMessage()
        {
            DataModel        dt   = new DataModel();
            List <DataModel> dlst = new List <DataModel>();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id      = Convert.ToInt32(Session["MemberId"]);
            var getpid  = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();
            var status  = db.DoctorAppointments.Where(m => m.PatientId == id);
            var getdata = from a in db.DoctorAppointments
                          join d in db.Doctors
                          on a.DoctorId equals d.DoctorId
                          where a.PatientId == getpid.PatientId
                          select new
            {
                a.AppointmentStatus,
                a.AppointmentDate,
                a.DoctorId,
                a.PatientId,
                d.FirstName
            };

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    if (item.AppointmentStatus == "Accepted")
                    {
                        dlst.Add(new DataModel
                        {
                            FirstName       = item.FirstName,
                            AppointmentDate = item.AppointmentDate,
                            PatientId       = item.PatientId,
                            DoctorId        = item.DoctorId
                        });
                    }
                }

                dt.MsgList = dlst;
            }
            else
            {
                ViewBag.text = "No Accepted Appoitments yet";
            }
            return(View(dt));
        }
Esempio n. 16
0
        public ActionResult Register()
        {
            Clinic_automation_systemEntities db  = new Clinic_automation_systemEntities();
            List <SelectListItem>            lst = new List <SelectListItem>();
            DataModel dm      = new DataModel();
            var       getdata = db.RoleDetails.ToList();

            for (int i = 0; i < 3; i++)
            {
                lst.Add(new SelectListItem
                {
                    Text  = getdata[i].RoleName,
                    Value = getdata[i].RoleId.ToString()
                });
            }
            dm.RoleList = lst;
            return(View(dm));
        }
        public ActionResult ViewPatientOrders()
        {
            DrugModel dm = new DrugModel();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = from d in db.Drugs
                          join o in db.PatientOrderDetails
                          on d.DrugId equals o.DrugId
                          join p in db.Patients
                          on o.PatientId equals p.PatientId
                          select new
            {
                d.DrugName,
                o.Quantity,
                p.FirstName,
                o.OrderDate,
                o.OrderStatus,
                o.OrderNumber,
                o.OrderId
            };
            List <DrugModel> dmlst = new List <DrugModel>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    dmlst.Add(new DrugModel
                    {
                        DrugName      = item.DrugName,
                        OrderId       = item.OrderId,
                        Name          = item.FirstName,
                        OrderDate     = item.OrderDate,
                        OrderStatus   = item.OrderStatus,
                        OrderQuantity = item.Quantity,
                        OrderNumber   = item.OrderNumber
                    });
                }
                dm.DrugList = dmlst;
            }
            else
            {
                ViewBag.text = "No Orders Yet";
            }
            return(View(dm));
        }
Esempio n. 18
0
        public ActionResult OrderDrug(DrugModel dm)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getqty             = db.Drugs.Where(m => m.DrugId == dm.DrugId).FirstOrDefault();
            int id                 = Convert.ToInt32(Session["MemberId"]);
            var getpid             = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();
            int month              = DateTime.Now.Month;
            PatientOrderDetail obj = new PatientOrderDetail();

            if (dm.OrderQuantity < getqty.TotalQuantityAvailable)
            {
                obj.PatientId   = getpid.PatientId;
                obj.DrugId      = dm.DrugId;
                obj.OrderDate   = DateTime.Now;
                obj.Quantity    = dm.OrderQuantity;
                obj.OrderStatus = "Requested";
                db.PatientOrderDetails.Add(obj);
                getqty.TotalQuantityAvailable = getqty.TotalQuantityAvailable - dm.OrderQuantity;
                db.SaveChanges();
                ViewBag.text = "Order placed successfully";
            }
            else
            {
                ViewBag.text = "Order Quantity cannot exceed Total Quantity";
            }

            var getdata = db.Drugs.Where(m => m.IsDeleted == false).ToList();

            List <SelectListItem> lst = new List <SelectListItem>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    lst.Add(new SelectListItem
                    {
                        Text  = item.DrugName,
                        Value = item.DrugId.ToString()
                    });
                }
                dm.DrugNameList = lst;
            }
            return(View(dm));
        }
Esempio n. 19
0
        public ActionResult EditProfile(DataModel dt)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id = Convert.ToInt32(Session["MemberId"]);



            dt.MemberId = id;
            var      getdata     = db.Suppliers.Where(m => m.MemberId == id).FirstOrDefault();
            Supplier objSupplier = new Supplier();

            if (getdata != null)
            {
                getdata.FirstName      = dt.FirstName;
                getdata.LastName       = dt.LastName;
                getdata.CompanyName    = dt.CompanyName;
                getdata.CompanyAddress = dt.CompanyAddress;
            }
            else
            {
                objSupplier.FirstName      = dt.FirstName;
                objSupplier.LastName       = dt.LastName;
                objSupplier.CompanyName    = dt.CompanyName;
                objSupplier.CompanyAddress = dt.CompanyAddress;
                objSupplier.MemberId       = dt.MemberId;
                db.Suppliers.Add(objSupplier);
            }

            db.SaveChanges();
            var chkname = db.Suppliers.Where(m => m.MemberId == id).FirstOrDefault();

            if (chkname != null)
            {
                Session["name"] = chkname.FirstName;
            }
            else
            {
                Session["name"] = null;
            }
            ViewBag.text = "data inserted";
            return(View(dt));
        }
        public ActionResult ChangePwd(PwdModel dt)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.MemberLogins.Where(m => m.MemberId == Convert.ToInt32(Session["MemberId"])).FirstOrDefault();

            if (ModelState.IsValid)
            {
                if (getdata.Password == dt.OldPassword)
                {
                    getdata.Password = dt.NewPassword;
                    ViewBag.text     = "Password Changed Successfully";
                }
                else
                {
                    ViewBag.text = "You entered a wrong current password";
                }
            }

            return(View());
        }
Esempio n. 21
0
        public ActionResult EditProfile(DataModel dt)
        {
            var id = Convert.ToInt32(Session["MemberId"]);
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            Patient objPatient = new Patient();
            var     getdata    = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();

            if (getdata != null)
            {
                getdata.FirstName   = dt.FirstName;
                getdata.LastName    = dt.LastName;
                getdata.DateOfBirth = dt.DOB;
                getdata.Address     = dt.Address;
                getdata.Gender      = dt.Gender;
            }
            else
            {
                objPatient.FirstName   = dt.FirstName;
                objPatient.LastName    = dt.LastName;
                objPatient.Gender      = dt.Gender;
                objPatient.DateOfBirth = dt.DOB;
                objPatient.Address     = dt.Address;
                objPatient.MemberId    = Convert.ToInt32(Session["MemberId"]);
                db.Patients.Add(objPatient);
            }

            db.SaveChanges();
            ViewBag.text = "Data inserted successfully.";

            var chkname = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();

            if (chkname != null)
            {
                Session["name"] = chkname.FirstName;
            }
            else
            {
                Session["name"] = null;
            }
            return(View(dt));
        }
        public ActionResult AddDrugDetails(DrugModel dt)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            Drug objdrug = new Drug();

            if (ModelState.IsValid)
            {
                objdrug.DrugName               = dt.DrugName;
                objdrug.UsedFor                = dt.UsedFor;
                objdrug.SideEffects            = dt.SideEffects;
                objdrug.ManufactureDate        = dt.ManufactureDate;
                objdrug.ExpiryDate             = dt.ExpiryDate;
                objdrug.TotalQuantityAvailable = dt.TotalQuantity;

                db.Drugs.Add(objdrug);
                db.SaveChanges();
                ViewBag.text = "Added Successfully";
            }

            return(View());
        }
Esempio n. 23
0
        public ActionResult EditProfile()
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            DataModel dt = new DataModel();
            var       id = Convert.ToInt32(Session["MemberId"]);

            var getdata = db.Suppliers.Where(m => m.MemberId == id).FirstOrDefault();

            if (getdata != null)
            {
                dt.FirstName      = getdata.FirstName;
                dt.LastName       = getdata.LastName;
                dt.CompanyAddress = getdata.CompanyAddress;
                dt.CompanyName    = getdata.CompanyName;
            }
            else
            {
                dt.FirstName = null;
            }

            return(View(dt));
        }
Esempio n. 24
0
        public ActionResult ViewOrders()
        {
            DrugModel dm = new DrugModel();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            int id      = Convert.ToInt32(Session["MemberId"]);
            var getpid  = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();
            var getdata = from d in db.Drugs
                          join o in db.PatientOrderDetails
                          on d.DrugId equals o.DrugId
                          where o.PatientId == getpid.PatientId
                          select new {
                o.OrderDate,
                o.OrderStatus,
                o.Quantity,
                d.DrugName
            };
            List <DrugModel> dmlst = new List <DrugModel>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    dmlst.Add(new DrugModel
                    {
                        DrugName      = item.DrugName,
                        OrderQuantity = item.Quantity,
                        OrderStatus   = item.OrderStatus,
                        OrderDate     = item.OrderDate
                    });
                }
                dm.DrugList = dmlst;
            }
            else
            {
                ViewBag.text = "No Orders Yet";
            }
            return(View(dm));
        }
        public ActionResult EditDrug(DrugModel dm)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.Drugs.Where(m => m.DrugId == dm.DrugId).FirstOrDefault();

            if (ModelState.IsValid)
            {
                getdata.DrugName               = dm.DrugName;
                getdata.UsedFor                = dm.UsedFor;
                getdata.SideEffects            = dm.SideEffects;
                getdata.ManufactureDate        = dm.ManufactureDate;
                getdata.ExpiryDate             = dm.ExpiryDate;
                getdata.IsDeleted              = dm.IsDeleted;
                getdata.TotalQuantityAvailable = dm.TotalQuantity;
                db.SaveChanges();
                return(RedirectToAction("ViewEditDrugs", "Admin"));
            }
            else
            {
                ViewBag.text = "no";
            }
            return(View());
        }
Esempio n. 26
0
        public ActionResult Message(DataModel dt)
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var id           = Convert.ToInt32(Session["MemberId"]);
            var getfromemail = db.MemberLogins.Where(m => m.MemberId == id).FirstOrDefault();

            var docid      = db.Doctors.Where(m => m.DoctorId == dt.DoctorId).FirstOrDefault();
            var gettoemail = db.MemberLogins.Where(m => m.MemberId == docid.MemberId).FirstOrDefault();

            Inbox obj = new Inbox();

            obj.FromEmailId   = getfromemail.Email;
            obj.ToEmailId     = gettoemail.Email;
            obj.Subject       = dt.Subject;
            obj.MessageDetail = dt.MessageDetails;
            obj.MessageDate   = DateTime.Now;
            obj.ReplyId       = 0;
            obj.IsRead        = false;
            db.Inboxes.Add(obj);
            db.SaveChanges();
            ViewBag.text = "Message Sent";
            return(View());
        }
Esempio n. 27
0
        public ActionResult EditProfile()
        {
            var       id = Convert.ToInt32(Session["MemberId"]);
            DataModel dt = new DataModel();
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.Patients.Where(m => m.MemberId == id).FirstOrDefault();

            if (getdata != null)
            {
                dt.FirstName = getdata.FirstName;
                dt.LastName  = getdata.LastName;
                dt.Gender    = getdata.Gender;
                dt.Address   = getdata.Address;
                dt.DOB       = getdata.DateOfBirth;
            }
            else
            {
                dt.FirstName = null;
            }


            return(View(dt));
        }
        public ActionResult EditProfile()
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            DataModel dt = new DataModel();
            var       id = Convert.ToInt32(Session["MemberId"]);

            var getdata = db.Doctors.Where(m => m.MemberId == id).FirstOrDefault();

            if (getdata != null)
            {
                dt.FirstName        = getdata.FirstName;
                dt.LastName         = getdata.LastName;
                dt.Gender           = getdata.Gender;
                dt.SpecializationId = getdata.SpecializedId;
                dt.TotalExperience  = getdata.TotalExperience;
            }
            else
            {
                dt.FirstName = null;
            }


            List <SelectListItem> lst = new List <SelectListItem>();// LOCAL LIST
            var getspec = db.SpecializedDetails.ToList();

            foreach (var item in getspec)
            {
                lst.Add(new SelectListItem
                {
                    Text  = item.SpecializedName,
                    Value = item.SpecializedId.ToString()
                });
            }
            dt.SpecList = lst;

            return(View(dt));
        }
Esempio n. 29
0
        public ActionResult TakeAppointment()
        {
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.Doctors.ToList();
            List <SelectListItem> lst = new List <SelectListItem>();

            if (getdata != null)
            {
                foreach (var item in getdata)
                {
                    string name = String.Concat(item.FirstName, " ", item.LastName);
                    lst.Add(new SelectListItem
                    {
                        Text  = name,
                        Value = item.DoctorId.ToString()
                    }
                            );;
                }
            }
            DataModel dm = new DataModel();

            dm.ListD = lst;
            return(View(dm));
        }
Esempio n. 30
0
        public ActionResult Login(DataModel dm)
        {
            int status = -1;
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.MemberLogins.ToList();

            foreach (var item in getdata)
            {
                if (item.Email == dm.Email && item.Password == dm.Password)
                {
                    FormsAuthentication.SetAuthCookie(dm.Email, false);
                    var authTicket = new FormsAuthenticationTicket(
                        1,
                        item.Email,
                        DateTime.Now,
                        DateTime.Now.AddMinutes(20),
                        false, item.Email);
                    string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                    var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                    HttpContext.Response.Cookies.Add(authCookie);

                    dm.MemberId         = item.MemberId;
                    Session["Email"]    = dm.Email;
                    Session["MemberId"] = dm.MemberId;

                    dm.RoleId = item.RoleId;
                    status    = 0;
                    break;
                }
            }

            if (status == 0)
            {
                switch (dm.RoleId)
                {
                case 1:
                    return(RedirectToAction("Home", "Patient"));    // home view action method of Patient Controller

                    break;

                case 2:
                    return(RedirectToAction("Home", "Doctor"));

                    break;

                case 3:
                    return(RedirectToAction("Home", "Supplier"));

                    break;

                case 4:
                    return(RedirectToAction("Home", "Admin"));

                    break;

                default:
                    break;
                }
            }
            else
            {
                ViewBag.text = "Email or Password Incorrect";
            }
            return(View());
        }