Esempio n. 1
0
        /// <summary>
        /// Validate request
        /// </summary>
        /// <param name="request"></param>
        /// <param name="response"></param>
        public FormExamineResponse Validate(FormExamineRequest request)
        {
            var response = new FormExamineResponse();

            bool isHavePrivilege = true;

            if (request.Data.Id == 0)
            {
                isHavePrivilege = IsHaveAuthorization(ADD_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs);
            }
            else
            {
                isHavePrivilege = IsHaveAuthorization(EDIT_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs);
            }

            if (!isHavePrivilege)
            {
                response.Status  = false;
                response.Message = Messages.UnauthorizedAccess;
            }

            if (response.Status)
            {
                response = new FormExamineHandler(_unitOfWork, _context).CreateOrEdit(request);
            }

            return(response);
        }
Esempio n. 2
0
        public ActionResult FormExamine(
            string formExamineID,
            string loketID,
            string anamnesa,
            string diagnose,
            string therapy,
            string receipt,
            string finalState,
            string icdInformation,
            string poliToID,
            string doctorToID,
            List <string> concoctionMedicineList,
            List <string> medicineList,
            List <string> injectionList,
            List <string> labList,
            List <string> radiologyList,
            List <string> serviceList)
        {
            if (concoctionMedicineList == null)
            {
                concoctionMedicineList = new List <string>();
            }
            if (medicineList == null)
            {
                medicineList = new List <string>();
            }
            if (injectionList == null)
            {
                injectionList = new List <string>();
            }
            if (labList == null)
            {
                labList = new List <string>();
            }
            if (radiologyList == null)
            {
                radiologyList = new List <string>();
            }
            if (serviceList == null)
            {
                serviceList = new List <string>();
            }

            PoliExamineModel model = GeneratePoliExamineModel(formExamineID, loketID, anamnesa, diagnose, therapy, receipt, finalState, icdInformation, poliToID, doctorToID, concoctionMedicineList, medicineList, injectionList, labList, radiologyList, serviceList);

            model.Account = Account;

            var request = new FormExamineRequest {
                Data = model,
            };

            FormExamineResponse _response = new FormExamineValidator(_unitOfWork, _context).Validate(request);

            if (_response.Status)
            {
                // Notify to all
                RegistrationHub.BroadcastDataToAllClients();
            }

            ViewBag.Response = $"{_response.Status};{_response.Message}";
            var tempPoliList = BindDropDownPoliList(model.LoketData.PoliToID);

            ViewBag.PoliList       = tempPoliList;
            ViewBag.DoctorList     = BindDropDownDoctorList(int.Parse(tempPoliList[0].Value));
            ViewBag.FinalStateList = BindDropDownFinalStateList();
            ViewBag.ICDInfo        = BindDropDownICDInfo();
            return(Json(new { Status = _response.Status, Message = _response.Message }, JsonRequestBehavior.AllowGet));
        }