Пример #1
0
        // GET: Notification
        public ActionResult ListAll()
        {
            int userid = User.Identity.GetUserId <int>();
            var model  = new NotificationDao().ListByUser(userid);

            return(PartialView(model));
        }
Пример #2
0
        public JsonResult Update(NotificationDetail entity)
        {
            bool ok = new NotificationDao().Update(entity);

            if (ok)
            {
                return(Json(new
                {
                    isNewRecord = false,
                    Id = entity.Id,
                    Title = entity.Title,
                    Contents = entity.Contents,
                    Type = entity.Type,
                    TypeName = entity.TypeName,
                    ReceiverId = entity.ReceiverId,
                    Receiver = entity.Receiver,
                    Link = entity.Link,
                    Status = entity.Status
                }));
            }
            else
            {
                return(NotifyError("Cập nhật"));;
            }
        }
Пример #3
0
        /// <summary>
        /// Sends a message based on the configured message templates
        /// Allows for body to be formatted with arguments.
        /// </summary>
        /// <param name="messageKey">key of the message configured during the setup</param>
        /// <param name="args">array of arguments (optional)</param>
        private void SendNotificationsPriv(string flowId, string transactionId, NotificationType notificationType,
                                           string subject, string[] args)
        {
            string flowName;
            string emails = NotificationDao.GetNotificationEmailsAsString(flowId, notificationType, out flowName);

            SendNotificationsPriv(flowName, transactionId, emails, notificationType, subject, null, null, args);
        }
Пример #4
0
 // Mark a notification has been viewed
 public ActionResult Viewed(int id)
 {
     if (new NotificationDao().HasBeenViewed(id))
     {
         var orderId = new NotificationDao().FindLink(id);
         return(RedirectToAction("Detail", "PatientOrder", new { Area = "Patient", id = orderId }));
     }
     return(RedirectToAction("Index", "PatientOrder", new { Area = "Patient" }));
 }
Пример #5
0
        public JsonResult Destroy(int id)
        {
            bool ok = new NotificationDao().Delete(id);

            if (ok)
            {
                return(Json(new { success = true }));
            }
            else
            {
                return(NotifyError("xóa"));
            }
        }
Пример #6
0
        // GET: Customer
        public void loadNotification()
        {
            LoginModel          user          = Session[CommonConstant.USER_SESSION] as LoginModel;
            var                 dao           = new NotificationDao();
            List <Notification> notifications = dao.getNotifications(user.ID);

            Session[CommonConstant.NOTIFICATION_SESSION] = new NotificationModel();
            NotificationModel notificationModel = Session[CommonConstant.NOTIFICATION_SESSION] as NotificationModel;

            foreach (var item in notifications)
            {
                notificationModel.notification.Add(item);
            }
        }
Пример #7
0
        public JsonResult Create(TM_Notification entity)
        {
            long SymptomId = new NotificationDao().Create(entity);

            entity.Id = SymptomId;
            if (SymptomId > 0)
            {
                return(Json(entity));
            }
            else
            {
                return(NotifyError("Tạo"));
            }
        }
Пример #8
0
        public void loadNotification()
        {
            Session[CommonConstant.NOTIFICATION_SESSION] = new NotificationModel();
            NotificationModel notificationModel = Session[CommonConstant.NOTIFICATION_SESSION] as NotificationModel;
            var dao = new NotificationDao();

            if (dao.getNumDonHang() == 0)
            {
                notificationModel.check = false;
            }
            else
            {
                notificationModel.check = true;
            }
        }
Пример #9
0
        public ActionResult NotificationDetail(int ID)
        {
            if (!check())
            {
                return(RedirectToAction("Login", "User"));
            }
            var                dao          = new OrderDao();
            var                Dao          = new NotificationDao();
            Notification       notification = Dao.GetNotification(ID);
            List <OrderDetail> res          = dao.getInfoOrder(notification.DonHang.ID);

            notification.State = true;
            Dao.UpdateNotificationDao(notification);
            return(View(res));
        }
