Exemplo n.º 1
0
        public CashierResponse Validate(CashierRequest request)
        {
            var response = new CashierResponse();

            bool isHavePrivilege = true;

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

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

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

            return(response);
        }
Exemplo n.º 2
0
        public CashierResponse GetDetail(long medicalid)
        {
            List <CashierModel> lists = new List <CashierModel>();
            dynamic             data;
            CashierResponse     cashierResponse = new CashierResponse();

            //long formmedicalid = _unitOfWork.FormMedicalRepository.Get(a => a.PatientID == patienid).Select(x => x.ID).FirstOrDefault();
            long examineid = _unitOfWork.FormExamineRepository.Get(x => x.FormMedicalID == medicalid).Select(x => x.ID).FirstOrDefault();

            if (medicalid != 0)
            {
                var formexeminelab      = _unitOfWork.FormExamineLabRepository.Query(x => x.FormMedicalID == medicalid);
                var FormExamineMedicine = _unitOfWork.FormExamineMedicineRepository.Get(x => x.FormExamineID == examineid);
                var FormExamineservice  = _unitOfWork.FormExamineServiceRepository.Get(x => x.FormExamineID == examineid);
                if (formexeminelab != null)
                {
                    foreach (var item in formexeminelab)
                    {
                        var labdata = new CashierModel
                        {
                            ItemName = item.LabItem.Name,
                            Price    = Convert.ToInt32(item.LabItem.Price)
                        };

                        lists.Add(labdata);
                    }
                }

                if (FormExamineservice != null)
                {
                    foreach (var item in FormExamineservice)
                    {
                        var labdata = new CashierModel
                        {
                            ItemName = item.Service.Name,
                            Price    = Convert.ToInt32(item.Service.Price)
                        };

                        lists.Add(labdata);
                    }
                }

                if (FormExamineMedicine != null)
                {
                    foreach (var item in FormExamineMedicine)
                    {
                        var labdata = new CashierModel
                        {
                            ItemName = item.Product.Name,
                            Price    = Convert.ToInt32(item.Product.RetailPrice)
                        };

                        lists.Add(labdata);
                    }
                }


                data = lists.ToList();
                if (data != null)
                {
                    cashierResponse = new CashierResponse
                    {
                        Data = data
                    };
                }
                else
                {
                    cashierResponse = new CashierResponse();
                }
            }

            return(cashierResponse);
        }