Example #1
0
        public ActionResult ViewDrugsAdmin()
        {
            DrugViewModel        dm  = new DrugViewModel();
            List <DrugViewModel> lst = new List <DrugViewModel>();

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.Drugs.ToList().Where(a => a.IsDeleted == false);


                foreach (var item in getdata)
                {
                    lst.Add(new DrugViewModel
                    {
                        DrugId          = item.DrugId,
                        DrugName        = item.DrugName,
                        ManufactureDate = Convert.ToDateTime(item.ManufactureDate),
                        ExpiredDate     = Convert.ToDateTime(item.ExpiredDate),
                        UsedFor         = item.UsedFor,

                        SideEffects            = item.SideEffects,
                        TotalQuantityAvailable = item.TotalQuantityAvailable,
                        IsDeleted = item.IsDeleted
                    });
                }

                dm.lstDrug = lst;
                return(View(dm));
            }
        }
 public ActionResult PostEditPateint(PateintViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View("EditPateint"));
     }
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         int         memid = Convert.ToInt32(Session["MemberId"]);
         var         gdata = db.Patients.FirstOrDefault(a => a.MemberId == memid);
         MemberModel m     = new MemberModel();
         if (gdata != null)
         {
             db.UpdatePateint(memid, model.FirstName, model.LastName, model.DateOfBirth
                              , model.Gender, model.Address);
             ViewBag.message = " Profile Updated!";
             return(View("EditPateint"));
         }
         else
         {
             db.InsertPateint(memid, model.FirstName, model.LastName, model.DateOfBirth,
                              model.Gender, model.Address);
             ViewBag.message = "Your Profile Saved!";
             return(View("EditPateint"));
         }
     }
 }
Example #3
0
        public ActionResult PostRegister(MemberModel model)
        {
            MemberModel m = new MemberModel();

            if (!ModelState.IsValid)
            {
                CommonData mc = new CommonData(); m.lstnew = mc.RoleNName();
                return(View("Register", m));
            }
            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var gdata = im.MemberLogins.FirstOrDefault(a => a.EmailId == model.EmailId);
                if (gdata != null)
                {
                    ViewBag.Message = "Email Id Already used! ";
                }
                else
                {
                    im.InsertMember(model.EmailId, model.Password, model.RoleId);
                    ViewBag.Message = "Registered Succesfully!";
                }
            }
            CommonData mcm = new CommonData();

            m.lstnew = mcm.RoleNName();

            return(View("Register", m));
        }
        public ActionResult EditSupplier()
        {
            using (ProjectEntities1 db = new ProjectEntities1())
            {
                //PateintViewModel model = new PateintViewModel();
                int               memid = Convert.ToInt32(Session["MemberId"]);
                var               gdata = db.Suppliers.FirstOrDefault(a => a.MemberId == memid);
                MemberModel       m     = new MemberModel();
                SupplierViewModel model = new SupplierViewModel();

                if (gdata != null)
                {
                    model.FirstName      = gdata.FirstName;
                    model.LastName       = gdata.LastName;
                    model.CompanyName    = gdata.CompanyName;
                    model.CompanyAddress = gdata.CompanyAddress;

                    return(View(model));
                }
                else
                {
                    //model.doctorlst = cmodel.DoctorSpecs();
                    return(View("EditSupplier"));
                }
            }
        }
        public ActionResult PostSendMsgPateint(InboxModel inboxModel)
        {
            CommonData model = new CommonData();

            if (!ModelState.IsValid)
            {
                inboxModel.doclst2 = model.DoctorApp();
                return(View("SendMsgPateint", model));
            }
            int         memid       = Convert.ToInt32(Session["MemberId"]);
            MemberModel memberModel = new MemberModel();

            inboxModel.doclst2 = model.DoctorApp();
            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.Doctors.FirstOrDefault(a => a.DoctorId == inboxModel.DoctorId);
                int mem     = getdata.MemberId;

                var    getdata2 = db.MemberLogins.FirstOrDefault(a => a.MemberId == mem);
                string ToEmail  = getdata2.EmailId;

                /*var getdata3 = db.Patients.FirstOrDefault(a => a.MemberId == memid);
                 * int mem2 = getdata3.MemberId;*/
                var getdata4 = db.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                inboxModel.MessageDate = DateTime.Now;
                inboxModel.FromEmailId = getdata4.EmailId;
                int    replyid = 0;
                string isRead  = "false";
                db.InsertMessagePat(inboxModel.FromEmailId, ToEmail, inboxModel.Subject, inboxModel.MessageDetail,
                                    inboxModel.MessageDate, replyid, isRead);
            }
            ViewBag.message = "Message Sent !";
            return(View("SendMsgPateint", inboxModel));
        }