Пример #10
0
        public JsonResult ListAllPaging(string keyword, int?typeId, int?userId, int?page = 1, int?rows = 10)
        {
            int pageIndex = page.HasValue ? (int)page : 1;
            int pageSize  = rows.HasValue ? (int)rows : 10;
            int type      = typeId == null ? 0 : (int)typeId;
            int receiver  = userId == null ? 0 : (int)userId;
            int total     = 0;
            // var result = new NotificationDao().ListAllPaging(out total, pageIndex, pageSize);
            var result = new NotificationDao().ListAllPaging(out total, keyword, type, receiver, pageIndex, pageSize);

            if (result == null)
            {
                return(NotifyError("Liệt kê"));
            }
            return(Json(new { total = total, rows = result }));
        }
Пример #11
0
        public override NotificationList BuildNotificationList()
        {
            NotificationDao ticketDao = new NotificationDao(_connection);
            NotificationList topicList = new NotificationList();

            foreach (Topic topic in _topicModel.HelpTopics)
            {
                ViolationList list = new ViolationList(topic.Name, _subjectKey, _urlKey);
                ticketDao.GetHelpTopicDeptManager(topic.Id, ref list);
                ticketDao.GetSlaViolations(topic.PastDueDays, topic.Id, ref list);
                ticketDao.GetCustomDateViolations(topic.PastDueDays, topic.Id, topic.Form.DueDateField, ref list);
                AddAdditionalRecipients(topic, ref list);
                topicList.violations.Add(list);
            }

            return topicList;
        }
Пример #12
0
        public override NotificationList BuildNotificationList()
        {
            //throw new NotImplementedException();
            NotificationDao  ticketDao        = new NotificationDao(_connection);
            NotificationList notificationList = new NotificationList();

            foreach (Department department in _departmentModel.departments)
            {
                ViolationList violationList = new ViolationList(department.Name, _subjectKey, _urlKey);
                ticketDao.GetDepartmentManager(department.Id, ref violationList);
                ticketDao.GetOverDueTaskViolations(Convert.ToString(department.Id),
                                                   Convert.ToString(department.PastDueDays), ref violationList);
                AddAdditionalRecipients(department, ref violationList);
                notificationList.violations.Add(violationList);
            }
            return(notificationList);
        }
