Example #1
0
        public HealthBodyResponse Validate(HealthBodyRequest request)
        {
            bool isHavePrivilege = true;
            var  response        = new HealthBodyResponse();

            try
            {
                if (request.Data.ForPatient == 0)
                {
                    errorFields.Add("Patient ID");
                }
                if (request.Data.Cekdate == null)
                {
                    errorFields.Add("Tanggal Pemeriksaan");
                }

                if (errorFields.Any())
                {
                    response.Status  = false;
                    response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields));
                }

                isHavePrivilege = IsHaveAuthorization(CREATE_SURAT_RUJUKAN_PRIVILEGE_, request.Data.Account.Privileges.PrivilegeIDs);
                if (!isHavePrivilege)
                {
                    response.Status  = false;
                    response.Message = Messages.UnauthorizedAccess;
                }

                if (response.Status)
                {
                    response = new HealthBodyHandler(_unitOfWork).GetPatientAndPreExamineData(request);
                }
            }
            catch (Exception ex)
            {
                response.Status  = false;
                response.Message = ex.Message;
            }

            return(response);
        }
Example #2
0
        public HealthBodyResponse ValidateBeforePreview(HealthBodyRequest request)
        {
            var response = new HealthBodyResponse();

            if (request.Data.Decision == string.Empty)
            {
                errorFields.Add("Dinyatakan");
            }

            if (errorFields.Any())
            {
                response.Status  = false;
                response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields));
            }
            else
            {
                response = new HealthBodyHandler(_unitOfWork).SaveSuratBadanSehat(request);
            }

            return(response);
        }