Ejemplo n.º 1
0
        private void CrearTarifasBase(string empresa)
        {
            var newContext = new ContextLogin()
            {
                BaseDatos = _context.BaseDatos,
                Empresa   = empresa,
                Id        = _context.Id,
                RoleId    = _context.RoleId
            };
            var serviceTarifasDefecto = new TarifasbaseService(newContext, _db);
            var list = serviceTarifasDefecto.getAll().OfType <TarifasbaseModel>();

            var service = new TarifasService(newContext, _db);

            foreach (var item in list)
            {
                var newItem = new TarifasModel();
                newItem.Empresa     = empresa;
                newItem.Id          = item.Fktarifa;
                newItem.Descripcion = item.Descripcion;
                newItem.Tipoflujo   = item.Tipoflujo;
                newItem.Tipotarifa  = TipoTarifa.Sistema;
                service.create(newItem);
            }
        }
        public ActionResult Index(TarifasModel filtros)
        {
            var origenes = _tarifaLogic.ListarOrigen();
            var destinos = _tarifaLogic.ListarDestino();
            var model    = new TarifasModel();
            var entidad  = Mapper.Map <TarifaModels, SRV_TARIFA>(filtros.tarifa);

            model.tarifa.LIST_ORI = (from c in origenes select new SelectListItem()
            {
                Text = c.ORITAR, Value = c.ORITAR
            }).ToList <SelectListItem>();
            var lista = _tarifaLogic.ListarTarifaFiltro(entidad);

            model.tarifa.LIST_DES = (from c in destinos select new SelectListItem()
            {
                Text = c.DESTAR, Value = c.DESTAR
            }).ToList <SelectListItem>();
            model.LIST_TARIFA     = model.tarifa.castTarifaType(lista.ToList());
            return(View(model));
        }
        // GET: Tarifa
        public ActionResult Index()
        {
            var origenes           = _tarifaLogic.ListarOrigen();
            var destinos           = _tarifaLogic.ListarDestino();
            var tarifasRegistradas = _tarifaLogic.ListarTarifas();
            var model = new TarifasModel();

            model.tarifa.LIST_ORI = (from c in origenes select new SelectListItem()
            {
                Text = c.ORITAR, Value = c.ORITAR
            }).ToList <SelectListItem>();
            model.tarifa.LIST_DES = (from c in destinos select new SelectListItem()
            {
                Text = c.DESTAR, Value = c.DESTAR
            }).ToList <SelectListItem>();
            model.LIST_TARIFA     = model.tarifa.castTarifaType(tarifasRegistradas.ToList());


            return(View(model));
        }