Example #6
0
        public ActionResult DoctorEdit()
        {
            using (ProjectEntities1 db = new ProjectEntities1())
            {
                //PateintViewModel model = new PateintViewModel();
                int         memid  = Convert.ToInt32(Session["MemberId"]);
                var         gdata  = db.Doctors.FirstOrDefault(a => a.MemberId == memid);
                MemberModel m      = new MemberModel();
                CommonData  cmodel = new CommonData();
                DoctorModel model  = new DoctorModel();


                if (gdata != null)
                {
                    model.FirstName       = gdata.FirstName;
                    model.LastName        = gdata.LastName;
                    model.TotalExperience = gdata.TotalExperience;
                    model.SpecializedId   = gdata.SpecializedId;
                    model.Gender          = gdata.Gender;
                    model.doctorlst       = cmodel.DoctorSpecs();
                    return(View(model));
                }
                else
                {
                    model.doctorlst = cmodel.DoctorSpecs();
                    return(View(model));
                }
            }

            //return View(dm);
        }
        public ActionResult PostDoctorAppointment(DoctorAppModel da)
        {
            CommonData model = new CommonData();

            if (!ModelState.IsValid)
            {
                da.doclst = model.DoctorApp();
                return(View("DoctorAppointment", da));
            }
            int memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var getdata = im.Patients.FirstOrDefault(a => a.MemberId == memid);

                da.AppointmentStatus = "Requested";
                int id = Convert.ToInt32(getdata.PatientId);
                im.InsertDoctorApp(id, da.DoctorId, da.Subject, da.Description, da.AppointmentDate, da.AppointmentStatus);
            }
            CommonData mcm = new CommonData();

            da.doclst       = mcm.DoctorApp();
            ViewBag.message = "Appointment Requested !";
            return(View("DoctorAppointment", da));
        }
 public ActionResult PostEditSupplier(SupplierViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View("EditSupplier"));
     }
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         int         memid = Convert.ToInt32(Session["MemberId"]);
         var         gdata = db.Suppliers.FirstOrDefault(a => a.MemberId == memid);
         MemberModel m     = new MemberModel();
         if (gdata != null)
         {
             db.UpdateSupplier(memid, model.FirstName, model.LastName, model.CompanyName
                               , model.CompanyAddress);
             ViewBag.message = "Updated";
             return(View("EditSupplier"));
         }
         else
         {
             db.InsertSupplier(memid, model.FirstName, model.LastName, model.CompanyName
                               , model.CompanyAddress);
             ViewBag.message = "Inserted";
             return(View("EditSupplier"));
         }
     }
 }
        public ActionResult PostSupplierPass(PasswordChangeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("ChangePassSupplier"));
            }
            MemberModel model1 = new MemberModel();
            int         memid  = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                if (model.OldPassword == getdata.Password)
                {
                    if (model.OldPassword == model.NewPassword)
                    {
                        ViewBag.message = "Enter New Password different from Old Password!";
                    }
                    else
                    {
                        db.UpdatePassword(memid, model.NewPassword);
                        ViewBag.message = "Password Updated!";
                    }
                }
                else
                {
                    ViewBag.message = "Old password do not Match";
                }
            }
            return(View("ChangePassSupplier"));
        }
        public ActionResult ViewAppointment()
        {
            int memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var pdata = im.Patients.FirstOrDefault(a => a.MemberId == memid);
                var gdata = im.DoctorAppointments.ToList().Where(a => a.PatientId == pdata.PatientId);
                List <DoctorAppModel> lst = new List <DoctorAppModel>();
                foreach (var item in gdata)
                {
                    lst.Add(new DoctorAppModel
                    {
                        DoctorName        = item.Doctor.FirstName + " " + item.Doctor.LastName,
                        Subject           = item.Subject,
                        Description       = item.Description,
                        AppointmentDate   = item.AppointmentDate,
                        AppointmentStatus = item.AppointmentStatus
                    });
                }
                DoctorAppModel docViewModel = new DoctorAppModel();
                docViewModel.lstDoc = lst;

                return(View(docViewModel));
            }
        }
