I have a Linq that displays data listed according to the required filters (date and unit) by the user and another filter to validate a code with another table (which are not the case). I would like to know how I can from a "reconcile" button, change the status (NFBP_STA_LANCTO) of all items listed in this table.
int _idUnidade = int.Parse(cboUnidade.SelectedValue);
DateTime _dtCred = DateTime.Parse(txtCred.Text, new CultureInfo("pt-br"));
using (NFSeDataContext context = new NFSeDataContext(ConnNFSe))
{
context.Connection.Open();
var _s = (from p in context.NFS_Parcelas
join q in context.NFBP_CONCILIACAO_BRASPAGs on p.NFPA_NR_PARCELA equals q.NFBP_NR_PARCELA
where
_idUnidade == p.NFPA_CD_UNIDADE
&& _dtCred == p.NFPA_DT_MOVIMENTO
&& SqlMethods.Like(p.NFPA_TX_COMPLEMENTO, "%" + q.NFBP_TID + "%")
orderby p.NFPA_NR_PARCELA
select new
{
q.NFBP_STA_LANCTO,
p.NFPA_CD_UNIDADE,
p.NFPA_DT_MOVIMENTO,
q.NFBP_COD_AUTORIZACAO,
q.NFBP_TID,
q.NFBP_VL_BRUTO_TRANSACAO,
q.NFBP_VL_LIQUIDO_TRANSACAO,
p.NFPA_NR_PARCELA,
q.NFBP_BANDEIRA
}).ToList();
context.Connection.Close();
grvConciliacaoBraspag.DataSource = _s;
grvConciliacaoBraspag.DataBind();
Image to make the front-end as clear as possible: