public ActionResult Register()
        {
            ClASDBEntities        db  = new ClASDBEntities();
            MemberLogin           obj = new MemberLogin();
            List <SelectListItem> l   = new List <SelectListItem>();
            var getdata = db.RoleDetails.ToList();

            foreach (var item in getdata)
            {
                if (item.RoleId == 1)
                {
                    continue;
                }
                else
                {
                    l.Add(new SelectListItem
                    {
                        Text  = item.RoleName,
                        Value = item.RoleId.ToString()
                    });
                }
            }
            DataModel dt = new DataModel();

            dt.ListR = l;
            return(View(dt));
        }
示例#2
0
        public ActionResult TakeAppointment(PatientModel pm)
        {
            ClASDBEntities        db   = new ClASDBEntities();
            List <SelectListItem> lst1 = new List <SelectListItem>();
            var getdata = db.Doctors.Select(m => new { m.DoctorId, m.FirstName }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new SelectListItem
                {
                    Text  = item.FirstName,
                    Value = item.DoctorId.ToString()
                });
            }

            pm.ListD = lst1;
            var memId             = Convert.ToInt32(Session["MemberId"]);
            var pid               = db.Patients.Where(m => m.MemberID == memId).FirstOrDefault();
            DoctorAppointment obj = new DoctorAppointment();

            obj.DoctorId          = pm.DoctorId;
            obj.AppointmentDate   = pm.AppointDate;
            obj.AppointmentStatus = "Requested";
            obj.PatientId         = pid.PatientID;
            obj.Description       = pm.AppointDesc;
            obj.Subject           = pm.AppointSub;
            db.DoctorAppointments.Add(obj);
            db.SaveChanges();
            ViewBag.text = "Appointment Requested";
            return(View(pm));
        }
        public ActionResult ChangePassword(ChangePasswordModel cm)
        {
            int MemId = Convert.ToInt32(Session["MemberID"]);

            ClASDBEntities db      = new ClASDBEntities();
            var            getPass = db.MemberLogins.FirstOrDefault(m => m.MemberID == MemId);

            if (ModelState.IsValid)
            {
                if (getPass.Password == cm.OldPassword)
                {
                    getPass.Password = cm.NewPassword;
                    db.SaveChanges();
                    ViewBag.text = "Password changed...";
                }
                else
                {
                    ViewBag.text = "Old Password did not match!!!";
                }
            }
            else
            {
                ViewBag.text = "Confirm new Password once again...";
            }
            return(View(cm));
        }
示例#4
0
        public ActionResult SendMessageTo()
        {
            var            memId = Convert.ToInt32(Session["MemberId"]);
            ClASDBEntities db    = new ClASDBEntities();
            PatientModel   am    = new PatientModel();
            //var currentPat = db.Patients.FirstOrDefault(m => m.MemberID == memId);
            List <PatientModel> lst1 = new List <PatientModel>();
            var patId   = Convert.ToInt32(Session["ID"]);
            var getdata = (from a in db.Doctors
                           join d in db.DoctorAppointments
                           on a.DoctorId equals d.DoctorId

                           where (d.AppointmentStatus == "Accepted" && d.PatientId == patId)
                           select new { a.FirstName, d.AppointmentId, d.AppointmentDate, d.AppointmentStatus }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new PatientModel
                {
                    //DoctorId=item.DoctorId,
                    AppointId   = item.AppointmentId,
                    DoctorName  = item.FirstName,
                    AppointDate = item.AppointmentDate
                });
            }
            am.ListApp = lst1;
            return(View(am));
        }
