Example #1
0
        private Trabajo MapFichaTrabajo(TrabajoTemp ficha)
        {
            Trabajo returnedValue = new Trabajo
            {
                IdTrabajo        = ficha.IdFicha,
                IdDentista       = ficha.IdDentista,
                Paciente         = ficha.Paciente,
                Color            = ficha.Color,
                FechaTerminacion = ficha.FechaTerminacion,
                PrecioFinal      = ficha.PrecioFinal,
                FechaEntrada     = ficha.FechaEntrada,
                FechaPrevista    = ficha.FechaPrevista,
                Nombre           = ficha.Nombre,
                PrecioMetal      = ficha.PrecioMetal,
                IdTipoTrabajo    = ficha.IdTipoTrabajo
            };

            return(returnedValue);
        }
Example #2
0
        private TrabajoTemp MapFichaTrabajoAccess(FichaTrabajoAccess ficha)
        {
            // Probably using automapper would be a better idea. But this
            // implementation is good enough for this tiny case.
            TrabajoTemp returnedValue = new TrabajoTemp
            {
                IdFicha          = ficha.Id,
                Dr               = ficha.Dr,
                Paciente         = ficha.Paciente,
                Color            = ficha.Color,
                FechaTerminacion = ficha.FechaTerminacion,
                FechaEntrada     = ficha.FechaEntrada,
                FechaPrevista    = ficha.FechaPrevista,
                Nombre           = ficha.Nombre,
                PrecioMetal      = ficha.PrecioMetal,
                TipoTrabajo      = ficha.TipoTrabajo
            };

            if (ficha.PrecioFinal == null)
            {
                returnedValue.PrecioFinal = null;
            }
            else
            {
                decimal temp;
                if (decimal.TryParse(ficha.PrecioFinal, out temp))
                {
                    returnedValue.PrecioFinal = temp;
                }
                else
                {
                    throw new ApplicationException();
                }
            }

            return(returnedValue);
        }