Example #11
0
        public ActionResult ViewMessageDoc()
        {
            int memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var gdata2 = im.MemberLogins.FirstOrDefault(a => a.MemberId == memid);

                var gdata = im.Inboxes.ToList().Where(a => a.ToEmailId == gdata2.EmailId);

                // var member = im.MemberLogins.ToList(); var inb = im.Inboxes.ToList();

                List <InboxModel> lst = new List <InboxModel>();
                foreach (var item in gdata)
                {
                    string fromEmail    = item.FromEmailId;
                    var    getemail     = im.MemberLogins.FirstOrDefault(a => a.EmailId == fromEmail);
                    var    getpateint   = im.Patients.FirstOrDefault(a => a.MemberId == getemail.MemberId);
                    string Pateint_Name = getpateint.FirstName + getpateint.LastName;
                    lst.Add(new InboxModel
                    {
                        MessageId   = item.MessageId,
                        PateintName = Pateint_Name,
                        Subject     = item.Subject,

                        MessageDetail = item.MessageDetail,
                        MessageDate   = item.MessageDate
                    });
                }
                InboxModel inboxViewModel = new InboxModel();
                inboxViewModel.doctorlist = lst;

                return(View(inboxViewModel));
            }
        }
Example #12
0
        public ActionResult PostDoctorEdit(DoctorModel model)
        {
            CommonData cmodel = new CommonData();

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                int memid = Convert.ToInt32(Session["MemberId"]);
                var gdata = db.Doctors.FirstOrDefault(a => a.MemberId == memid);
                model.doctorlst = cmodel.DoctorSpecs();
                MemberModel m = new MemberModel();
                if (gdata != null)
                {
                    db.UpdateDoctor(memid, model.FirstName, model.LastName, model.TotalExperience
                                    , model.SpecializedId, model.Gender);


                    ViewBag.message = "Profile Updated !";
                    return(View("DoctorEdit", model));
                }
                else
                {
                    db.InsertDoctor(memid, model.FirstName, model.LastName, model.TotalExperience
                                    , model.SpecializedId, model.Gender);

                    ViewBag.message = "Profile Saved !";
                    return(View("DoctorEdit", model));

                    /*  }
                     * else
                     * {
                     *    return View("DoctorEdit", model);
                     * }*/
                }
            }
        }
        public ActionResult PostRaiseOrder(PateintOrder m)
        {
            if (!ModelState.IsValid)
            {
                CommonData mc = new CommonData();
                m.drglst = mc.DruGdetail();
                return(View("RaiseOrder", m));
            }
            int memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var getdata = im.Patients.FirstOrDefault(a => a.MemberId == memid);
                m.OrderedDate = DateTime.Now;
                m.OrderStatus = "Requested";
                string year  = (DateTime.Now.Year).ToString();
                string month = (DateTime.Now.Month).ToString();
                string day   = (DateTime.Now.Day).ToString();
                string hour  = (DateTime.Now.Hour).ToString();
                string min   = (DateTime.Now.Minute).ToString();
                string mili  = (DateTime.Now.Second).ToString();
                m.OrderNumber = year + month + day + hour + min + mili;
                int id = getdata.PatientId;
                im.InsertPateintOrder(id, m.DrugId, m.OrderNumber, m.Quantity, m.OrderedDate, m.OrderStatus);
            }
            CommonData mcm = new CommonData();

            m.drglst        = mcm.DruGdetail();
            ViewBag.message = "Medicines Requested";
            return(View("RaiseOrder", m));
        }
