示例#1
0
        public async Task <IActionResult> ListMessage(Guid?msgId, Guid?orgId, string messageState, IDictionary <string, string> paramList,
                                                      ActionListOption <ImlMedicineListMsgDTO> options)
        {
            var licenseGuid = _imlLicenseService.GetLicenseGuid(orgId);
            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));
        }
示例#2
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList,
                                                 ActionListOption <ImlMedicineRegisterListDTO> options)
 {
     return(await base.PartialList(paramList, options, (dictionary, option) => DataService.GetDtoAsync <ImlMedicineRegisterListDTO>(
                                       orderBy: options.pg_SortExpression ?? "-MedicineName",
                                       parameters: dictionary,
                                       skip: (options.pg_Page - 1) * PageRowCount.Value,
                                       take: PageRowCount.Value)));
 }
示例#3
0
        public async Task <PagingList <T> > PartialList <T>(IDictionary <string, string> paramList,
                                                            ActionListOption <T> options, Func <IDictionary <string, string>, ActionListOption <T>, Task <IEnumerable <T> > > listFunction,
                                                            params object[] extraParameters) where T : CoreDTO
        {
            if (options == null)
            {
                options = new 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 _auditService.DataService.GetDtoAsync <T>(orderBy, parameters : paramList, skip : (options.pg_Page - 1) *PageRowCount.Value, take : PageRowCount.Value, extraParameters : extraParameters);
            }

            pagingList = PagingList.Create(list,
                                           PageRowCount.Value,
                                           options.pg_Page,
                                           orderBy,
                                           "Id",
                                           x => (x as IPagingCounted)?.TotalRecordCount,
                                           options.pg_PartialViewName ?? "List",
                                           true);

            return(pagingList);
        }
 public override async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <AppConclusionListDTO> options)
 {
     options.pg_SortExpression = !string.IsNullOrEmpty(options.pg_SortExpression) ? options.pg_SortExpression : "-ModifiedOn";
     return(await base.List(paramList, options));
 }
示例#5
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <ImlLicenseListDTO> options)
 {
     return(await PartialList(paramList, options));
 }
示例#6
0
        public async Task <IActionResult> AuditPropertiesList(int auditId,
                                                              IDictionary <string, string> paramList, ActionListOption <LogAuditListOfChangesDTO> options)
        {
            options.pg_PartialViewName = "_AuditProperties";

            var pagingList = await PartialList(paramList, options, async (x, y) => await _auditService.DataService.GetDtoAsync <LogAuditListOfChangesDTO>(aud => aud.AuditEntryId == auditId));

            _auditService.SetDisplayNameEntityProp(pagingList);

            var audHistory = _auditService.GeEntityHistoryById(auditId);

            #region Filter date

            var paramDate = paramList.FirstOrDefault(p => p.Key == "filterDate");
            if (!string.IsNullOrEmpty(paramDate.Value))
            {
                var filterDate = paramDate.Value.Split("||");
                if (filterDate.Length >= 1)
                {
                    if (DateTime.TryParse(filterDate[0], out var dateFrom))
                    {
                        if (dateFrom != DateTime.MinValue)
                        {
                            audHistory = audHistory.Where(p => p.CreatedDate.Date >= dateFrom.Date);
                        }
                    }
                }
                if (filterDate.Length == 2)
                {
                    if (DateTime.TryParse(filterDate[1], out var dateTo))
                    {
                        if (dateTo != DateTime.MinValue)
                        {
                            audHistory = audHistory.Where(p => p.CreatedDate.Date <= dateTo.Date);
                        }
                    }
                }
            }

            #endregion

            var audEntityHistory = audHistory.Select(p => new
            {
                Id   = p.AuditEntryId,
                Name = p.CreatedDate.ToString("dd-MM-yyyy HH:mm") + " - " + p.CreatedBy
            });
            ViewBag.listOfDate = new SelectList(audEntityHistory, "Id", "Name", auditId);

            return(PartialView(options.pg_PartialViewName, pagingList));
        }
示例#7
0
        public async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <LogAuditEntryListDTO> options)
        {
            options.pg_SortExpression = !string.IsNullOrEmpty(options.pg_SortExpression)
                ? options.pg_SortExpression
                : "-CreatedDate";

            var pagingList = await PartialList(paramList, options, null, _auditService.StrFollowTable);

            ViewBag.CreatedFrom = paramList.FirstOrDefault(p => p.Key == "CreatedDate_From").Value;
            ViewBag.CreatedTo   = paramList.FirstOrDefault(p => p.Key == "CreatedDate_To").Value;

            return(PartialView(options.pg_PartialViewName, pagingList));
        }
