如何更改repository.cs中的列?

问题描述 投票:0回答:1

我通过进行一些计算来更改列表中的日期值。但我无法在列表中显示它。 当我尝试如下时,出现错误 customerId 必须是 uniqueid。如果你能帮忙我会很高兴。我正在使用旧版本的 Serenity。我正在尝试做照片中显示的事情。

这是我的存储库.cs

public ListResponse List(IDbConnection connection, ListRequest request)
{
    List<dynamic> listeResmi = new List<dynamic>();
    try
    {
        connection.Open();
        listeResmi = getAllTatilListe(connection);
    }
    finally
    {
        connection.Close();
    }

    var row = new MyRow();
    var query = new SqlQuery().From(row).SelectTableFields();

    query.CountRecords = true;
    var entities = new List<MyRow>();

    ListResponse<MyRow> listReturn = new ListResponse<MyRow>();

    var totalCount = query.ForEach(connection, () =>  
    {
        var yeniGunFarki = GetDateRestriction(Convert.ToDateTime(row.VADE),listeResmi);
        row.GECIKME = Convert.ToInt32(yeniGunFarki);
        row.MUSTERIID = row.MUSTERIID;
        entities.Add(row);
    });

    listReturn.Entities =entities;
    listReturn.Skip = 0;
    listReturn.Take = 100;
    listReturn.TotalCount = totalCount;
    return listReturn;
}

这是我的错误json。有MUSTERIID参数。

未捕获 每个数据元素必须实现唯一的“MUSTERIID”属性。索引“0”处的对象具有重复的标识值“18839376296_94d31a01-0b3b-4720-8895-13f23dc6d714”:{“InsertDate”:“2023-07-19T12:59:38.353”,“MUSTERIID”:“18839376296_94d31 a01-0b3b-4720- 8895-13f23dc6d714"}

c# json typescript slickgrid serenity
1个回答
0
投票

如果

MyRow
IRow<TFields>
,那么你的
row
对象应该有一个
CloneRow
方法:

var totalCount = query.ForEach(connection, () =>  
{
    var newRow = row.CloneRow();

    var yeniGunFarki = GetDateRestriction(Convert.ToDateTime(newRow.VADE),listeResmi);
    newRow.GECIKME = Convert.ToInt32(yeniGunFarki);
    newRow.MUSTERIID = row.MUSTERIID; // Not sure why this line is here. I assume you can remove it
    entities.Add(newRow);
});

现在

entities
将包含唯一的对象,如果每行已经有一个唯一的
MUSTERIID
,那么
entities
中的项目也应该如此。

© www.soinside.com 2019 - 2024. All rights reserved.