コード例 #1
0
        public ActionResult AssignPatients(int id)
        {
            EHMSEntities ent = new EHMSEntities();
            DemandPatientAssignmentModel model = new DemandPatientAssignmentModel();

            model.OpdModelList = new List <OpdModel>();
            model.DemandId     = id;

            var list = (from om in ent.OpdMasters
                        join
                        pa in ent.DemandPatientAssignments on om.OpdID equals pa.OpdId
                        join
                        dm in ent.ItemDemandMasters on pa.DemandId equals dm.ItemDemandID
                        where pa.DemandId == model.DemandId && pa.Status == true
                        select new { om, pa, dm }).ToList();

            foreach (var item in list)
            {
                OpdModel omodel = new OpdModel();
                omodel.FirstName        = item.om.FirstName;
                omodel.MiddleName       = item.om.MiddleName;
                omodel.LastName         = item.om.LastName;
                omodel.MobileNumber     = item.pa.Remarks;
                omodel.RegistrationMode = item.dm.ItemDemandNo;
                omodel.OpdID            = item.om.OpdID;
                model.OpdModelList.Add(omodel);
            }

            return(View(model));
        }
コード例 #2
0
        public ActionResult PatientList()
        {
            DemandPatientAssignmentModel model = new DemandPatientAssignmentModel();

            model.OpdModelList = new List <OpdModel>();

            return(PartialView("PatientList"));
        }
コード例 #3
0
        public void AssignPatients(DemandPatientAssignmentModel model)
        {
            EHMSEntities            ent = new EHMSEntities();
            DemandPatientAssignment obj = new DemandPatientAssignment();

            try
            {
                foreach (var item in model.OpdModelList)
                {
                    if (ent.DemandPatientAssignments.Where(x => x.OpdId == item.OpdID && x.Status == true).Any() == false)
                    {
                        obj.DemandId = model.DemandId;
                        obj.OpdId    = item.OpdID;
                        obj.Remarks  = model.Remarks;
                        obj.Status   = true;
                        ent.DemandPatientAssignments.Add(obj);
                        ent.SaveChanges();
                    }
                }
            }
            catch { }
        }
コード例 #4
0
 public ActionResult AssignPatients(DemandPatientAssignmentModel model)
 {
     pro.AssignPatients(model);
     return(RedirectToAction("Index"));
 }