Ejemplo n.º 1
0
        public async Task <IActionResult> List(Guid?ApplicationId, IDictionary <string, string> paramList,
                                               Core.Mvc.Controllers.ActionListOption <ImlMedicineListDTO> options)
        {
            if (ApplicationId == null)
            {
                return(NotFound());
            }
            ViewBag.IsAddable     = _entityStateHelper.ApplicationAddability(ApplicationId.Value).IsMedicine;
            ViewBag.ApplicationId = ApplicationId;
            var file = DataService.GetEntity <FileStore>(x =>
                                                         x.EntityId == ApplicationId && x.EntityName == nameof(ImlApplication) && x.Description == "Medicines").FirstOrDefault();

            if (file == null)
            {
                ViewBag.FileCheck = false;
            }
            else
            {
                ViewBag.FileCheck = true;
            }
            return(await base.PartialList(paramList, options, (dictionary, option) => DataService.GetDtoAsync <ImlMedicineListDTO>(
                                              orderBy: options.pg_SortExpression ?? "-MedicineName",
                                              predicate: p => p.IsFromLicense == false,
                                              parameters: dictionary,
                                              skip: (options.pg_Page - 1) * PageRowCount.Value,
                                              take: PageRowCount.Value)));
        }
Ejemplo n.º 2
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList,
                                                 Core.Mvc.Controllers.ActionListOption <LimsListRPDTO> actionListOption)
 {
     actionListOption.pg_SortExpression = !string.IsNullOrEmpty(actionListOption.pg_SortExpression)
         ? actionListOption.pg_SortExpression
         : "-DocId";
     return(await base.List(paramList, actionListOption));
 }
Ejemplo n.º 3
0
        public async Task <IActionResult> ListMessage(Guid?msgId, string messageState, IDictionary <string, string> paramList,
                                                      Core.Mvc.Controllers.ActionListOption <ImlMedicineListMsgDTO> options)
        {
            var licenseGuid = _imlLicenseService.GetLicenseGuid();
            var license     = DataService.GetEntity <ImlLicense>(p => p.Id == licenseGuid).SingleOrDefault();

            options.pg_PartialViewName = "ListMessage";
            ViewBag.MsgId        = msgId;
            ViewBag.AppId        = license.ParentId;
            ViewBag.MessageState = messageState;

            paramList = paramList
                        .Where(x => !string.IsNullOrEmpty(x.Value) &&
                               x.Key != "__RequestVerificationToken" &&
                               x.Key != "X-Requested-With" &&
                               !x.Key.StartsWith("pg_"))
                        .ToDictionary(x => x.Key, x => x.Value);

            var medicineMsg = DataService.GetEntity <ImlMedicine>(p => p.ApplicationId == msgId).Select(p => p.ParentId).ToList();
            IEnumerable <ImlMedicineListMsgDTO> medList;

            if (messageState == "Project")
            {
                medList = await DataService.GetDtoAsync <ImlMedicineListMsgDTO>(
                    orderBy : options.pg_SortExpression ?? "ParentId",
                    parameters : paramList,
                    predicate : p => (p.ApplicationId == license.ParentId && !medicineMsg.Contains(p.Id) && (p.MessageState == "Project" || string.IsNullOrEmpty(p.MessageState))) || (p.ApplicationId == msgId),
                    skip : (options.pg_Page - 1) *PageRowCount.Value,
                    take : PageRowCount.Value);
            }
            else
            {
                medList = await DataService.GetDtoAsync <ImlMedicineListMsgDTO>(
                    orderBy : options.pg_SortExpression ?? "ParentId",
                    parameters : paramList,
                    predicate : p => (p.ApplicationId == license.ParentId && !medicineMsg.Contains(p.Id) && (p.MessageState == "Project")) || (p.ApplicationId == msgId),
                    skip : (options.pg_Page - 1) *PageRowCount.Value,
                    take : PageRowCount.Value);
            }

            medList.ToList().ForEach(p =>
            {
                p.NewName = DataService.GetEntity <ImlMedicine>(z => z.Id == p.ParentId).SingleOrDefault()?.SupplierName;
                p.OldName = DataService.GetEntity <ImlMedicine>(z => p.ParentId == z.Id).SingleOrDefault()?.SupplierName;
            });

            var pagingList = PagingList.Create(medList,
                                               PageRowCount.Value,
                                               options.pg_Page,
                                               "ParentId",
                                               "Id",
                                               x => (x as IPagingCounted)?.TotalRecordCount,
                                               "ListMessage",
                                               true);

            return(PartialView(options.pg_PartialViewName, pagingList));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> LicenseMedList(Guid?ApplicationId, IDictionary <string, string> paramList,
                                                         Core.Mvc.Controllers.ActionListOption <ImlMedicineListDTO> options)
        {
            if (ApplicationId == null)
            {
                return(NotFound());
            }

            return(await base.PartialList(paramList, options));
        }
Ejemplo n.º 5
0
        // Скопировал с Common потому что кол. страниц не соответствует действительности. В коре нужно исправить
        public async Task <IActionResult> Partial <T>(IDictionary <string, string> paramList,
                                                      Core.Mvc.Controllers.ActionListOption <T> options,
                                                      Func <IDictionary <string, string>, Core.Mvc.Controllers.ActionListOption <T>, Task <IEnumerable <T> > > listFunction) where T : CoreDTO
        {
            if (options == null)
            {
                options = new Core.Mvc.Controllers.ActionListOption <T>();
            }

            ViewBag.FormparamList = string.Join("&", paramList.Select(x => string.Format("{0}={1}", x.Key, x.Value)));

            paramList = paramList
                        .Where(x => !string.IsNullOrEmpty(x.Value) &&
                               x.Key != "__RequestVerificationToken" &&
                               x.Key != "X-Requested-With" &&
                               !x.Key.StartsWith("pg_"))
                        .ToDictionary(x => x.Key, x => x.Value);

            var orderBy = options.pg_SortExpression ?? ListSortExpressionDefault;

            PagingList <T>  pagingList;
            IEnumerable <T> list;

            if (listFunction != null)
            {
                list = await listFunction(paramList, options);
            }
            else
            {
                list = await DataService.GetDtoAsync <T>(orderBy, parameters : paramList, skip : (options.pg_Page - 1) *PageRowCount.Value, take : PageRowCount.Value);
            }
            pagingList = PagingList.Create(list,
                                           PageRowCount.Value,
                                           options.pg_Page,
                                           orderBy,
                                           "Id",
                                           x => list?.Count(),
                                           options.pg_PartialViewName ?? "List",
                                           true);

            return(PartialView(options.pg_PartialViewName, pagingList));
        }
Ejemplo n.º 6
0
        public override async Task <IActionResult> List(IDictionary <string, string> paramList,
                                                        Core.Mvc.Controllers.ActionListOption <MtrAppListDTO> actionListOption)
        {
            var reasons = _dataService.GetEntity <EnumRecord>(p => p.EnumType == "DecisionReason").ToList();

            actionListOption.pg_SortExpression = !string.IsNullOrEmpty(actionListOption.pg_SortExpression)
                ? actionListOption.pg_SortExpression
                : "-ModifiedOn";
            return(await base.List(paramList, actionListOption, async (x, y) =>
            {
                var decisions = (await DataService.GetDtoAsync <MtrAppListDTO>(actionListOption.pg_SortExpression, parameters: x,
                                                                               skip: (actionListOption.pg_Page - 1) * PageRowCount.Value, take: PageRowCount.Value)).ToList();
                decisions.ForEach(decision =>
                {
                    decision.DecisionReason = decision.DecisionReason?
                                              .Split(',')
                                              .Aggregate("", (current, s) => current + (reasons.FirstOrDefault(p => p.Code == s)?.Name + ", "));
                });
                return decisions;
            }));
        }
Ejemplo n.º 7
0
 public override Task <IActionResult> List(IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <ImlLicenseRegisterListDTO> options)
 {
     // options.pg_SortExpression = options.pg_SortExpression ?? "-ModifiedOn";
     return(PartialList(paramList, options));
 }
Ejemplo n.º 8
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList,
                                                 Core.Mvc.Controllers.ActionListOption <ImlMedicineListDTO> options)
 {
     return(await Task.Run(() => NotFound()));
 }
