Basit Nisar

Basit Nisar

  • 1.6k
  • 81
  • 9.1k

skip item whose date does not match

May 4 2023 8:10 AM

here is my code where i need to skip the contractinvoiceperdaysid when  if condition fails 

and that contractinvoiceperdaysid whose if condition matches shall pass through by join condition using split[,]

List<StaffCIPDApprovedPutModel> lstContractInvoicePerDays = new List<StaffCIPDApprovedPutModel>();
lstContractInvoicePerDays = staffCIPDApprovedViewModel.lstContractInvoicePerDays.ToList();
string contractInvoicePerDayIDs = string.Empty;
foreach (var Item in lstContractInvoicePerDays)
{
    //ContractInvoicePerDay contractInvoicePerDay = db.ContractInvoicePerDays.Find(Item.ContractInvoicePerDayID);
    DateTime _LastModifiedDateTC = Global.GetTimecardLastModifiedDate(Item.ContractInvoicePerDayIDs, (int)InvoiceSourceTypes.PerDay).GetValueOrDefault();
    if (Item.LastModifiedDate == _LastModifiedDateTC)
    {
        contractInvoicePerDayIDs = string.Join(",", Item.ContractInvoicePerDayIDs);
    }
}

 


Answers (2)