小编Tom*_*Tom的帖子

在部分视图MVC5之间传递视图模型

我有一个主视图和两个部分视图.我需要能够使用我的第一个局部视图中的值填充viewmodel,并在单击按钮时将viewmodel传递给第二个局部视图.该按钮位于第二个局部视图中.我已经写了一个javascript函数来做这个,但是当我检查控制器方法时,viewmodel是空的.正如您在下面的屏幕截图中看到的那样,服务框是第二个局部视图

第一部分视图

在此输入图像描述

第二部分观点

@model CC.GRP.MCRequest.ViewModels.NewRequestViewModel

<div id="NewRequest">
    <h1>Services</h1>

    @using (Html.BeginForm())
    {

        @Html.LabelFor(model => model.ProjectName, htmlAttributes: new { @class = "control-label col-md-5" })
        @Html.EditorFor(model => model.ProjectName, new { htmlAttributes = new { @class = "form-control", style = "width:100%" } })

        <input type="submit" value="Save" class="btn btn-default" onclick="mapInit()" />
    }


</div>


<script type="text/javascript">

    function mapInit() {
        $.ajax({
            url: '@Url.Action("Service", "request")',
            // datatype: "json",
            data: $('form').serialize(), // update this
            type: "POST",
            // contentType: 'application/json; charset=utf-8'
        });
    }


</script>
Run Code Online (Sandbox Code Playgroud)

调节器

[HttpPost]
public PartialViewResult Service(NewRequestViewModel model) …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc-5

5
推荐指数
1
解决办法
848
查看次数

错误:分配给变量“ User ::”的值(DBNull)的类型与当前变量类型(String)不同

我正在创建一个SSIS包,并在提取数据时收到以下错误。

错误:分配给变量“ User :: dunsId”的值(DBNull)的类型与当前变量类型(字符串)不同。变量在执行期间可能不会更改类型。变量类型是严格的,但对象类型的变量除外。

dunsId在源表中是varchar(150),该表是可为空的列,并且包含Null值。我在SSIS中创建的用于映射它的变量是string类型。我基本上是试图提取他所有的记录,并将其插入到包含dunsId列的目标表中,该表为varchar(150)

这是我的插入查询

INSERT INTO Parties (companyId, dunsId, companyName, companyTypeId,companyTypeName,companyStatusTypeId,companyStatusTypeName,simpleIndustryId,simpleIndustryDescription)  
values (companyId, dunsId, companyName, companyTypeId, companyTypeName,companyStatusTypeId,companyStatusTypeName,simpleIndustryId,simpleIndustryDescription)
Run Code Online (Sandbox Code Playgroud)

参数映射 在此处输入图片说明

变数

在此处输入图片说明

设计

在此处输入图片说明

sql sql-server ssis

5
推荐指数
1
解决办法
1万
查看次数

需要验证内连接与子查询

我编写了一个与子查询相当的内连接.有人能让我知道这是否是正确的做事方式,以及它是否更有效.ON关键字的过滤方式与where子句的过滤方式相同吗?

子查询

