Exemple #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(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 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));
        }
        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"));
        }
        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"));
        }
Exemple #6
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));
        }
Exemple #7
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));
        }
Exemple #8
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());
        }
        public ActionResult ChangePwd(PwdModel dt)
        {
            var id = Convert.ToInt32(Session["MemberId"]);
            Clinic_automation_systemEntities db = new Clinic_automation_systemEntities();
            var getdata = db.MemberLogins.Where(m => m.MemberId == id).FirstOrDefault();

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

            return(View());
        }
        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());
        }
Exemple #12
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());
        }