Example #14
0
        public ActionResult PostAdminPassword(PasswordChangeModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("AdminChangePass"));
            }
            int memid = Convert.ToInt32(Session["AdminId"]);

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.Admins.FirstOrDefault(a => a.AdminId == memid);
                if (model.OldPassword == getdata.Password)
                {
                    if (model.OldPassword == model.NewPassword)
                    {
                        ViewBag.message = "Enter New Password different from Old Password!";
                    }
                    else
                    {
                        db.UpdateAdminPassword(memid, model.NewPassword);
                        ViewBag.message = "Password Updated!";
                    }
                }

                else
                {
                    ViewBag.message = "Old password didn't match!";
                }
            }
            return(View("AdminChangePass"));
        }
Example #15
0
        public ActionResult PostAddDrugsAdmin(DrugViewModel model)
        {
            using (ProjectEntities1 db = new ProjectEntities1())
            {
                /* if (ModelState.IsValid)
                 * {*/

                if (!ModelState.IsValid)
                {
                    return(View("AddDrugsAdmin"));
                }

                Boolean isdeleted = false;
                var     getdata   = db.Drugs.FirstOrDefault(a => a.DrugId == model.DrugId);
                if (getdata != null)
                {
                    db.UpadateDrug(model.DrugId, model.DrugName, model.ManufactureDate, model.ExpiredDate, model.UsedFor,
                                   model.SideEffects, model.TotalQuantityAvailable, isdeleted);
                    ViewBag.Message = "Updated";
                }
                else
                {
                    db.InsertDrug(model.DrugName, model.ManufactureDate, model.ExpiredDate, model.UsedFor,
                                  model.SideEffects, model.TotalQuantityAvailable, isdeleted);
                    ViewBag.Message = "Inserted";
                }
                return(View("AddDrugsAdmin"));
            }

            /*  else
             * {
             *    return View("AddDrugsAdmin");
             * }*/
        }
        public ActionResult ViewMessageSentPateint()
        {
            int memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var gdata2 = im.MemberLogins.FirstOrDefault(a => a.MemberId == memid);

                var gdata = im.Inboxes.ToList().Where(a => a.FromEmailId == gdata2.EmailId);
                //var gdata3 = im.Inboxes.ToList().Where(a => a.ToEmailId == gdata2.EmailId);
                //int
                //var getPateint=im.Patients.FirstOrDefault
                List <InboxModel> lst = new List <InboxModel>();
                foreach (var item in gdata)
                {
                    string docmail = item.ToEmailId;
                    var    getdoc  = im.MemberLogins.FirstOrDefault(a => a.EmailId == docmail);

                    var    doc_get = im.Doctors.FirstOrDefault(a => a.MemberId == getdoc.MemberId);
                    string docname = doc_get.FirstName + " " + doc_get.LastName;
                    lst.Add(new InboxModel
                    {
                        DoctorName    = docname,
                        MessageId     = item.MessageId,
                        Subject       = item.Subject,
                        MessageDetail = item.MessageDetail,
                        MessageDate   = item.MessageDate
                    });
                }
                InboxModel inboxViewModel = new InboxModel();
                inboxViewModel.doctorlist = lst;

                return(View(inboxViewModel));
            }
        }
        public ActionResult ViewOrder()
        {
            int memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var gdata1 = im.Patients.FirstOrDefault(a => a.MemberId == memid);
                var gdata  = im.PateintOrderDetails.ToList().Where(a => a.PateintId == gdata1.PatientId);
                List <PateintOrder> lst = new List <PateintOrder>();
                foreach (var item in gdata)
                {
                    lst.Add(new PateintOrder
                    {
                        DrugName    = item.Drug.DrugName, Quantity = item.Quantity, OrderStatus = item.OrderStatus,
                        OrderedDate = item.OrderedDate
                    }

                            );
                }
                PateintOrder pateintViewModel = new PateintOrder();
                pateintViewModel.lstPateint = lst;

                return(View(pateintViewModel));
            }
        }