示例#5
0
        public ActionResult EditProfile(DoctorModel dm)
        {
            ClASDBEntities        db   = new ClASDBEntities();
            List <SelectListItem> lst1 = new List <SelectListItem>();
            var getd = db.SpecializedDatas.ToList();

            foreach (var item in getd)
            {
                lst1.Add(new SelectListItem
                {
                    Text  = item.SpecializedName,
                    Value = item.SpecializedId.ToString()
                });
            }
            int MemId   = Convert.ToInt32(Session["MemberId"]);
            var getdata = db.Doctors.FirstOrDefault(m => m.MemberId == MemId);

            getdata.FirstName       = dm.FName;
            getdata.LastName        = dm.LName;
            getdata.SpecislizeId    = dm.SpecializeId;
            getdata.TotalExperience = dm.Experience;
            getdata.Gender          = dm.Gender;



            DoctorModel dt = new DoctorModel();

            dt.ListS = lst1;
            db.SaveChanges();
            ViewBag.text = "Edited Successfully";
            return(View(dt));
        }
      public ActionResult ViewEditDrug()
      {
          ClASDBEntities      db      = new ClASDBEntities();
          Drug                d       = new Drug();
          AddDrugModel        adm     = new AddDrugModel();
          var                 getdata = db.Drugs.ToList();
          List <AddDrugModel> lst1    = new List <AddDrugModel>();

          //string value = "";
          foreach (var item in getdata)
          {
              lst1.Add(new AddDrugModel
                {
                    DName     = item.DrugName,
                    DrugId    = item.DrugID,
                    MfgDate   = item.ManufactureDate,
                    ExpDate   = item.ExpiryDate,
                    IsDeleted = item.IsDeleted,
                    SideEff   = item.SideEffect,
                    Qtty      = item.TotalQuantityAvailable,
                    Use       = item.UsedFor
                });
          }

          adm.ListDrug = lst1;
          return(View(adm));
      }
