Esempio n. 1
0
            protected internal override void Antes()
            {
                int idx = 0;
                ETAPAS oldEtapa = ctx.ETAPAS.OrderByDescending(t => t.COD_ETA).FirstOrDefault();
                if (oldEtapa != null)
                {
                    idx = int.Parse(oldEtapa.COD_ETA);
                }

                string strId = (idx + 1).ToString();
                int tam = strId.Length;
                for (decimal i = 1; i <= 2 - tam; i++)
                {
                    strId = "0" + strId;
                }
                oDto.COD_ETA = strId;

                ep = new ETAPAS();
                Mapper.Map(oDto, ep);
                ctx.ETAPAS.Add(ep);
                byaRpt.id = ep.COD_ETA.ToString();
            }
Esempio n. 2
0
 protected internal override bool esValido()
 {
     ep = ctx.ETAPAS.Where(t => t.COD_ETA == oDto.COD_ETA).FirstOrDefault();
     if (ep == null) return true;
     else
     {
         byaRpt.Error = true;
         byaRpt.Mensaje = "Ya se encuentra una etapa registrada con este codigo";
         return false;
     }
 }