Ejemplo n.º 9
0
        public override async Task <IActionResult> List(IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <MessageListDTO> options)
        {
            var referer = Request.Headers["Referer"].ToString();
            var type    = referer.Substring(referer.Length - 3);

            return(await Partial <MessageListDTO>(paramList, options, (dictionary, option) => DataService.GetDtoAsync <MessageListDTO>(
                                                      orderBy: options.pg_SortExpression ?? "-MessageDate",
                                                      predicate: p =>
                                                      (p.IsCreatedOnPortal == false && p.MessageStateEnum == "Project" && p.MessageHierarchyTypeEnum == "Parent") ||
                                                      (p.IsCreatedOnPortal == false || p.MessageStateEnum != "Project") &&
                                                      (p.MessageHierarchyTypeEnum == "Single" || (p.MessageHierarchyTypeEnum == "Child" && p.MessageStateEnum != "Project")) &&
                                                      (p.LicenseActivity.Contains(type)),
                                                      parameters: dictionary,
                                                      skip: (options.pg_Page - 1) * PageRowCount.Value,
                                                      take: PageRowCount.Value)));
        }
Ejemplo n.º 10
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <NotificationListDTO> options)
 {
     options.pg_SortExpression = !string.IsNullOrEmpty(options.pg_SortExpression)
         ? options.pg_SortExpression
         : "-DateOfCreate";
     return(await base.PartialList <NotificationListDTO>(paramList, options));
 }
Ejemplo n.º 11
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <MessageListDTO> options)
 {
     return(await Partial <MessageListDTO>(paramList, options, (dictionary, option) => DataService.GetDtoAsync <MessageListDTO>(
                                               orderBy: options.pg_SortExpression ?? "-CreatedOn",
                                               predicate: p => (p.IsCreatedOnPortal || p.MessageStateEnum != "Project") && (p.MessageHierarchyTypeEnum == "Single" || p.MessageHierarchyTypeEnum == "Parent"),
                                               parameters: dictionary,
                                               skip: (options.pg_Page - 1) * PageRowCount.Value,
                                               take: PageRowCount.Value)));
 }
Ejemplo n.º 12
0
 public async Task <IActionResult> PayrollRetailList(IDictionary <string, string> paramList, Core.Mvc.Controllers.ActionListOption <RegisterEDocumentListDTO> options)
 {
     return(await base.PartialList <RegisterEDocumentListDTO>(paramList, options, (dictionary, option) => DataService.GetDtoAsync <RegisterEDocumentListDTO>
                                                              (
                                                                  orderBy: options.pg_SortExpression ?? "-DateFrom",
                                                                  predicate: dto => dto.EDocumentType == "PayrollRetail",
                                                                  parameters: dictionary,
                                                                  skip: (options.pg_Page - 1) * PageRowCount.Value,
                                                                  take: PageRowCount.Value
                                                              )));
 }