public ActionResult DeleteConfirmed(int id)
        {
            HisProfile hisProfile = db.HisProfiles.Find(id);

            db.HisProfiles.Remove(hisProfile);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Remarks,AccntUserId,ContactInfo")] HisProfile hisProfile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hisProfile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(hisProfile));
 }
Exemplo n.º 3
0
 public ActionResult Patient([Bind(Include = "Id,Name,Remarks,AccntUserId")] HisProfile hisProfile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(hisProfile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Home", new { area = "" }));
     }
     return(View(hisProfile));
 }
        public ActionResult Create([Bind(Include = "Id,Name,Remarks,AccntUserId,ContactInfo")] HisProfile hisProfile)
        {
            if (ModelState.IsValid)
            {
                db.HisProfiles.Add(hisProfile);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(hisProfile));
        }
Exemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Id,RecType,Recipient,Message,DtSending,RefId,RefTable")] HisNotification hisNotification)
        {
            if (ModelState.IsValid)
            {
                db.HisNotifications.Add(hisNotification);

                Models.HisProfileReq request = db.HisProfileReqs.Find(hisNotification.RefId);
                request.dtRequested = DateTime.Now;
                request.dtSchedule  = hisNotification.DtSending;

                //create contact lists

                HisNotificationRecipient recipient = new HisNotificationRecipient();
                recipient.HisNotificationId = hisNotification.Id;

                //get contact number of physician
                HisPhysician physician        = db.HisPhysicians.Where(s => s.Id == request.HisPhysicianId).FirstOrDefault();
                var          notify_Physician = new HisNotificationRecipient //Make sure you have a table called test in DB
                {
                    HisNotificationId = hisNotification.Id,
                    ContactInfo       = physician.ContactInfo
                };

                //get contact number of incharge
                HisIncharge incharge = db.HisIncharges.Where(s => s.Id == request.HisInchargeId).FirstOrDefault();
                HisNotificationRecipient notify_inchage = new HisNotificationRecipient
                {
                    HisNotificationId = hisNotification.Id,
                    ContactInfo       = incharge.ContactInfo
                };

                //get contact info of client (hisprofile)
                HisProfile client = db.HisProfiles.Where(s => s.Id == request.HisProfileId).FirstOrDefault();
                HisNotificationRecipient notify_client = new HisNotificationRecipient
                {
                    HisNotificationId = hisNotification.Id,
                    ContactInfo       = client.ContactInfo
                };

                //add to database
                db.HisNotificationRecipients.Add(notify_Physician);
                db.HisNotificationRecipients.Add(notify_inchage);
                db.HisNotificationRecipients.Add(notify_client);
                db.SaveChanges();

                //HIS10/HisProfileReqs?RptType=1&status=0
                // return RedirectToAction("Details", "HisNotifications", new { id = hisNotification.Id });

                View(hisNotification);
            }

            return(View(hisNotification));
        }
        // GET: HIS10/HisProfiles/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HisProfile hisProfile = db.HisProfiles.Find(id);

            if (hisProfile == null)
            {
                return(HttpNotFound());
            }
            return(View(hisProfile));
        }
        // GET: HIS10/HisProfiles/Edit/5
        public ActionResult Patient(int?id)
        {
            if (id == null)
            {
                string userAccntId = User.Identity.GetUserId();
                var    profile     = db.HisProfiles.Where(d => d.AccntUserId == userAccntId).FirstOrDefault();
                if (profile != null)
                {
                    id = (int)profile.Id;
                }
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            HisProfile hisProfile = db.HisProfiles.Find(id);

            if (hisProfile == null)
            {
                return(HttpNotFound());
            }
            return(View(hisProfile));
        }