Ejemplo n.º 1
0
        public static Data.bt_ord_trabajo ConvertToBD(otModel orden)
        {
            Data.bt_ord_trabajo ot = new Data.bt_ord_trabajo();

            ot.ot_id        = orden.ot_id;
            ot.cliente_sk   = orden.cliente_sk;
            ot.tecnico_sk   = orden.tecnico_sk;
            ot.calificacion = orden.calificacion;
            ot.descripcion  = orden.descripcion;
            ot.tipo         = orden.tipo_id;

            if (orden.fh_creacion != null)
            {
                ot.fh_creacion = DateTime.ParseExact(orden.fh_creacion, "dd-MM-yyyy", null);
            }
            else
            {
                ot.fh_creacion = DateTime.Today;
            }


            if (orden.fh_cierre != null)
            {
                ot.fh_cierre = DateTime.ParseExact(orden.fh_cierre, "dd-MM-yyyy", null);
            }
            else
            {
                ot.fh_cierre = DateTime.ParseExact("31-12-2999", "dd-MM-yyyy", null);
            };


            return(ot);
        }
Ejemplo n.º 2
0
        public static otModel ConvertTo(Data.bt_ord_trabajo n, Data.lk_tipo_ot[] tipos)
        {
            otModel ot = new otModel();

            DateTime fh_cierre_d;

            if (n.fh_cierre != null)
            {
                fh_cierre_d = (DateTime)n.fh_cierre;
            }
            else
            {
                fh_cierre_d = DateTime.MaxValue;
            }

            ot.ot_id       = n.ot_id;
            ot.cliente_sk  = n.cliente_sk;
            ot.tecnico_sk  = n.tecnico_sk;
            ot.fh_creacion = n.fh_creacion.ToString("dd-MM-yyyy");
            ot.fh_cierre   = fh_cierre_d.ToString("dd-MM-yyyy");

            if (n.calificacion == null)
            {
                ot.calificacion = 0;
            }
            else
            {
                ot.calificacion = (decimal)n.calificacion;
            }


            ot.descripcion = n.descripcion;
            ot.tipo_id     = n.tipo;
            ot.tipo        = tipos[n.tipo - 1].tipo_ot_desc;

            return(ot);
        }