Пример #13
0
        public ActionResult Cancel(int ID)
        {
            var     dao  = new OrderDao();
            DonHang item = dao.getOrder(ID);

            item.State = 2;
            dao.UpdateOrder(item);
            //
            Notification notification = new Notification();

            notification.CustomerID = item.CustomerID;
            notification.DonHangID  = item.ID;
            notification.Infomation = "đã bị hủy";
            notification.State      = false;
            notification.Timer      = DateTime.Now;
            var Dao = new NotificationDao();

            Dao.AddNotificationDao(notification);

            return(RedirectToAction("OrderList", "Cook"));
        }
        public ActionResult Create(OrderViewModel model)
        {
            // List all paraclinical params
            ViewBag.SymptomList = new MeasureParamDao().ListAll(2);
            if (ModelState.IsValid)
            {
                int curUserId = User.Identity.GetUserId <int>(); //Get current user Id
                if (curUserId <= 0)
                {
                    curUserId = 1021;
                }

                TM_Order order = new TM_Order();
                order.OrderDate = DateTime.Now;
                order.PatientId = curUserId;
                order.Status    = true;
                order.Title     = model.Title;
                order.Notes     = model.Notes;
                // Create an order
                long orderId = new OrderDao().Create(order);
                // add symptoms to order
                for (int i = 0; i < model.Symptoms.Length; i++)
                {
                    //
                    if (!(new OrderDao().AddSymptom(order.Id, model.Symptoms[i])))
                    {
                        ModelState.AddModelError("", "Không thêm được triệu chứng thứ" + (i + 1));
                        return(View(model));
                    }
                }
                // add clinical params to order
                // add Height param
                if (!new OrderDao().AddParamByName(order.Id, "Height", model.Height, DateTime.Now))
                {
                    ModelState.AddModelError("", "Không thêm được chiều cao");
                    return(View(model));
                }
                // add Weight param
                if (!new OrderDao().AddParamByName(order.Id, "Weight", model.Weight, DateTime.Now))
                {
                    ModelState.AddModelError("", "Không thêm được cân nặng");
                    return(View(model));
                }
                // add Weight param
                if (!new OrderDao().AddParamByName(order.Id, "LowPressure", model.LowPressure, model.LowPressureDate))
                {
                    ModelState.AddModelError("", "Không thêm được huyết áp tâm thu");
                    return(View(model));
                }
                // add Weight param
                if (!new OrderDao().AddParamByName(order.Id, "HighPressure", model.HighPressure, model.HighPressureDate))
                {
                    ModelState.AddModelError("", "Không thêm được huyết áp tâm trương");
                    return(Json(new { loi = "HighPressure" }));
                    //return View(model);
                }
                // add Weight param
                if (!new OrderDao().AddParamByName(order.Id, "HeartBeat", model.HeartBeat, model.HeartBeatDate))
                {
                    ModelState.AddModelError("", "Không thêm được nhịp tim");
                    return(Json(new { loi = "HeartBeat" }));
                    //return View(model);
                }

                // Add paraclinical params to order
                for (int j = 0; j < model.ParamIds.Length; j++)
                {
                    if (!new OrderDao().AddParamById(orderId, (short)model.ParamIds[j], model.ParaclinicalParams[j], model.MeasuredDates[j]))
                    {
                        ModelState.AddModelError("", "Không thêm được thông số cận lâm sàng");
                        return(Json(new { loi = "paraclinical" }));
                        //return View(model);
                    }
                }

                // Find a doctor for this order
                int doctorId = new DoctorDao().FindDoctorForPatient(curUserId);
                if (doctorId <= 0)
                {
                    ModelState.AddModelError("", "Không tìm thấy bác sĩ nào trên hệ thống");
                    return(Json(new { loi = "doctor not found" }));
                    //return View(model);
                }
                // Assign doctor to order
                if (!new OrderDao().AssignDoctorToOrder(doctorId, orderId, curUserId))
                {
                    ModelState.AddModelError("", "Không thể gửi yêu cầu này cho bác sĩ");
                    return(Json(new { loi = "asign doctor for an order", doctor = doctorId, patient = curUserId }));
                    //return View(model);
                }

                // Notify to doctor
                TM_Notification noty = new TM_Notification();
                noty.Title       = "Yêu cầu chẩn đoán từ " + User.Identity.GetFullName();
                noty.Link        = (int)order.Id;
                noty.CreatedDate = DateTime.Now;
                noty.Contents    = "Bệnh nhân gửi yêu cầu chẩn đoán cho bác sĩ";
                noty.Type        = 1; // yêu cầu chẩn đoán
                noty.ReceiverId  = doctorId;
                noty.Status      = false;
                var notiResult = new NotificationDao().Create(noty);
                if (notiResult < 1)
                {
                    ModelState.AddModelError("", "Không tìm thấy bác sĩ nào trên hệ thống");
                    return(Json(new { loi = "Không thêm được thông báo" }));
                }
                TempData["Message"] = "Tạo bệnh án thành công";
                return(RedirectToAction("Index", "PatientOrder", new { Area = "Patient" }));
            }

            return(View(model));
        }