select 
        companyId,
        fiscalYear,
        fiscalQuarter,
        periodenddate
    into #PeriodTbl
    from(   
        select
            fp.companyId,
            fp.fiscalYear,
            fp.fiscalQuarter,
            fi.periodenddate,
            ROW_NUMBER() OVER (PARTITION BY fp.companyId, fp.fiscalYear, fp.fiscalQuarter ORDER BY fi.periodEndDate DESC) rowno
        from ciqfinperiod fp 
            join ciqfininstance fi on fi.financialperiodid = fp.financialperiodid
        where fp.periodtypeid = 4
            and fi.periodenddate > @date
            and fi.latestforfinancialperiodflag = 1
            and latestfilingforinstanceflag = 1 
            and fp.companyId in (select id from #companyId)

        ) a
    where a.rowno = 1
Run Code Online (Sandbox Code Playgroud)

内部联接

select 
        companyId,
        fiscalYear,
        fiscalQuarter,
        periodenddate
    into #PeriodTbl
    from(   
        select
            fp.companyId,
            fp.fiscalYear,
            fp.fiscalQuarter,
            fi.periodenddate, …
Run Code Online (Sandbox Code Playgroud)

sql sql-server

4
推荐指数
1
解决办法
49
查看次数

使用 SSIS 发送错误电子邮件通知

我目前正在我的 SSIS 包中实现错误发送电子邮件通知。目前它有效。只是想检查一下这是否是正确的做法。 在此输入图像描述

ssis

4
推荐指数
1
解决办法
1万
查看次数

在配置文件“tsconfig.json”中找不到输入。指定的“包含”路径位于 Angular 6 中

我正在将我的 Angular 4 应用程序升级到 Angular 6 应用程序。我在构建应用程序时收到以下错误。

error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["../../node_modules/@wtw/**/*"]' and 'exclude' paths were '["**/*.sp
ec.ts","**/*.stub.ts","test/**/*.ts"]'.

Error: error TS18003: No inputs were found in config file 'tsconfig.json'. Specified 'include' paths were '["../../node_modules/@wtw/**/*"]' and 'exclude' paths were '["
**/*.spec.ts","**/*.stub.ts","test/**/*.ts"]'.
Run Code Online (Sandbox Code Playgroud)

如果我将“**/*”添加到包含中,则会出现以下错误,并且上述错误消失。

ERROR in e2e/app.e2e-spec.ts(3,1): error TS2304: Cannot find name 'describe'.
e2e/app.e2e-spec.ts(6,3): error TS2304: Cannot find name 'beforeEach'.
e2e/app.e2e-spec.ts(10,3): error TS2304: Cannot find name 'it'.
e2e/app.e2e-spec.ts(12,5): error TS2304: Cannot find name …
Run Code Online (Sandbox Code Playgroud)

angular

4
推荐指数
1
解决办法
1万
查看次数

以角度7逐列显示数据

我需要在angular 7应用程序中实现一个表,该表将按列而不是按行显示记录,如下面的屏幕快照所示。到目前为止,它一直是数据显示在网格中,但这次却有所不同。

例如,在屏幕快照Class Id的下面第一行中-值来自FundClassDetailsViewModel数组的Id字段。因此,基本上传递给组件的对象的结构是FundClassViewModel-> FundDetailsViewModel-> FundClassDetailsViewModel

FundClassDetailsViewModel包含Id,Description等

我将如何水平显示这些值

我尝试了以下建议,但看不到打印的值。循环有问题吗

在此处输入图片说明

有人可以教我一个例子吗

这里的字段如下

Class Id - TextBox
Legal Fund Class - Dropdownlist
Inception Date - Datetime picker
Invested Amount - Text box
Vehicle Type - Dropdownlist
Closure Status - Dropdownlist
Is Side Pocket - Checkbox
Is Thematic - Checkbox
Cogency Class - Dropdownlist
Run Code Online (Sandbox Code Playgroud)

列将取决于记录数,因此需要考虑分页。

这就是JSON的结构

在此处输入图片说明

实际的JSON

{"FundDetailsViewModel":[{"CogencyClasses":[{"Id":0,"FundId":0,"ShareClass":"Assign Cogency Fund First","LocalCurrency":null,"Name":"Assign Cogency Fund First "}],"FundClassDetailsViewModel":[{"Id":250033,"Description":"Class B","InvestedAmount":null,"InceptionDate":null,"LegalFundClassId":11166,"DataReference":null,"CogencyClassId":null,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":5508},{"Id":100541,"Description":"Class A","InvestedAmount":null,"InceptionDate":null,"LegalFundClassId":11167,"DataReference":null,"CogencyClassId":null,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":5508}],"PrimaryLegalFundClasses":[{"Id":5508,"Description":"Class A","ClassType":1},{"Id":5508,"Description":"Class B","ClassType":1}]},{"CogencyClasses":[{"Id":1121,"FundId":652,"ShareClass":"Class B","LocalCurrency":"USD","Name":"Class B USD"}],"FundClassDetailsViewModel":[{"Id":250028,"Description":"Class A","InvestedAmount":23732600,"InceptionDate":null,"LegalFundClassId":13713,"DataReference":null,"CogencyClassId":1121,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":237146},{"Id":250032,"Description":"Class D","InvestedAmount":null,"InceptionDate":"2014-07-31T00:00:00","LegalFundClassId":13714,"DataReference":null,"CogencyClassId":null,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":237146},{"Id":250031,"Description":"Class C","InvestedAmount":null,"InceptionDate":"2014-07-31T00:00:00","LegalFundClassId":13715,"DataReference":null,"CogencyClassId":null,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":237146},{"Id":250030,"Description":"Class B1","InvestedAmount":null,"InceptionDate":"2014-05-01T00:00:00","LegalFundClassId":13716,"DataReference":null,"CogencyClassId":null,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":237146},{"Id":250029,"Description":"Class B","InvestedAmount":119307314,"InceptionDate":null,"LegalFundClassId":13717,"DataReference":null,"CogencyClassId":null,"ClosureStatusId":null,"IsSidePocket":false,"IsThematic":false,"VehicleTypeId":null,"FundId":237146}],"PrimaryLegalFundClasses":[{"Id":237146,"Description":"Class A","ClassType":3},{"Id":237146,"Description":"Class B","ClassType":3},{"Id":237146,"Description":"Class B1","ClassType":3},{"Id":237146,"Description":"Class C","ClassType":3},{"Id":237146,"Description":"Class D","ClassType":3}]}],"VehicleTypes":[{"Spf":false,"Name":"Secondaries","SortOrder":null,"AumReadOnly":false,"PerformanceReadOnly":false,"BloombergTickerRequired":false,"ClassLevel":false,"IsCardiff":false},{"Spf":false,"Name":"Co-Investment (non-SPF)","SortOrder":1,"AumReadOnly":false,"PerformanceReadOnly":false,"BloombergTickerRequired":false,"ClassLevel":true,"IsCardiff":true},{"Spf":false,"Name":"FX …
Run Code Online (Sandbox Code Playgroud)

angular

4
推荐指数
2
解决办法
495
查看次数

为数据库分配空间时出错

我正在创建一个数据库脚本,但在执行时出现错误。我正在尝试创建一个数据库并分配空间。我哪里出错了

这是错误消息

尝试扩展物理文件“E:\MSSQL10_50.SQL2008R2\MSSQL\DATA\CoreReferenceStaging.mdf”时,MODIFY FILE 遇到操作系统错误 112(无法检索此错误的文本。原因:15105)。

USE master
GO

CREATE DATABASE CoreReferenceStaging;
GO

ALTER DATABASE [CoreReferenceStaging] 
MODIFY FILE ( NAME = N'CoreReferenceStaging', SIZE = 51200000KB , FILEGROWTH = 2560000KB )
GO

ALTER DATABASE [CoreReferenceStaging] 
MODIFY FILE ( NAME = N'CoreReferenceStaging_log', SIZE = 15360000KB , FILEGROWTH = 1024000KB )
GO
Run Code Online (Sandbox Code Playgroud)

sql-server

3
推荐指数
1
解决办法
5883
查看次数

使用ng new命令创建项目时,项目名称无效

我在本地安装了最新版本的angular-cli,并尝试使用命令ng new ETG.WEB.UI --style = scss创建一个新项目。

我收到错误消息项目名称ETG.WEB.UI无效。如果我使用命令ng new ETG --style = scss,它将成功运行

有人可以告诉我,是否真的不是按照angular-cli许可表命名约定,或者一旦创建该项目,我就将项目从ETG重命名为ETG.WEB.UI。

angular

3
推荐指数
2
解决办法
2263
查看次数

Angular 7两次调用asp.net webapi

我的angular 7应用程序出现性能问题。我正在使用angular 7作为客户端和c#。asp.net.webapi作为服务器代码。我注意到对webapi端点进行了两次调用,不确定为什么?我注意到的另一件事是,它最初显示7秒,之后显示1.7或1.8秒。为什么这样做

网络标签的屏幕截图1

在此处输入图片说明

网络标签的屏幕截图2

在此处输入图片说明

屏幕快照2中显示的图片也与第一次通话相同。我还看到了呼叫类型为xhr。这意味着什么

角组件服务调用

import { Component, OnInit, Input, ViewChild } from '@angular/core';
import { TermsService } from '../services/terms.service';
import { FundClassesComponent } from './fundClasses/fundClasses.component';
import { TermsStateService } from '../services/terms-state.service';
import { Router, ActivatedRoute } from '@angular/router';
import { FundStrategySelectorComponent } from '../directives/managerStrategySelector';
import { LegalFundClassesComponent } from './fundClasses/legalFundClasses.component';


@Component({
    selector: 'mgr-terms',
    templateUrl: 'terms.component.html'
})


export class TermsComponent implements OnInit {

    private Error: string;
    public TermDetails: any;
    private _ManagerStrategyId: number;
    FilteredClasses: any;
    OriginalList: any; …
Run Code Online (Sandbox Code Playgroud)

angular

3
推荐指数
1
解决办法
90
查看次数

不支持集合类型“Newtonsoft.Json.Linq.JObject”

我在 .netcore 3.0 中编写了一个端点来返回数据,但最终在控制器中抛出以下错误。

错误发生在线上

return Ok(cityResponses);
Run Code Online (Sandbox Code Playgroud)

我可以在执行此行之前查看数据

System.NotSupportedException: The collection type 'Newtonsoft.Json.Linq.JObject' is not supported.
   at System.Text.Json.JsonPropertyInfoNotNullable`4.GetDictionaryKeyAndValueFromGenericDictionary(WriteStackFrame& writeStackFrame, String& key, Object& value)
   at System.Text.Json.JsonPropertyInfo.GetDictionaryKeyAndValue(WriteStackFrame& writeStackFrame, String& key, Object& value)
   at System.Text.Json.JsonSerializer.HandleDictionary(JsonClassInfo elementClassInfo, JsonSerializerOptions options, Utf8JsonWriter writer, WriteStack& state)
   at System.Text.Json.JsonSerializer.Write(Utf8JsonWriter writer, Int32 originalWriterDepth, Int32 flushThreshold, JsonSerializerOptions options, WriteStack& state)
   at System.Text.Json.JsonSerializer.WriteAsyncCore(Stream utf8Json, Object value, Type inputType, JsonSerializerOptions options, CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
   at Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|21_0(ResourceInvoker invoker, IActionResult result)
Run Code Online (Sandbox Code Playgroud)

控制器

[HttpGet]
        [Route("cities")]
        public …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-web-api asp.net-core

3
推荐指数
1
解决办法
5155
查看次数