示例#1
0
        public void Create(Ruta ruta)
        {
            try
            {
                var rutaDb = _crudRuta.Retrieve <Ruta>(ruta);
                if (rutaDb != null)
                {
                    throw new BusinessException(214);
                }

                if (ruta.Estado == null)
                {
                    ruta.Estado = "Activo";
                }

                ruta.Id = _crudRuta.CreateId(ruta);

                if (ruta.Id < 1)
                {
                    throw new BusinessException(215);
                }

                foreach (var horario in ruta.Horarios)
                {
                    horario.RutaId = ruta.Id;
                    _crudHorario.Create(horario);
                }
            }
            catch (Exception e)
            {
                ExceptionManager.GetInstance().Process(e);
            }
        }
示例#2
0
 public void CreateHorario(Horario horario)
 {
     try
     {
         _crudFactory.Create(horario);
     }
     catch (TRV_Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
        public void Create(HorarioViewModel h)
        {
            var horario = new Horario
            {
                id           = h.id,
                fecha        = DateTime.Parse(h.fecha + "T00:00:00"),
                tipo_horario = h.tipo_horario,
                hora_inicio  = DateTime.Parse("2020-12-12T" + h.hora_inicio + ":00"),
                hora_fin     = DateTime.Parse("2020-12-12T" + h.hora_fin + ":00"),
                id_usuario   = h.id_usuario,
                id_sucursal  = h.id_sucursal
            };

            if (horario.id_usuario == -1)
            {
                crud.Create(horario);
            }
            else
            {
                crud.CreateWithUser(horario);
            }
        }