protected internal override void Antes() { ep = new DOC_PLANTILLA(); decimal ultId = 0; DOC_PLANTILLA oldPlantilla = ctx.DOC_PLANTILLA.OrderByDescending(t => t.ID).FirstOrDefault(); if (oldPlantilla != null) ultId = oldPlantilla.ID; ultId++; oDto.ID = ultId; string strId = oDto.ID.ToString(); int tam = strId.Length; for (decimal i = 1; i <= 6 - tam; i++) { strId = "0" + strId; } oDto.NRO_DOC = strId; Mapper.Map(oDto, ep); ep.EST_COMPLETADO = oDto.COMPLETADO; ctx.DOC_PLANTILLA.Add(ep); InsertSecciones(); byaRpt.id = ep.ID.ToString(); }
protected internal override bool esValido() { Documento = ctx.DOC_PLANTILLA.Where(t => t.ID == objCompletar.ID_DOC).FirstOrDefault(); if (Documento != null) { if (Documento.EST_COMPLETADO == "INI") return true; else { byaRpt.Error = false; byaRpt.Mensaje = "Este documento ya ha sido completado."; return false; } } else { byaRpt.Error = false; byaRpt.Mensaje = "No existe un documento con esta identificación."; return false; } }