public ActionResult Announce(String Command, Patient P)
        {
            String  HostName   = Dns.GetHostName();
            String  MyIP       = Dns.GetHostByName(HostName).AddressList[0].ToString();
            Patient curPatient = new Patient();
            var     counter    = (from r in db.IPs
                                  where r.IP_Address == MyIP
                                  select r.Name);

            counter.Take(1);
            foreach (var item in counter)
            {
                ViewBag.CounterName = item;
            }
            var Patientinfo = (from r in db.Patients
                               where r.PatientId == P.PatientId
                               select r).Single();

            if ((Patientinfo.Status == "NEW" || Patientinfo.Status == "MISSED") && Command != "CALL")
            {
                return(View(Patientinfo));
            }
            Patientinfo.Status = Command;
            db.SaveChanges();
            Patientinfo.IP = MyIP;
            db.SaveChanges();
            Patientinfo.TimeStamp = DateTime.Now;
            db.SaveChanges();
            ModelState.Clear();
            if (Command != "CALL")
            {
                return(RedirectToAction("PatientSelection"));
            }
            return(View(Patientinfo));
        }
        public ActionResult Register(Patient patientinfo)
        {
            using (QMS_db db = new QMS_db())
            {
                String HostName = Dns.GetHostName();
                db.Patients.Add(new Patient
                {
                    PatientId   = patientinfo.PatientId,
                    PatientName = patientinfo.PatientName,
                    Status      = "NEW",
                    TimeStamp   = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    IP          = "",
                });

                db.SaveChanges();
            }

            using (QMS_db db = new QMS_db())
            {
                var item = (from p in db.Patients
                            where (p.PatientId == patientinfo.PatientId && p.PatientName == patientinfo.PatientName &&
                                   p.Status == "NEW")
                            select p).Single();



                return(RedirectToAction("Index", new { Token = item.Token }));
            }
        }
Beispiel #3
0
        public ActionResult TokenSetting(Config token)
        {
            Config config = new Config();

            var tokenvalue = (from r in db.Configs
                              where r.key == "Token"
                              select r).Single();

            tokenvalue.Value = token.Value;


            db.SaveChanges();


            return(RedirectToAction("Index", new { token = token.Value }));
        }
Beispiel #4
0
        public ActionResult IpSetting(List <IP> ipList)
        {
            if (ModelState.IsValid)
            {
                using (QMS_db qmsdb = new QMS_db())
                {
                    foreach (IP ip in ipList)
                    {
                        var i = (from r in qmsdb.IPs
                                 where r.Id == ip.Id
                                 select r).Single();

                        i.IP_Address = ip.IP_Address;
                        qmsdb.SaveChanges();
                    }
                }
                return(RedirectToAction("IPSettingMsg"));
            }
            return(null);
        }