Example #18
0
        // GET: Doctor
        public ActionResult DoctorHome()
        {
            int            memid = Convert.ToInt32(Session["MemberId"]);
            DashboardModel model = new DashboardModel();

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                var ndata = im.Doctors.FirstOrDefault(a => a.MemberId == memid);
                if (ndata != null)
                {
                    var gdata = im.DoctorAppointments.ToList().Where(a => a.DoctorId == ndata.DoctorId);
                    int appCount = 0, tap = 0, trej = 0, treq = 0;
                    foreach (var item in gdata)
                    {
                        if (item.AppointmentStatus == "Approved")
                        {
                            tap++;
                        }
                        else if (item.AppointmentStatus == "Rejected")
                        {
                            trej++;
                        }
                        else if (item.AppointmentStatus == "Requested")
                        {
                            treq++;
                        }
                        appCount++;
                    }
                    model.TotalAppoint = appCount; model.Tapprove = tap; model.Trejected = trej; model.Trequested = treq;

                    // inbox messages count
                    int tbox = 0; int read = 0, uread = 0;
                    var gdata2 = im.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                    var ginbox = im.Inboxes.ToList().Where(a => a.ToEmailId == gdata2.EmailId);
                    foreach (var item in ginbox)
                    {
                        if (item.IsRead == "True")
                        {
                            read++;
                        }
                        else
                        {
                            uread++;
                        }
                        tbox++;
                    }
                    model.TInbox = tbox; model.TRead = read; model.Tunread = uread;
                }
                else
                {
                    model.TInbox       = 0; model.TRead = 0; model.Tunread = 0;
                    model.TotalAppoint = 0; model.Tapprove = 0; model.Trejected = 0; model.Trequested = 0;
                }
                //is read and is unread
            }


            return(View(model));
        }
        // GET: Pateint
        public ActionResult PateintHome()
        {
            DashboardModel model = new DashboardModel();
            int            memid = Convert.ToInt32(Session["MemberId"]);

            using (ProjectEntities1 im = new ProjectEntities1())
            {
                //total order calculation
                int torder = 0, tdel = 0, nrem = 0;
                var gdata1 = im.Patients.FirstOrDefault(a => a.MemberId == memid);
                if (gdata1 != null)
                {
                    var gdata = im.PateintOrderDetails.ToList().Where(a => a.PateintId == gdata1.PatientId);
                    foreach (var item in gdata)
                    {
                        if (item.OrderStatus == "Delievered")
                        {
                            tdel++;
                        }
                        else
                        {
                            nrem++;
                        }
                        torder++;
                    }

                    model.Pat_total = torder; model.Pat_Delivered = tdel; model.Pat_Remain = nrem;
                    //total appointment
                    int tapp = 0, tapprov = 0, trej = 0, treq = 0;
                    var gapp = im.DoctorAppointments.ToList().Where(a => a.PatientId == gdata1.PatientId);
                    foreach (var item in gapp)
                    {
                        if (item.AppointmentStatus == "Approved")
                        {
                            tapprov++;
                        }
                        else if (item.AppointmentStatus == "Requested")
                        {
                            treq++;
                        }
                        else if (item.AppointmentStatus == "Rejected")
                        {
                            trej++;
                        }

                        tapp++;
                    }
                    model.Pat_app     = tapp; model.Pat_approv = tapprov; model.Pat_rejected = trej;
                    model.Pat_request = treq;
                }
                else
                {
                    model.Pat_total   = 0; model.Pat_Delivered = 0; model.Pat_Remain = 0;
                    model.Pat_app     = 0; model.Pat_approv = 0; model.Pat_rejected = 0;
                    model.Pat_request = 0;
                }
                return(View(model));
            }
        }
Example #20
0
 public ActionResult PostViewAppointment(DoctorAppModel doctorAppModel)
 {
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         db.UpdateAppStatus(doctorAppModel.AppointmentId, doctorAppModel.AppointmentStatus);
     }
     return(Json("Inserted"));
 }
Example #21
0
 public ActionResult PostLogin(AdminLoginModel model)
 {
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         var getdata = db.Admins.SingleOrDefault(a => a.Email == model.Email);
         db.InsertAdmin(model.FirstName, model.LastName, model.Gender, model.Address
                        , model.Email, model.Password);
         ViewBag.Message = "Inserted";
     }
     return(View("Login"));
 }
