public frmEnviaLotes(List<belPesquisaNotas> lNotas) { InitializeComponent(); lDadosRetorno = new List<belBusRetFazenda.DadosRetorno>(); lotesSep = lNotas .Select((x, i) => new { Index = i, Value = x }) .GroupBy(x => x.Index / 50) .Select(x => x.Select(v => v.Value).ToList()) .ToList(); lLotes = new List<lotes>(); lotes objLote = null; for (int i = 0; i < lotesSep.Count; i++) { objLote = new lotes(); objLote.iLote = i + 1; objLote.xStatus = "Aguardando ..."; objLote.objDados = new belCarregaDados(lotesSep[i]); objLote.lNotasPesquisa = lotesSep[i]; lLotes.Add(objLote); } bsLotes.DataSource = lLotes; }
public frmEnviaLotes(List <belPesquisaNotas> lNotas) { InitializeComponent(); lDadosRetorno = new List <belBusRetFazenda.DadosRetorno>(); lotesSep = lNotas .Select((x, i) => new { Index = i, Value = x }) .GroupBy(x => x.Index / 50) .Select(x => x.Select(v => v.Value).ToList()) .ToList(); lLotes = new List <lotes>(); lotes objLote = null; for (int i = 0; i < lotesSep.Count; i++) { objLote = new lotes(); objLote.iLote = i + 1; objLote.xStatus = "Aguardando ..."; objLote.objDados = new belCarregaDados(lotesSep[i]); objLote.lNotasPesquisa = lotesSep[i]; lLotes.Add(objLote); } bsLotes.DataSource = lLotes; }
public ActionResult DeleteConfirmed(int id) { lotes lotes = db.lotes.Find(id); db.lotes.Remove(lotes); db.SaveChanges(); return(RedirectToAction("Lotes")); }
public ActionResult Edit([Bind(Include = "id_Lote,codigo,nombre,extension,id_Finca,prioridad,descripcion")] lotes lotes) { if (ModelState.IsValid) { db.Entry(lotes).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Lotes")); } ViewBag.id_Finca = new SelectList(db.finca, "id_Finca", "nombre", lotes.id_Finca); return(View(lotes)); }
// GET: lotes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } lotes lotes = db.lotes.Find(id); if (lotes == null) { return(HttpNotFound()); } return(View(lotes)); }
// GET: lotes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } lotes lotes = db.lotes.Find(id); if (lotes == null) { return(HttpNotFound()); } ViewBag.id_Finca = new SelectList(db.finca, "id_Finca", "nombre", lotes.id_Finca); return(View(lotes)); }
private void TransmiteLote(object l) { try { lotes lote = l as lotes; try { lote.objDados.objbelCriaXml.GeraLoteXmlEnvio(); lote.objDados.objbelRecepcao.TransmitirLote(lote.objDados.objbelCriaXml.sPathLote, lote.lNotasPesquisa); belBusRetFazenda objbelRetFazenda = new belBusRetFazenda(lote.lNotasPesquisa); objbelRetFazenda.BuscaRetorno(); lote.xStatus = belTrataMensagemNFe.RetornaMensagem(objbelRetFazenda.lDadosRetorno, belTrataMensagemNFe.Tipo.Envio); lDadosRetorno.AddRange(objbelRetFazenda.lDadosRetorno); iTentativas = 0; } catch (Exception ex) { if (ex.Message.Contains("A conexão subjacente") && iTentativas < 4) { iTentativas++; TransmiteLote(lote); } else { lote.xStatus = "Problema com o lote, Verifique a informação abaixo:" + Environment.NewLine + ex.Message; iTentativas = 0; } } this.Invoke(new MethodInvoker(delegate() { dgvLotes.Refresh(); txtInfoLote.Text = lote.xStatus; })); } catch (Exception ex) { throw ex; } }