示例#7
0
        public ActionResult getQuant(int id)
        {
            ClASDBEntities db = new ClASDBEntities();
            //OrderModel od = new OrderModel();
            var getd      = db.Drugs.Where(m => m.DrugID == id).FirstOrDefault();
            var totalQtty = getd.TotalQuantityAvailable;

            return(Json(totalQtty, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        public ActionResult OrderDrug(OrderModel od)
        {
            ClASDBEntities     db  = new ClASDBEntities();
            PatientOrderDetail pod = new PatientOrderDetail();


            List <SelectListItem> listD = new List <SelectListItem>();
            var getdata = (from d in db.Drugs where d.IsDeleted == "No" select new { d.DrugID, d.DrugName }).ToList();

            foreach (var item in getdata)
            {
                listD.Add(new SelectListItem
                {
                    Text  = item.DrugName,
                    Value = Convert.ToString(item.DrugID)
                });
            }
            od.ListDrug = listD;
            Random r = new Random();

            var patId   = Convert.ToInt32(Session["ID"]);
            var getd    = db.Drugs.Where(m => m.DrugID == od.DrugId).FirstOrDefault();
            var getQtty = getd.TotalQuantityAvailable;

            //od.TotalQtty = getQtty;
            if (ModelState.IsValid)
            {
                if (od.OrderQtty == 0)
                {
                    ViewBag.text = "Enter order quantity more than 0!";
                }
                else if (od.OrderQtty <= getQtty)
                {
                    //getd.TotalQuantityAvailable = getQtty - od.OrderQtty;
                    ViewBag.text    = "Placing Order...";
                    pod.DrugId      = od.DrugId;
                    pod.OrderStatus = "Requested";
                    pod.PatientID   = patId;
                    pod.Quantity    = od.OrderQtty;
                    pod.OrderNumber = r.Next(1, 1000);
                    pod.OrderDate   = DateTime.Now;
                    db.PatientOrderDetails.Add(pod);
                    db.SaveChanges();
                }
                else
                {
                    ViewBag.text = "Enter order quantity less than available quantity!";
                }
                ViewBag.text2 = "Order Placed!";
            }
            else
            {
                ViewBag.text2 = "Error Occurred!";
            }
            return(View(od));
        }
      public ActionResult DeleteDrug(int id)
      {
          ClASDBEntities db = new ClASDBEntities();
          var            d  = db.Drugs.Where(m => m.DrugID == id).FirstOrDefault();

          d.IsDeleted = "Yes";
          db.SaveChanges();
          ViewBag.Text = "Deleted Successfully";
          return(RedirectToAction("ViewEditDrug", "Admin"));
      }
示例#10
0
        public ActionResult UpdateAppointments(int id, string str)
        {
            ClASDBEntities db = new ClASDBEntities();
            //DoctorAppointment obj = new DoctorAppointment();
            var getApp = db.DoctorAppointments.FirstOrDefault(m => m.AppointmentId == id);

            getApp.AppointmentStatus = str;
            db.SaveChanges();

            return(RedirectToAction("ViewAppointments", "Doctor"));
        }
      public ActionResult Assign(int sid, int ono)
      {
          ClASDBEntities db = new ClASDBEntities();
          DrugDelivery   dd = new DrugDelivery();

          var getdata = db.PatientOrderDetails.Where(m => m.OrderID == ono).FirstOrDefault();

          getdata.OrderStatus = "Assigned";
          dd.OrderID          = ono;
          dd.SupplierId       = sid;
          db.DrugDeliveries.Add(dd);
          db.SaveChanges();
          return(RedirectToAction("ViewPatientOrders", "Admin"));
      }
示例#12
0
        public ActionResult EditProfile(PatientModel dm)
        {
            ClASDBEntities db = new ClASDBEntities();

            int MemId   = Convert.ToInt32(Session["MemberId"]);
            var getdata = db.Patients.FirstOrDefault(m => m.MemberID == MemId);

            getdata.FirstName = dm.FName;
            getdata.LastName  = dm.LName;
            getdata.Address   = dm.Address;
            getdata.DOB       = dm.DOB;
            getdata.Gender    = dm.Gender;
            db.SaveChanges();
            ViewBag.text = "Edited Successfully";
            return(View(dm));
        }
示例#13
0
        // GET: Doctor
        public ActionResult Index()
        {
            ClASDBEntities db        = new ClASDBEntities();
            int            MemId     = Convert.ToInt32(Session["MemberId"]);
            var            checkName = db.Doctors.Where(m => m.MemberId == MemId).FirstOrDefault();

            if (checkName.FirstName != null)
            {
                Session["name"] = checkName.FirstName;
            }
            else
            {
                Session["name"] = null;
            }
            return(View());
        }
      public ActionResult ViewOrders()
      {
          var memId = Convert.ToInt32(Session["MemberId"]);

          ClASDBEntities db = new ClASDBEntities();
          //var currentDocID = db.Doctors.FirstOrDefault(m => m.MemberId == memId);
          List <ViewOrderModel> lst = new List <ViewOrderModel>();
          var id      = Convert.ToInt32(Session["ID"]);
          var getdata = (from od in db.PatientOrderDetails
                         join d in db.Drugs
                         on od.DrugId equals d.DrugID
                         join dd in db.DrugDeliveries
                         on od.OrderID equals dd.OrderID
                         where dd.SupplierId == id
                         select new
            {
                od.OrderNumber,
                dd.SupplierId,
                d.DrugID,
                od.OrderID,
                d.DrugName,
                od.OrderDate,
                od.Quantity,
                od.OrderStatus
            });

          foreach (var item in getdata)
          {
              lst.Add(new ViewOrderModel
                {
                    OrderID     = item.OrderID,
                    SupplierId  = item.SupplierId,
                    OrderDate   = item.OrderDate,
                    DrugId      = item.DrugID,
                    DrugName    = item.DrugName,
                    OrderStatus = item.OrderStatus,
                    OrderQtty   = item.Quantity,
                    OrderNo     = item.OrderNumber
                });
          }
          ViewOrderModel dm = new ViewOrderModel();

          dm.ListOrder = lst;


          return(View(dm));
      }
        public ActionResult Login(DataModel dt)
        {
            ClASDBEntities db      = new ClASDBEntities();
            var            getdata = db.MemberLogins.FirstOrDefault
                                         (m => m.EmailId == dt.Email && m.Password == dt.Password);


            if (getdata != null)
            {
                var    getRole  = db.RoleDetails.Where(m => m.RoleId == getdata.RoleId).Select(m => m.RoleName).FirstOrDefault();
                string Rolename = getRole.ToString();
                FormsAuthentication.SetAuthCookie(dt.Email, false);
                var authTicket = new FormsAuthenticationTicket(
                    1,
                    getdata.EmailId,
                    DateTime.Now,
                    DateTime.Now.AddMinutes(20),
                    false, Rolename);
                string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
                var    authCookie      = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
                HttpContext.Response.Cookies.Add(authCookie);
                Session["MemberId"] = getdata.MemberID;
                Session["EmailId"]  = dt.Email;
                Session["RoleName"] = Rolename;
                switch (getdata.RoleId)
                {
                case (1):
                    return(RedirectToAction("Index", "Admin"));

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

                case (3):
                    return(RedirectToAction("Index", "Patient"));

                case (4):
                    return(RedirectToAction("Index", "Supplier"));
                }
            }
            else
            {
                ViewBag.text = "Invalid email or password";
            }
            return(View());
        }
      public ActionResult EditDrug(int id)
      {
          ClASDBEntities db      = new ClASDBEntities();
          var            getdata = db.Drugs.Where(m => m.DrugID == id).FirstOrDefault();
          AddDrugModel   adm     = new AddDrugModel();

          adm.DName   = getdata.DrugName;
          adm.DrugId  = getdata.DrugID;
          adm.ExpDate = getdata.ExpiryDate;
          adm.MfgDate = getdata.ManufactureDate;
          adm.Qtty    = getdata.TotalQuantityAvailable;
          adm.SideEff = getdata.SideEffect;
          adm.Use     = getdata.UsedFor;

          adm.IsDeleted = getdata.IsDeleted;


          return(View(adm));
      }
示例#17
0
        public ActionResult OrderDrug()
        {
            ClASDBEntities        db    = new ClASDBEntities();
            List <SelectListItem> listD = new List <SelectListItem>();
            var getdata = (from d in db.Drugs where d.IsDeleted != "Yes" select new { d.DrugID, d.DrugName }).ToList();

            foreach (var item in getdata)
            {
                listD.Add(new SelectListItem
                {
                    Text  = item.DrugName,
                    Value = Convert.ToString(item.DrugID)
                });
            }
            OrderModel od = new OrderModel();

            od.ListDrug = listD;
            return(View(od));
        }
示例#18
0
        public ActionResult TakeAppointment()
        {
            ClASDBEntities db = new ClASDBEntities();

            List <SelectListItem> lst1 = new List <SelectListItem>();
            var getdata = db.Doctors.Select(m => new { m.DoctorId, m.FirstName }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new SelectListItem
                {
                    Text  = item.FirstName,
                    Value = item.DoctorId.ToString()
                });
            }
            PatientModel pm = new PatientModel();

            pm.ListD = lst1;
            return(View(pm));
        }
示例#19
0
        public ActionResult EditProfile()
        {
            ClASDBEntities db = new ClASDBEntities();

            List <SelectListItem> lst1 = new List <SelectListItem>();
            var getdata = db.SpecializedDatas.ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new SelectListItem
                {
                    Text  = item.SpecializedName,
                    Value = item.SpecializedId.ToString()
                });
            }
            DoctorModel dt = new DoctorModel();

            dt.ListS = lst1;
            return(View(dt));
        }