示例#8
0
 public override Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <TrlAppListDTO> options)
 {
     options.pg_SortExpression = options.pg_SortExpression ?? "-ModifiedOn";
     return(PartialList(paramList, options));
 }
示例#9
0
 public async Task <IActionResult> ProtocolPartialList(Guid protocolId,
                                                       IDictionary <string, string> paramList, ActionListOption <TrlAppListDTO> options)
 {
     options.pg_PartialViewName = options.pg_PartialViewName ?? "ProtocolPartialView";
     return(await Partial(paramList, options,
                          async (x, y) =>
                          await _trlApplicationService.DataService.GetDtoAsync <TrlAppListDTO>(app => app.ProtocolId == protocolId)));
 }
示例#10
0
        public override async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <FileStoreDTO> options)
        {
            var entityId   = paramList.FirstOrDefault(x => x.Key.Contains("EntityId"));
            var edocId     = _commonDataService.GetEntity <EDocument>(p => p.Id == Guid.Parse(entityId.Value)).FirstOrDefault();
            var edocEntity = _commonDataService.GetEntity <EDocument>(p => (p.EntityId == Guid.Parse(entityId.Value) ||
                                                                            p.EntityId == (edocId != null ? edocId.EntityId ?? Guid.Empty : Guid.Empty)) &&
                                                                      p.EDocumentType == "PaymentDocument").Select(p => p.Id).ToList();

            if (edocEntity.Count > 0)
            {
                var filePaymentList = _commonDataService.GetDto <FileStoreDTO>(p => edocEntity.Contains(p.EntityId), dtos => dtos.OrderByDescending(p => p.EdocumentCreatedOn));

                var pagingList = PagingList.Create(filePaymentList, PageRowCount.Value, options.pg_Page, "-EdocumentCreatedOn", "Id", x => (x as IPagingCounted)?.TotalRecordCount, "ListPayment", true);
                return(PartialView("ListPayment", pagingList));
            }

            var view = paramList.FirstOrDefault(x => x.Key.Contains("pg_PartialViewName"));

            if (!view.Equals(default(KeyValuePair <string, string>)))
            {
                options.pg_PartialViewName = paramList["amp;pg_PartialViewName"];
            }
            return(await base.List(paramList, options));
        }
示例#11
0
        public override async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <BranchRegisterListDTO> options)
        {
            ViewBag.AppType = (await DataService.GetDtoAsync <AppStateDTO>(x => x.Id == new Guid(paramList["ApplicationId"]))).Select(x => x.AppType).FirstOrDefault();;
            var orderBy = options.pg_SortExpression ?? ListSortExpressionDefault;

            return(await base.List(paramList, options, async (x, y) =>
            {
                var models = (await DataService.GetDtoAsync <BranchRegisterListDTO>(orderBy, z => z.ApplicationId == new Guid(paramList["ApplicationId"]), parameters: paramList,
                                                                                    skip: (options.pg_Page - 1) * PageRowCount.Value, take: PageRowCount.Value)).ToList();
                models.ForEach(z => z.OperationListForm = _branchService.GetOperationList(z.OperationListForm));
                return models;
            }));
        }
示例#12
0
        public override async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <ProtocolListDTO> options)
        {
            var referer = Request.Headers["Referer"].ToString();
            var type    = referer.Substring(referer.Length - 3);

            options.pg_SortExpression = !string.IsNullOrEmpty(options.pg_SortExpression)
                ? options.pg_SortExpression
                : "-ProtocolDate";

            return(await PartialList(paramList, options, (dictionary, option) => DataService.GetDtoAsync <ProtocolListDTO>(
                                         orderBy: options.pg_SortExpression ?? "-MessageDate",
                                         predicate: p => p.Type.Contains(type),
                                         parameters: dictionary,
                                         skip: (options.pg_Page - 1) * PageRowCount.Value,
                                         take: PageRowCount.Value)));
        }
示例#13
0
 public override async Task <IActionResult> List(IDictionary <string, string> paramList, ActionListOption <ApplicationListDTO> options)
 {
     if (!paramList.TryGetValue("AppStateEnum", out var val) || val != "Project")
     {
         paramList.Add("AppStateEnum", "Project");
     }
     options.pg_SortExpression = !string.IsNullOrEmpty(options.pg_SortExpression) ? options.pg_SortExpression : "-ModifiedOn";
     return(await base.List(paramList, options));
 }