Esempio n. 1
0
        public PartialViewResult Add()
        {
            ViewBag.Permissions = db.Permissions.ToList();
            var clinicType = new ClinicType();

            return PartialView("_AddClinicType", clinicType);
        }
        public void Create(Guid patientId, Guid providerId, Guid clinicTypeId, Guid workflowInstanceId)
        {
            try
            {
                Application application = GetApplication();

                Patient    patient    = application.FindPatientById(patientId);
                Referrer   referrer   = patient.ReferringClinician;
                Provider   provider   = application.FindProviderById(providerId);
                ClinicType clinicType = (BMS.ClinicType)application.FindClinicTypeById(clinicTypeId);

                Appointment appointment = application.NewAppointment(patient, referrer, provider, clinicType);
                appointment.WorkflowId = workflowInstanceId;
                appointment.Save();
            }
            catch (Exception ex)
            {
                CallContext.SetData("Exception", ex);
            }
        }
Esempio n. 3
0
        public JsonResult AddOrUpdate(int Id, string name)
        {
            try
            {
                if (name == null)
                {
                    return Json(new { success = false, message = "Vui lòng nhập tên loại phòng khám !" }, JsonRequestBehavior.AllowGet);
                }
                if (Id <= 0)
                {
                    var clinicType = new ClinicType();
                    clinicType.Id = Id;
                    clinicType.Name = name;

                    db.ClinicTypes.AddOrUpdate(clinicType);
                }
                else
                {
                    var oldClinicType = db.ClinicTypes.Where(x => x.Id == Id).FirstOrDefault();
                    if (oldClinicType != null)
                    {
                        oldClinicType.Name = name;
                        db.ClinicTypes.AddOrUpdate(oldClinicType);
                    }
                    else
                    {
                        return Json(new { success = false, message = "Không tìm thấy loại phòng khám !" }, JsonRequestBehavior.AllowGet);
                    }
                }
                db.SaveChanges();
                return Json(new { success = true, message = "Lưu dữ liệu thành công" }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception)
            {
                return Json(new { success = false, message = "Đã có lỗi xảy ra" }, JsonRequestBehavior.AllowGet);
            }


        }