示例#20
0
        public ActionResult Inbox(PatientModel pm)
        {
            ClASDBEntities db     = new ClASDBEntities();
            Inbox          obj    = new Inbox();
            var            memId  = Convert.ToInt32(Session["MemberId"]);
            var            sender = db.MemberLogins.Where(m => m.MemberID == memId).FirstOrDefault();

            //Id = Convert.ToInt32(Id);
            pm.FrmEmail = sender.EmailId;
            //if(ModelState.IsValid)
            //{
            //var sender = Session["EmailId"].ToString();
            //string sender = db.MemberLogins.Where(m => m.MemberID == memId).Select(a => new { a.EmailId }).ToString();
            var doc = (from da in db.DoctorAppointments
                       join d in db.Doctors
                       on da.DoctorId equals d.DoctorId
                       join m in db.MemberLogins
                       on d.MemberId equals m.MemberID
                       where da.AppointmentId == pm.AppointId
                       select new { m.EmailId }).FirstOrDefault();

            obj.Subject       = pm.MsgSub;
            obj.MessageDetail = pm.MsgDetail;
            obj.MessageDate   = System.DateTime.Now;

            obj.IsRead      = "0";
            obj.FromEmailId = sender.EmailId;
            obj.ToEmailId   = doc.EmailId;

            db.Inboxes.Add(obj);
            db.SaveChanges();
            ViewBag.text = "Message Sent";
            //}
            //else
            //{
            //    ViewBag.Text = "Message not sent";
            //}


            return(View(pm));
        }
