Пример #1
0
        private List <SelectListItem> BindDropDownPatientList()
        {
            var qry = _unitOfWork.PatientRepository.Get();
            IList <PatientModel> _patientModelList = new List <PatientModel>();

            foreach (var item in qry)
            {
                var _poli = Mapper.Map <Patient, PatientModel>(item);
                _patientModelList.Add(_poli);
            }

            LoketResponse response = GetTodayRegistrationList();

            List <SelectListItem> _patientList = new List <SelectListItem>();

            foreach (var item in _patientModelList)
            {
                // validate if patient already registered and the status is New
                if (!response.Data.Any(x => x.PatientID == item.Id && x.Status == 0))
                {
                    _patientList.Add(new SelectListItem
                    {
                        Text  = item.Name,
                        Value = item.Id.ToString()
                    });
                }
            }

            return(_patientList);
        }
Пример #2
0
        public LoketResponse GetListData(LoketRequest request)
        {
            var _laboratoriumId = _unitOfWork.PoliRepository.GetFirstOrDefault(x => x.Name == Constants.NameConstant.Laboratorium);

            if (_laboratoriumId == null)
            {
                _laboratoriumId = new Poli {
                    ID = 0
                }
            }
            ;
            Expression <Func <QueuePoli, bool> > _serachCriteria = x => x.PoliTo == _laboratoriumId.ID;

            List <LoketModel> lists = base.GetbaseLoketData(request, _serachCriteria);
            int totalRequest        = lists.Count();
            var response            = new LoketResponse
            {
                Draw            = request.Draw,
                RecordsFiltered = totalRequest,
                RecordsTotal    = totalRequest,
                Data            = lists
            };

            return(response);
        }
Пример #3
0
        public ActionResult Edit()
        {
            LoketResponse _response = new LoketResponse();
            var           request   = new LoketRequest
            {
                Data = new LoketModel
                {
                    Id = long.Parse(Request.QueryString["id"].ToString())
                }
            };

            LoketResponse resp   = new LoketHandler(_unitOfWork).GetDetail(request);
            LoketModel    _model = resp.Entity;

            _model.CurrentPoliID         = GetUserPoliID();
            ViewBag.Response             = _response;
            ViewBag.PoliList             = BindDropDownPoliList(_model.PoliFromID);
            ViewBag.PatientList          = BindDropDownPatientList();
            ViewBag.RegistrationTypeList = BindDropDownTypeList();
            ViewBag.DoctorList           = BindDropDownDoctorList(_model.PoliToID);
            ViewBag.PaymentTypeList      = BindDropDownPaymentTypeList();
            ViewBag.NecessityList        = BindDropDownNecessityList();

            return(View("Edit", _model));
        }
Пример #4
0
        private LoketResponse ValidateBeforeCall(LoketRequest request)
        {
            var response = new LoketResponse();

            if (request.CallRequest.PoliID <= 0)
            {
                errorFields.Add("Poli ID");
            }
            if (string.IsNullOrEmpty(request.CallRequest.QueueCode))
            {
                errorFields.Add("Queue Code");
            }
            if (request.CallRequest.SortNumber <= 0)
            {
                errorFields.Add("Sort Number");
            }

            if (errorFields.Any())
            {
                response.Status  = false;
                response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields));
            }
            else
            {
                //response=
            }
            return(response);
        }
Пример #5
0
        /// <summary>
        /// Validate request
        /// </summary>
        /// <param name="request"></param>
        /// <param name="response"></param>
        public LoketResponse Validate(LoketRequest request)
        {
            var response = new LoketResponse();

            if (request.Action != null)
            {
                if (request.Action.Equals(ClinicEnums.Action.DELETE.ToString()))
                {
                    response = ValidateForDelete(request);
                }
                else if (request.Action.Equals(ClinicEnums.Action.Process.ToString()))
                {
                    response = ValidateForProcess(request);
                }
                else if (request.Action.Equals(ClinicEnums.Action.Hold.ToString()))
                {
                    response = ValidateForHold(request);
                }
                else if (request.Action.Equals(ClinicEnums.Action.Finish.ToString()))
                {
                    response = ValidateForFinish(request);
                }
            }
            else
            {
                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 LoketHandler(_unitOfWork).CreateOrEdit(request);
                }
            }

            return(response);
        }
Пример #6
0
        public ActionResult GetDoctorPatientListPoliID(int poliId)
        {
            LoketResponse response = GetRegistrationPatientByPoliID(poliId);

            int doctorID = GetDoctorID(Account.EmployeeID);

            if (doctorID < 0)
            {
                return(BadRequestResponse);
            }

            var filteredData = response.Data.Where(x => x.DoctorID == doctorID);

            return(Json(new { data = filteredData, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw, Status = response.Status }, JsonRequestBehavior.AllowGet));
        }
Пример #7
0
        public LoketResponse GetListData(LoketRequest request)
        {
            Expression <Func <QueuePoli, bool> > _serachCriteria = x => x.PoliTo == request.Data.PoliToID;

            List <LoketModel> lists = base.GetFarmasiBaseLoketData(request, _serachCriteria);
            int totalRequest        = lists.Count();
            var response            = new LoketResponse
            {
                Draw            = request.Draw,
                RecordsFiltered = totalRequest,
                RecordsTotal    = totalRequest,
                Data            = lists
            };

            return(response);
        }
Пример #8
0
        /// <summary>
        /// Process validation
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        private LoketResponse ValidateForProcess(LoketRequest request)
        {
            var response = new LoketResponse();

            bool isHavePrivilege = IsHaveAuthorization(EDIT_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs);

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

            if (response.Status)
            {
                response = new LoketHandler(_unitOfWork).ProcessRegistration(request);
            }

            return(response);
        }
Пример #9
0
        public JsonResult SendForCalling(int id)
        {
            var response = new LoketResponse {
                Status = false
            };
            var _loketModel = new LoketModel
            {
                Id = id
            };
            var request = new LoketRequest
            {
                Data = _loketModel
            };

            response = new LoketHandler(_unitOfWork).GetDetail(request);
            if (response != null)
            {
                var _callModel = new PanggilanPoliModel
                {
                    PoliID     = response.Entity.PoliToID,
                    SortNumber = response.Entity.SortNumber,
                    Status     = CallStatusEnum.CallStatus.READY.ToString(),
                    Account    = Session["UserLogon"] == null ? new AccountModel() : (AccountModel)Session["UserLogon"],
                    QueueCode  = response.Entity.SortNumberCode
                };

                var _requestCall = new LoketRequest
                {
                    CallRequest = _callModel,
                };

                response = new LoketResponse();
                response = new LoketHandler(_unitOfWork).SendForCall(_requestCall);
            }

            return(Json(new
            {
                Status = response.Status,
                Message = response.Message
            }, JsonRequestBehavior.AllowGet));
        }