Пример #15
0
 public NotificationController()
 {
     objDao = new NotificationDao();
 }
        public ActionResult Create(ReceptionViewModel entity)
        {
            if (string.IsNullOrWhiteSpace(entity.FullName))
            {
                ViewBag.Error = "Chưa nhập họ tên bệnh nhân";
                return(View(entity));
            }
            // Create
            string newstr = Utilities.RemoveUnicode(entity.FullName);

            string[]      split   = newstr.Split(' ');
            StringBuilder builder = new StringBuilder();

            if (split.Length > 2)
            {
                if (!string.IsNullOrWhiteSpace(split[2]))
                {
                    builder.Append(split[2]);
                }
            }
            if (split.Length > 1)
            {
                if (!string.IsNullOrWhiteSpace(split[1]))
                {
                    builder.Append(split[1]);
                }
            }
            builder.Append('.');
            if (!string.IsNullOrWhiteSpace(split[0]))
            {
                builder.Append(split[0]);
            }
            if (entity.BirthYear > 0)
            {
                builder.Append(entity.BirthYear);
            }
            string username = builder.ToString().ToLower();

            TempData["UserName"] = username;;
            // Create password
            string password = "******";

            TempData["Password"] = password;
            //long temp = 0;
            if (entity.PhoneNumber.Length < 10 || !IsNumbers(entity.PhoneNumber))
            {
                ViewBag.Error = "Số điện thoại phải là số có độ dài >=10";
                return(View(entity));
            }
            if (UserManager.FindByName(entity.PhoneNumber) != null)
            {
                ViewBag.Error = "Số điện thoại này đã đăng ký";
                return(View(entity));
            }
            // Create new User
            var user = new ApplicationUser
            {
                UserName    = entity.PhoneNumber,
                PhoneNumber = entity.PhoneNumber,
                FullName    = entity.FullName,
                Email       = username + "@gmail.com",
                Gender      = entity.Gender,
                DateOfBirth = new DateTime(entity.BirthYear, 1, 1),
                LastLogin   = DateTime.Now
            };
            var createdUser = UserManager.Create(user, password);

            // Assign user to role PATIENT_GROUP
            IdentityResult createdRole = null;

            if (createdUser.Succeeded)
            {
                // Assign user to Patien role
                createdRole = UserManager.AddToRole(user.Id, "PATIENT_GROUP");
            }
            else
            {
                ViewBag.Error = "Không tạo được user";
                return(View(entity));
            }
            // Update database
            ReceptionRegisterSp_Result result = null;

            if (createdRole.Succeeded)
            {
                // Create input model
                SpReceptionRegisterViewModel model = new SpReceptionRegisterViewModel();
                model.UserId   = user.Id;
                model.Address  = entity.Address;
                model.WardId   = entity.WardId;
                model.Syptom   = entity.Symptom;
                model.DoctorId = entity.DoctorId;
                result         = new ReceptionDao().CreateNewOrder(model);
                ViewBag.Result = result;
            }
            else
            {
                ViewBag.Error = "Không tạo được Role";
                return(View(entity));
            }
            if (result == null)
            {
                ViewBag.Error = "Không tạo được Order";
                return(View(entity));
            }
            // Send Notify to doctor
            // Notify to doctor
            TM_Notification noty = new TM_Notification();

            noty.Title       = "Yêu cầu chẩn đoán từ " + User.Identity.GetFullName();
            noty.Link        = (int)result.OrderId;
            noty.CreatedDate = DateTime.Now;
            noty.Contents    = "Bệnh nhân gửi yêu cầu chẩn đoán cho bác sĩ";
            noty.Type        = 1; // yêu cầu chẩn đoán
            noty.ReceiverId  = entity.DoctorId;
            noty.Status      = false;
            var notiResult = new NotificationDao().Create(noty);

            if (notiResult < 1)
            {
                ModelState.AddModelError("", "Không thêm được thông báo");
                return(Json(new { loi = "Không thêm được thông báo" }));
            }
            return(RedirectToAction("Index"));
        }
Пример #17
0
        /// <summary>
        /// Lấy danh sách trieu chung nạp vào combobox
        /// </summary>
        /// <returns></returns>
        public JsonResult ListAll()
        {
            var entity = new NotificationDao().ListAll();

            return(Json(entity, JsonRequestBehavior.AllowGet));
        }