示例#21
0
        //[HttpPost]
        public ActionResult ViewAppointments()
        {
            var memId = Convert.ToInt32(Session["MemberId"]);

            ClASDBEntities     db           = new ClASDBEntities();
            var                currentDocID = db.Doctors.FirstOrDefault(m => m.MemberId == memId);
            List <DoctorModel> lst          = new List <DoctorModel>();
            //DoctorAppointment obj = new DoctorAppointment();
            var getdata = (from m in db.DoctorAppointments
                           join t in db.Patients
                           on m.PatientId equals t.PatientID
                           where (m.DoctorId == currentDocID.DoctorId)
                           select new
                           { m.AppointmentId,
                             m.AppointmentDate,
                             m.DoctorId,
                             m.Subject,
                             m.Description,
                             m.AppointmentStatus,
                             m.PatientId,
                             t.FirstName });

            foreach (var item in getdata)
            {
                lst.Add(new DoctorModel
                {
                    DoctorId      = item.DoctorId,
                    PatientId     = item.PatientId,
                    AppointDate   = item.AppointmentDate,
                    AppointSub    = item.Subject,
                    AppointDesc   = item.Description,
                    AppointStatus = item.AppointmentStatus,
                    PatientName   = item.FirstName,
                    AppointId     = item.AppointmentId
                });
            }
            DoctorModel dm = new DoctorModel();

            dm.ListApp = lst;
            return(View(dm));
        }
      public ActionResult EditProfile(SupplierModel sm)
      {
          ClASDBEntities db = new ClASDBEntities();

          if (ModelState.IsValid)
          {
              int MemId   = Convert.ToInt32(Session["MemberId"]);
              var getdata = db.Suppliers.FirstOrDefault(m => m.MemberId == MemId);
              getdata.FirstName      = sm.FName;
              getdata.LastName       = sm.LName;
              getdata.CompanyName    = sm.CompName;
              getdata.CompanyAddress = sm.CompAdd;
              db.SaveChanges();
              ViewBag.text = "Edited Successfully";
          }
          else
          {
              ViewBag.text = "Error Occurred!!";
          }
          return(View(sm));
      }
 public ActionResult EditDrug(AddDrugModel ad, int id)
 {
     if (ModelState.IsValid)
     {
         ClASDBEntities db = new ClASDBEntities();
         var            d  = db.Drugs.Where(m => m.DrugID == id).FirstOrDefault();
         d.DrugName               = ad.DName;
         d.ManufactureDate        = ad.MfgDate;
         d.ExpiryDate             = ad.ExpDate;
         d.SideEffect             = ad.SideEff;
         d.TotalQuantityAvailable = ad.Qtty;
         d.IsDeleted              = ad.IsDeleted;
         d.UsedFor = ad.Use;
         db.SaveChanges();
         ViewBag.text = "Edited Successfully";
     }
     else
     {
         ViewBag.text = "Error Occured";
     }
     return(RedirectToAction("ViewEditDrug", "Admin"));
 }