Example #22
0
        public ActionResult DeleteDrug(int id)
        {
            DrugViewModel model = new DrugViewModel();

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.Drugs.FirstOrDefault(a => a.DrugId == id);
                if (getdata != null)
                {
                    db.Updateisdelete(id, true);
                }
            }
            return(RedirectToAction("ViewDrugsAdmin"));
        }
Example #23
0
 public ActionResult PostEditAdmin(AdminLoginModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View("EditAdmin"));
     }
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         db.UpdateAdmin(model.FirstName, model.LastName, model.Gender, model.Address
                        , model.Email);
         ViewBag.Message = "Updated";
         return(View("EditAdmin"));
     }
 }
Example #24
0
 public ActionResult EditAdmin()
 {
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         AdminLoginModel model = new AdminLoginModel();
         var             gdata = db.Admins.FirstOrDefault(a => a.AdminId == 2);
         model.FirstName = gdata.FirstName;
         model.LastName  = gdata.LastName;
         model.Gender    = gdata.Gender;
         model.Address   = gdata.Address;
         model.Email     = gdata.Email;
         return(View(model));
     }
 }
        // GET: Supplier

        public ActionResult SupplierHome()
        {
            int            memid = Convert.ToInt32(Session["MemberId"]);
            DashboardModel model = new DashboardModel();

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getmem = db.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                if (getmem != null)
                {
                    var getdata = (from p in db.PateintOrderDetails join d in db.DrugDeliveries on p.OrderId
                                   equals d.OrderId join s in db.Suppliers on d.SupplierId equals s.SupplierId
                                   where s.MemberId == memid
                                   select new
                                   { p.OrderId, p.PateintId, p.OrderNumber, p.OrderStatus, p.OrderedDate, p.Quantity,
                                     p.DrugId, d.DeliveredDate,
                                     M = p.Patient.FirstName + " " + p.Patient.LastName,
                                     Drug_Name = p.Drug.DrugName }).ToList();
                    // var nxtdata = getdata.SingleOrDefault(a=>a.MemberId==memid);
                    int count = getdata.Count;
                    model.TotalOrder = count;
                    int dis_count = 0, deli_count = 0, Req_count = 0;
                    foreach (var item in getdata)
                    {
                        if (item.OrderStatus == "Dispatched")
                        {
                            dis_count++;
                        }
                        else if (item.OrderStatus == "Delievered")
                        {
                            deli_count++;
                        }
                        else if (item.OrderStatus == "Requested" || item.OrderStatus == "Assigned")
                        {
                            Req_count++;
                        }
                    }
                    model.Dispatched = dis_count; model.Delievered = deli_count; model.Requested = Req_count;
                    return(View(model));
                }
                else
                {
                    model.Dispatched = 0; model.Delievered = 0; model.Requested = 0; model.TotalOrder = 0;
                    return(View(model));
                }
            }
        }
Example #26
0
        public ActionResult ViewOrder()
        {
            CommonData      model = new CommonData();
            AdminOrderModel m     = new AdminOrderModel();

            m.suplist = model.SupplierNName();
            List <AdminOrderModel> lst = new List <AdminOrderModel>();

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = db.PateintOrderDetails.ToList();


                foreach (var item in getdata)
                {
                    string supname = null;
                    if (item.OrderStatus != "Requested")
                    {
                        int orderid = item.OrderId;

                        var nname = (from d in db.DrugDeliveries
                                     join s in db.Suppliers on d.SupplierId
                                     equals s.SupplierId
                                     where d.OrderId == orderid
                                     select new { s.FirstName, s.LastName }).FirstOrDefault();
                        supname = nname.FirstName + " " + nname.LastName;
                    }
                    lst.Add(new AdminOrderModel
                    {
                        SupplierName = supname,
                        OrderId      = item.OrderId,
                        PatientId    = item.PateintId,
                        Drugname     = item.Drug.DrugName,
                        PateintName  = item.Patient.FirstName + item.Patient.LastName,
                        DrugId       = item.DrugId,
                        OrderNumber  = item.OrderNumber,
                        Quantity     = item.Quantity,
                        OrderedDate  = Convert.ToDateTime(item.OrderedDate),
                        OrderStatus  = item.OrderStatus
                    });
                }
                //InboxModel inboxViewModel = new InboxModel();
                m.lstAdmin = lst;
                return(View(m));
            }
        }
