Пример #1
0
        public async Task <IActionResult> List(Guid?appId, string sort, string appType)
        {
            if (appId == null)
            {
                return(await Task.Run(() => NotFound()));
            }

            var appAssigneeList = await _service.GetAssigneeList(appId);

            ViewBag.AppType   = appType;
            ViewBag.appId     = appId;
            ViewBag.appType   = appType;
            ViewBag.IsAddable = _entityStateHelper.ApplicationAddability(appId.Value).IsAssignee;
            foreach (var dto in appAssigneeList)
            {
                dto.IsEditable = _entityStateHelper.IsEditableAuth(dto.Id) ?? false;
            }
            if (sort == "AddBranchApplication")
            {
                appAssigneeList = appAssigneeList.OrderBy(x => x.IsFromLicense == true);
                return(PartialView("List_AddBranchApplication", appAssigneeList));
            }

            ViewBag.Sort = sort;


            return(PartialView(appAssigneeList));
        }
Пример #2
0
        public JsonResult GetAssigneeByLicense(Guid?msgId, string orgPosType)
        {
            var orgInfo = _messageService.GetOrgInfo(LicenseType.eTRL_LICENSE);

            if (orgInfo.ParentId == null)
            {
                return(null);
            }
            var assigneeList = _appAssigneeService.GetAssigneeList(orgInfo.ParentId).Result;

            SelectList selectList;
            var        message = DataService.GetDto <PharmacyHeadReplacementMessageDTO>(p => p.Id == msgId).SingleOrDefault();

            if (message == null)
            {
                var assignee = DataService.GetEntity <AppAssignee>(p => p.OrgPositionType == (!string.IsNullOrEmpty(orgPosType) ? orgPosType : "Authorized") && assigneeList.Select(z => z.Id).Contains(p.Id));
                selectList = new SelectList(assignee, nameof(AppAssignee.Id), nameof(AppAssignee.FIO));

                ViewBag.BranchList = selectList;
                ViewBag.OrgPosType = (!string.IsNullOrEmpty(orgPosType) ? orgPosType : "Authorized");
                return(Json(selectList));
            }

            var assigneeMsg  = DataService.GetEntity <AppAssignee>(p => assigneeList.Select(z => z.Id).Contains(p.Id));
            var assigneeType = assigneeMsg.SingleOrDefault(p => p.Id == message.MpdSelectedId);

            if (assigneeType == null)
            {
                return(null);
            }

            selectList = new SelectList(assigneeMsg.Where(p => p.OrgPositionType == (!string.IsNullOrEmpty(orgPosType) ? orgPosType : assigneeType?.OrgPositionType)), nameof(AppAssignee.Id), nameof(AppAssignee.FIO), message.MpdSelectedId);

            ViewBag.BranchList = selectList;
            ViewBag.OrgPosType = (!string.IsNullOrEmpty(orgPosType) ? orgPosType : assigneeType?.OrgPositionType);

            return(Json(selectList));
        }