示例#24
0
        public ActionResult ViewAllMessages(MessageModel pm, int id)
        {
            ClASDBEntities db  = new ClASDBEntities();
            Inbox          obj = new Inbox();

            List <MessageModel> lst1 = new List <MessageModel>();
            //var patId = Convert.ToInt32(Session["ID"]);
            var getdata = db.Inboxes.Where(m => m.ReplyId == id).Select(a => new { a.MessageDate, a.MessageDetail, a.Subject, a.MessageId, a.ToEmailId, a.FromEmailId }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new MessageModel
                {
                    //DoctorId=item.DoctorId,
                    MsgId     = item.MessageId,
                    FrmEmail  = item.FromEmailId,
                    ToEmail   = item.ToEmailId,
                    MsgDate   = item.MessageDate,
                    MsgSub    = item.Subject,
                    MsgDetail = item.MessageDetail
                });
            }
            pm.ListApp = lst1;
            var sender = Convert.ToString(Session["EmailId"]);
            var memId  = Convert.ToInt32(Session["MemberId"]);
            var getd   = db.Inboxes.FirstOrDefault(m => m.MessageId == id);

            obj.FromEmailId   = sender;
            obj.ToEmailId     = getd.FromEmailId;
            obj.MessageDetail = pm.MsgDetail;
            obj.MessageDate   = DateTime.Now;
            obj.ReplyId       = id;

            db.Inboxes.Add(obj);
            db.SaveChanges();
            ViewBag.text = "Message Sent";
            return(View(pm));
        }
示例#25
0
        public ActionResult ViewMessage()
        {
            var            patEmailId = Convert.ToString(Session["EmailId"]);
            ClASDBEntities db         = new ClASDBEntities();
            PatientModel   pm         = new PatientModel();
            //var currentPat = db.Patients.FirstOrDefault(m => m.MemberID == memId);
            List <PatientModel> lst1 = new List <PatientModel>();
            //var patId = Convert.ToInt32(Session["ID"]);
            var getdata = (from i in db.Inboxes
                           join m in db.MemberLogins
                           on i.ToEmailId equals m.EmailId
                           join d in db.Doctors
                           on m.MemberID equals d.MemberId
                           where (i.ReplyId == null && i.FromEmailId == patEmailId)
                           select new
            {
                d.FirstName,
                i.MessageDate,
                i.Subject,
                i.MessageDetail,
                i.MessageId
            }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new PatientModel
                {
                    //DoctorId=item.DoctorId,
                    MsgId      = item.MessageId,
                    DoctorName = item.FirstName,
                    MsgDate    = item.MessageDate,
                    MsgSub     = item.Subject,
                    MsgDetail  = item.MessageDetail
                });
            }
            pm.ListApp = lst1;
            return(View(pm));
        }
      public ActionResult EditProfile(AdminModel dm)
      {
          ClASDBEntities db        = new ClASDBEntities();
          var            memId     = Convert.ToInt32(Session["MemberId"]);
          string         checkRole = Convert.ToString(Session["RoleName"]);

          if (checkRole == "Admin")
          {
              var getdata = db.Admins.FirstOrDefault(m => m.MemberId == memId);
              getdata.FirstName = dm.FName;
              getdata.LastName  = dm.LName;
              getdata.Address   = dm.Address;
              getdata.Gender    = dm.Gender;
              db.SaveChanges();
              ViewBag.text = "Edited Successfully";
          }
          else
          {
              ViewBag.text = "Error Occurred!";
          }

          return(View(dm));
      }