Example #27
0
        public ActionResult PostViewMessageDoc(InboxModel model)
        {
            using (ProjectEntities1 im = new ProjectEntities1())
            {
                int    memid     = Convert.ToInt32(Session["MemberId"]);
                var    gdata     = im.MemberLogins.FirstOrDefault(a => a.MemberId == memid);
                string FromEmail = gdata.EmailId;
                var    gdata2    = im.Inboxes.FirstOrDefault(a => a.MessageId == model.MessageId);

                string ToEmail = gdata2.FromEmailId;
                string IsRead  = "True";
                im.UpdateIsRead(gdata2.MessageId, IsRead);
                im.InsertMessagePat(FromEmail, ToEmail, model.Subject, model.MessageDetail, DateTime.Now, model.MessageId, IsRead);

                return(Json("Inserted"));
            }
        }
Example #28
0
 public ActionResult PostorderAdmin(AdminOrderModel model)
 {
     using (ProjectEntities1 db = new ProjectEntities1())
     {
         if (model.SupplierId > 0)
         {
             string assign = "Assigned";
             db.InsertDrugDelivery(model.OrderId, model.SupplierId);
             db.UpdateAssign(model.OrderId, assign);
             return(Json("Assigned"));
         }
         else
         {
             return(Json("Error"));
         }
     }
 }
        public ActionResult ViewOrderSup()
        {
            DashboardModel  mm    = new DashboardModel();
            int             memid = Convert.ToInt32(Session["MemberId"]);
            CommonData      model = new CommonData();
            AdminOrderModel m     = new AdminOrderModel();

            m.suplist = model.SupplierNName();
            List <AdminOrderModel> lst = new List <AdminOrderModel>();

            using (ProjectEntities1 db = new ProjectEntities1())
            {
                var getdata = (from p in db.PateintOrderDetails join d in db.DrugDeliveries on p.OrderId
                               equals d.OrderId join s in db.Suppliers on d.SupplierId equals s.SupplierId
                               where s.MemberId == memid
                               select new
                               { p.OrderId, p.PateintId, p.OrderNumber, p.OrderStatus, p.OrderedDate, p.Quantity,
                                 p.DrugId, d.DeliveredDate,
                                 M = p.Patient.FirstName + " " + p.Patient.LastName,
                                 Drug_Name = p.Drug.DrugName }).ToList();
                // var nxtdata = getdata.SingleOrDefault(a=>a.MemberId==memid);
                int count = getdata.Count;
                mm.TotalOrder = count;


                foreach (var item in getdata)
                {
                    lst.Add(new AdminOrderModel
                    {
                        OrderId        = item.OrderId,
                        PatientId      = item.PateintId,
                        PateintName    = item.M,
                        Drugname       = item.Drug_Name,
                        DrugId         = item.DrugId,
                        OrderNumber    = item.OrderNumber,
                        Quantity       = item.Quantity,
                        DelieveredDate = Convert.ToDateTime(item.DeliveredDate),
                        OrderedDate    = item.OrderedDate,
                        OrderStatus    = item.OrderStatus,
                    });
                }
                //InboxModel inboxViewModel = new InboxModel();
                m.lstAdmin = lst;
                return(View(m));
            }
        }
 public ActionResult PostViewSup(AdminOrderModel model)
 {
     using (ProjectEntities1 db = new ProjectEntities1())
     {   //Delievered
         string status = model.OrderStatus;
         if (status == "Dispatched")
         {
             db.UpdateOrStatus(model.OrderId, model.OrderStatus);
             return(Json("Updated"));
         }
         else
         {
             db.UpdateOrStatus(model.OrderId, model.OrderStatus);
             db.Updatedeleivery(model.OrderId, DateTime.Now);
             //model.DelieveredDate = DateTime.Now;
             return(Json("Updated"));
         }
     }
 }