コード例 #1
0
        public JsonResult CreatePoliClinic()
        {
            ClinicPoliResponse response = new ClinicPoliResponse();
            ClinicPoliModel    _model   = new ClinicPoliModel();

            if (Request.Form["ClinicID"] != null)
            {
                _model.ClinicID = Convert.ToInt64(Request.Form["ClinicID"].ToString());
            }
            if (Request.Form["Poli"] != null)
            {
                _model.PoliIDs = JsonConvert.DeserializeObject <List <int> >(Request.Form["Poli"]);
            }
            if (Session["UserLogon"] != null)
            {
                _model.Account = (AccountModel)Session["UserLogon"];
            }

            var request = new ClinicPoliRequest
            {
                Data = _model
            };

            new ClinicPoliValidator(_unitOfWork, _context).Validate(request, out response);
            return(Json(new { Status = response.Status, Message = response.Message }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ClinicPoliResponse GetListData(ClinicPoliRequest request)
        {
            var             qry    = _unitOfWork.PoliClinicRepository.Get(x => x.RowStatus == 0 && x.ClinicID == request.Data.ClinicID);
            ClinicPoliModel _model = new ClinicPoliModel();

            if (qry.Count > 0)
            {
                _model.ClinicID = qry.FirstOrDefault().ClinicID;
            }

            foreach (var item in qry)
            {
                _model.PoliIDs.Add(item.PoliID);
            }

            var response = new ClinicPoliResponse
            {
                Entity = _model
            };

            return(response);
        }
コード例 #3
0
        public ActionResult ClinicPoliList()
        {
            ClinicPoliModel rpmodel = new ClinicPoliModel();

            if (Request.QueryString["clinicid"] != null)
            {
                var reqOrg = new ClinicRequest
                {
                    Data = new ClinicModel
                    {
                        Id = Convert.ToInt64(Request.QueryString["clinicid"].ToString())
                    }
                };

                var respOrg = new ClinicResponse();
                respOrg            = new ClinicHandler(_unitOfWork).GetDetail(reqOrg);
                rpmodel.ClinicName = respOrg.Entity.Name;
                rpmodel.ClinicID   = respOrg.Entity.Id;

                var _request = new ClinicPoliRequest
                {
                    Data = new ClinicPoliModel
                    {
                        ClinicID = Convert.ToInt64(Request.QueryString["clinicid"].ToString())
                    }
                };
                //get Privilege Ids for organization
                var selPolis = new ClinicPoliHandler(_unitOfWork, _context).GetListData(_request);
                if (selPolis.Entity.PoliIDs != null && selPolis.Entity.PoliIDs.Count > 0)
                {
                    rpmodel.PoliIDs = selPolis.Entity.PoliIDs;
                }
            }

            return(View(rpmodel));
        }
コード例 #4
0
 public AccountModelSession()
 {
     Roles      = new List <long>();
     Privileges = new RolePrivilegeModel();
     Polis      = new ClinicPoliModel();
 }
コード例 #5
0
        public ClinicPoliResponse GetPoliBasedOnOrClinic(ClinicPoliRequest request)
        {
            var _clinicId = _unitOfWork.ClinicRepository.GetById(request.Data.ClinicID) == null ? 0 : _unitOfWork.ClinicRepository.GetById(request.Data.ClinicID).ID;

            List <ClinicPoliModel> lists = new List <ClinicPoliModel>();
            dynamic qry             = null;
            var     searchPredicate = PredicateBuilder.New <PoliClinic>(true);

            searchPredicate = searchPredicate.And(x => x.ClinicID == _clinicId);
            if (!String.IsNullOrEmpty(request.SearchValue) && !String.IsNullOrWhiteSpace(request.SearchValue))
            {
                searchPredicate = searchPredicate.And(p => p.Poli.Name.Contains(request.SearchValue) || p.Poli.Code.Contains(request.SearchValue));
            }

            if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir)))
            {
                if (request.SortColumnDir == "asc")
                {
                    switch (request.SortColumn.ToLower())
                    {
                    case "name":
                        qry = _unitOfWork.PoliClinicRepository.Get(searchPredicate, orderBy: q => q.OrderBy(x => x.Poli.Name));
                        break;

                    default:
                        qry = _unitOfWork.PoliClinicRepository.Get(searchPredicate, orderBy: q => q.OrderBy(x => x.ID));
                        break;
                    }
                }
                else
                {
                    switch (request.SortColumn.ToLower())
                    {
                    case "name":
                        qry = _unitOfWork.PoliClinicRepository.Get(searchPredicate, orderBy: q => q.OrderByDescending(x => x.Poli.Name));
                        break;

                    default:
                        qry = _unitOfWork.PoliClinicRepository.Get(searchPredicate, orderBy: q => q.OrderByDescending(x => x.ID));
                        break;
                    }
                }
            }
            else
            {
                qry = _unitOfWork.PoliClinicRepository.Get(searchPredicate, null);
            }

            foreach (var item in qry)
            {
                var prData = new ClinicPoliModel
                {
                    Id         = item.ID,
                    ClinicID   = item.ClinicID,
                    PoliID     = item.PoliID,
                    PoliName   = item.Poli.Name,
                    ClinicName = item.Clinic.Name,
                    PoliCode   = item.Poli.Code,
                };

                lists.Add(prData);
            }

            int totalRequest = lists.Count();
            var data         = lists.Skip(request.Skip).Take(request.PageSize).ToList();

            var response = new ClinicPoliResponse
            {
                Draw            = request.Draw,
                RecordsFiltered = totalRequest,
                RecordsTotal    = totalRequest,
                Data            = data
            };

            return(response);
        }