示例#27
0
        public ActionResult ViewAllMessages(int id)
        {
            ClASDBEntities      db   = new ClASDBEntities();
            PatientModel        pm   = new PatientModel();
            List <PatientModel> lst1 = new List <PatientModel>();
            //var patId = Convert.ToInt32(Session["ID"]);
            var getdata = db.Inboxes.Where(m => m.ReplyId == id).Select(a => new { a.MessageDate, a.MessageDetail, a.Subject, a.MessageId, a.ToEmailId, a.FromEmailId }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new PatientModel
                {
                    //DoctorId=item.DoctorId,
                    MsgId     = item.MessageId,
                    FrmEmail  = item.FromEmailId,
                    MsgDate   = item.MessageDate,
                    MsgSub    = item.Subject,
                    MsgDetail = item.MessageDetail
                });
            }
            pm.ListApp = lst1;
            return(View(pm));
        }
      public ActionResult UpdateOrders(int id, string str)
      {
          ClASDBEntities db = new ClASDBEntities();
          //DoctorAppointment obj = new DoctorAppointment();
          var getOrd  = db.PatientOrderDetails.FirstOrDefault(m => m.OrderID == id);
          var getDel  = db.DrugDeliveries.FirstOrDefault(m => m.OrderID == id);
          var getDrug = db.Drugs.FirstOrDefault(m => m.DrugID == getOrd.DrugId);
          var q       = getDrug.TotalQuantityAvailable;

          if (str == "Delivered")
          {
              getDel.DeliveryDate            = DateTime.Now;
              getOrd.OrderStatus             = str;
              getDrug.TotalQuantityAvailable = q - getOrd.Quantity;
          }
          else
          {
              getOrd.OrderStatus = str;
              db.DrugDeliveries.Remove(getDel);
          }
          db.SaveChanges();

          return(RedirectToAction("ViewOrders", "Supplier"));
      }
示例#29
0
        public ActionResult ViewOrders()
        {
            var            patEmailId = Convert.ToString(Session["EmailId"]);
            ClASDBEntities db         = new ClASDBEntities();
            ViewOrderModel pm         = new ViewOrderModel();
            //var currentPat = db.Patients.FirstOrDefault(m => m.MemberID == memId);
            List <ViewOrderModel> lst1 = new List <ViewOrderModel>();
            var patId   = Convert.ToInt32(Session["ID"]);
            var getdata = (from d in db.Drugs
                           join pod in db.PatientOrderDetails
                           on d.DrugID equals pod.DrugId
                           where (pod.PatientID == patId)
                           select new
            {
                d.DrugName,
                pod.OrderDate,
                pod.OrderStatus,
                pod.Quantity,
                pod.OrderID
            }).ToList();

            foreach (var item in getdata)
            {
                lst1.Add(new ViewOrderModel
                {
                    //DoctorId=item.DoctorId,
                    OrderID     = item.OrderID,
                    DrugName    = item.DrugName,
                    OrderDate   = item.OrderDate,
                    OrderStatus = item.OrderStatus,
                    OrderQtty   = item.Quantity
                });
            }
            pm.ListOrder = lst1;
            return(View(pm));
        }
      public ActionResult AddDrugDetails(AddDrugModel ad)
      {
          if (ModelState.IsValid)
          {
              ClASDBEntities db = new ClASDBEntities();
              Drug           d  = new Drug();
              d.DrugName               = ad.DName;
              d.ManufactureDate        = ad.MfgDate;
              d.ExpiryDate             = ad.ExpDate;
              d.SideEffect             = ad.SideEff;
              d.TotalQuantityAvailable = ad.Qtty;
              d.UsedFor   = ad.Use;
              d.IsDeleted = "No";

              db.Drugs.Add(d);
              db.SaveChanges();
              ViewBag.text = "Drug Inserted Succesfully";
          }
          else
          {
              ViewBag.text = "Drug Not Inserted";
          }
          return(View(ad));
      }