Ejemplo n.º 1
0
        public static System.Web.WebPages.HelperResult RequestTypeName(RequestListModel model, RequestListRowModel r)
        {
            return(new System.Web.WebPages.HelperResult(__razor_helper_writer => {
#line 33 "..\..\App_Code\RequestHelpers.cshtml"

                Lpp.Dns.Portal.PluginRequestType rt = model.AllRequestTypes[r.Request.RequestTypeID];
                string name = rt.RequestType.Name;

#line default
#line hidden

                WriteLiteralTo(@__razor_helper_writer, "    <span title=\"");



#line 36 "..\..\App_Code\RequestHelpers.cshtml"
                WriteTo(@__razor_helper_writer, name ?? "");

#line default
#line hidden

                WriteLiteralTo(@__razor_helper_writer, "\">");



#line 36 "..\..\App_Code\RequestHelpers.cshtml"
                WriteTo(@__razor_helper_writer, string.IsNullOrEmpty(name) ? "(unknown)" : name);

#line default
#line hidden

                WriteLiteralTo(@__razor_helper_writer, "</span>\r\n");



#line 37 "..\..\App_Code\RequestHelpers.cshtml"

#line default
#line hidden
            }));
        }
Ejemplo n.º 2
0
        public RequestContext(RequestService srv, Request req, PluginRequestType rt, bool isNew = false)
        {
            _service = srv;
            _request = req;
            _rtype   = rt;
            _isNew   = isNew;

            _dataMarts = _service.GetGrantedDataMarts(req.Project, _rtype);

            var allMetadataRequests = Model.Requests.Where(r => r.IsMetadataRequest).Select(r => r.ID).ToArray();

            _dnsDataMarts = _dataMarts.ToArray().Select(m => new DnsDataMart
            {
                ID                = m.ID,
                Name              = m.Name,
                Organization      = m.Organization.Name,
                MetadataDocuments = EnumerableEx.Defer(() =>
                {
                    var lastMetadataResponse = (
                        from rsp in _service.DataContext.RequestDataMarts
                        from i in rsp.Responses
                        where rsp.Request.SubmittedOn.HasValue && rsp.DataMartID == m.ID && allMetadataRequests.Contains(rsp.Request.RequestTypeID)
                        orderby rsp.Request.SubmittedOn
                        select i
                        ).FirstOrDefault();

                    return(lastMetadataResponse == null ? Enumerable.Empty <Document>() : _service.DataContext.Documents.Where(d => d.ItemID == lastMetadataResponse.ID).ToList());
                })
            })
                            .Cast <IDnsDataMart>()
                            .ToList();

            _activities = _service.DataContext.Activities.Select(a => new DnsActivity {
                ID = a.ID, Name = a.Name
            }).ToList();

            Reset();
        }