Exemplo n.º 1
0
        public ActionResult GetClinicPoliData()
        {
            var _draw          = Request.Form.GetValues("draw").FirstOrDefault();
            var _start         = Request.Form.GetValues("start").FirstOrDefault();
            var _length        = Request.Form.GetValues("length").FirstOrDefault();
            var _sortColumn    = Request.Form.GetValues("columns[" + Request.Form.GetValues("order[0][column]").FirstOrDefault() + "][name]").FirstOrDefault();
            var _sortColumnDir = Request.Form.GetValues("order[0][dir]").FirstOrDefault();
            var _searchValue   = Request.Form.GetValues("search[value]").FirstOrDefault();

            int _pageSize = _length != null?Convert.ToInt32(_length) : 0;

            int _skip = _start != null?Convert.ToInt32(_start) : 0;


            var request = new PoliRequest
            {
                Draw          = _draw,
                SearchValue   = _searchValue,
                SortColumn    = _sortColumn,
                SortColumnDir = _sortColumnDir,
                PageSize      = _pageSize,
                Skip          = _skip
            };

            var response = new PoliHandler(_unitOfWork).GetListData(request);

            return(Json(new { data = response.Data, recordsFiltered = response.RecordsFiltered, recordsTotal = response.RecordsTotal, draw = response.Draw }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        private List <SelectListItem> BindDropDownPoli(int exclId)
        {
            IList <PoliModel>     PoliData  = new PoliHandler(_unitOfWork).GetAllPoli(exclId);
            List <SelectListItem> _poliList = new List <SelectListItem>();

            _poliList.Insert(0, new SelectListItem
            {
                Text  = "All",
                Value = "0"
            });

            foreach (var item in PoliData)
            {
                _poliList.Add(new SelectListItem
                {
                    Text  = item.Name,
                    Value = item.Id.ToString()
                });
            }

            return(_poliList);
        }
Exemplo n.º 3
0
        public LabResponse CreateOrEdit(LabRequest request)
        {
            int result          = 0;
            var response        = new LabResponse {
            };
            var _getDataLabPoli = _unitOfWork.LabItemRepository.Get(x => x.RowStatus == 0);

            #region ::DELETE FIRST::
            var _deleteFormExamineLab = _unitOfWork.FormExamineLabRepository.Get(x => x.FormMedicalID == request.Data.FormMedicalID && x.LabType == Constants.NameConstant.Laboratorium);
            foreach (var item1 in _deleteFormExamineLab)
            {
                _unitOfWork.FormExamineLabRepository.Delete(item1.ID);
            }

            var poliId             = PoliHandler.GetPoliIDBasedOnName(Constants.NameConstant.Laboratorium);
            var _deleteFormExamine = _unitOfWork.FormExamineRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID && x.PoliID == poliId);
            if (_deleteFormExamine != null)
            {
                _unitOfWork.FormExamineRepository.Delete(_deleteFormExamine.ID);
            }

            int deleteResult = _unitOfWork.Save();
            #endregion

            //insert to Form Examine
            try
            {
                var _formExamine = new FormExamine
                {
                    FormMedicalID = request.Data.FormMedicalID,
                    PoliID        = PoliHandler.GetPoliIDBasedOnName(Constants.NameConstant.Laboratorium),
                    TransDate     = DateTime.Now,
                    CreatedBy     = request.Data.Account.UserName,
                    CreatedDate   = DateTime.Now
                };

                _unitOfWork.FormExamineRepository.Insert(_formExamine);

                foreach (var _id in request.Data.LabItemsId)
                {
                    var _formExamineLabEntity = new FormExamineLab
                    {
                        FormMedicalID = request.Data.FormMedicalID,
                        LabType       = _getDataLabPoli.Where(x => x.ID == _id).FirstOrDefault().LabItemCategory.LabType,
                        LabItemID     = (Int32)_id,
                        CreatedBy     = request.Data.Account.UserName,
                        CreatedDate   = DateTime.Now
                    };

                    _unitOfWork.FormExamineLabRepository.Insert(_formExamineLabEntity);
                }

                result = _unitOfWork.Save();
                if (result > 0)
                {
                    var _editQueuePoli = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id);
                    if (_editQueuePoli != null)
                    {
                        _editQueuePoli.Status       = (int)RegistrationStatusEnum.Hold;
                        _editQueuePoli.ModifiedBy   = request.Data.Account.UserName;
                        _editQueuePoli.ModifiedDate = DateTime.Now;
                        _unitOfWork.RegistrationRepository.Update(_editQueuePoli);
                        _unitOfWork.Save();
                    }
                }
                response.Status  = true;
                response.Message = string.Format(Messages.LabItemAdded, result, request.Data.FormMedicalID);
            }
            catch (Exception ex)
            {
                response.Status  = false;
                response.Message = Messages.GeneralError;
            }

            return(response);
        }