public List <ProvCapDA> Get_provinciaCapital()
 {
     using (DataAccess.ACMEEntities db = new ACMEEntities())
     {
         return(Mapper.MapperProvinciaCapital.MapEntityToProvCapDA(db.ProvCap.ToList()));
     }
 }
        public bool Get(string fecha, int id, out List <Empresa> lstEmpresa, out Error.Error err)
        {
            Error.Error    error = new Error.Error();
            List <Empresa> lst   = new List <Empresa>();

            try
            {
                using (DataAccess.ACMEEntities db = new ACMEEntities())
                {
                    if (fecha.Equals(string.Empty))
                    {
                        lst = Mapper.MapperEmpresa.MapEntityToEmpresa_tolist(db.Empresas.Where(x => x.id_ProvCap == id).ToList());
                    }
                    else
                    {
                        lst = Mapper.MapperEmpresa.MapEntityToEmpresa_tolist(db.Empresas.Where(x => x.FechaAltaEmpresa == fecha).ToList());
                    }
                }
                error.ok      = true;
                error.mensaje = "Exito al obtener empresas";
            }
            catch (Exception e)
            {
                error.ok      = false;
                error.mensaje = "error al obtener datos" + e.Message;
            }
            err        = error;
            lstEmpresa = lst;
            return(error.ok);
        }
Exemple #3
0
        // GET: Home
        public ActionResult Index()
        {
            var context  = new ACMEEntities();
            var products = context.Products.ToList();

            return(View(products));
        }
 public Empresa GetOne(int id)
 {
     using (DataAccess.ACMEEntities db = new ACMEEntities())
     {
         Empresas empEntity = db.Empresas.ToList().Where(x => x.id_Empresa == id).FirstOrDefault();
         Empresa  empDA     = new Empresa();
         empDA.Nombre    = empEntity.Nombre;
         empDA.Desc      = empEntity.Descripcion;
         empDA.id        = empEntity.id_Empresa;
         empDA.idProvCap = empEntity.id_ProvCap;
         empDA.fecha     = empEntity.FechaAltaEmpresa;
         return(empDA);
     }
 }
 public bool Update(Empresa emp, out Error.Error err)
 {
     Error.Error error = new Error.Error();
     try
     {
         using (DataAccess.ACMEEntities db = new ACMEEntities())
         {
             Empresas objEmpresa = Mapper.MapperEmpresa.MapSingleEmpresaToEntity(emp);
             db.Entry(objEmpresa).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
         }
         error.mensaje = "Edición realizada con exito.";
         error.ok      = true;
     }
     catch (Exception e)
     {
         error.ok      = false;
         error.mensaje = "error al editar empresa " + e.Message;
     }
     err = error;
     return(err.ok);
 }
 public bool Save(List <Empresa> lst, out Error.Error err)
 {
     Error.Error error = new Error.Error();
     try
     {
         using (DataAccess.ACMEEntities db = new ACMEEntities())
         {
             List <Empresas> em = Mapper.MapperEmpresa.MapEmpresaToEntity_tolist(lst);
             db.Empresas.Add(em[0]);
             db.SaveChanges();
         }
         error.mensaje = "Empresa añadida con exito";
         error.ok      = true;
     }
     catch (Exception e)
     {
         error.ok      = false;
         error.mensaje = "Error al añadir empresa" + e.Message;
     }
     err = error;
     return(error.ok);
 }
Exemple #7
0
 public bool save(FechasBOE fecha, out Error.Error err)
 {
     Error.Error error = new Error.Error();
     try
     {
         using (DataAccess.ACMEEntities db = new ACMEEntities())
         {
             FechasDescargaBOE ent = Mapper.MapperFecha.MapFechaDATOEntity(fecha);
             db.FechasDescargaBOE.Add(ent);
             db.SaveChanges();
         }
         error.ok      = true;
         error.mensaje = "fecha añadida con exito";
     }
     catch (Exception e)
     {
         error.ok      = false;
         error.mensaje = "Error al añadir fecha";
         Console.WriteLine(e.Message);
     }
     err = error;
     return(error.ok);
 }
Exemple #8
0
        public bool GetListadoFechas(out List <FechasBOE> lst, out Error.Error err)
        {
            Error.Error      error     = new Error.Error();
            List <FechasBOE> lstResult = new List <FechasBOE>();

            try
            {
                using (DataAccess.ACMEEntities db = new ACMEEntities())
                {
                    lstResult = Mapper.MapperFecha.MapFechaEntityToDA_tolist(db.FechasDescargaBOE.ToList());
                }
                error.mensaje = "Fechas obtenidas con exito";
                error.ok      = true;
            }
            catch (Exception e)
            {
                error.mensaje = "Error al obtener las fechas de descarga del BOE" + e.Message;
                error.ok      = false;
            }
            err = error;
            lst = lstResult;
            return(err.ok);
        }
Exemple #9
0
 protected void loadItem(DropDownList box, String key)
 {
     if (key.Equals("Llamada"))
     {
         using (ACMEEntities ACME = new ACMEEntities())
         {
             var data = from d in ACME.LLAMADASGETALL1()
                        orderby d.ID_LLAMADA
                        select new
             {
                 id_Llamada = d.ID_LLAMADA
             };
             box.DataTextField  = "id_Llamada";
             box.DataValueField = "id_Llamada";
             box.DataSource     = data;
             box.DataBind();
         }
     }
     else if (key.Equals("Cliente"))
     {
         using (ACMEEntities ACME = new ACMEEntities())
         {
             var data = from d in ACME.GET_ID_CLIENTE1()
                        orderby d.ID_CLIENTE
                        select new
             {
                 id_Cliente = d.ID_CLIENTE
             };
             box.DataTextField  = "id_Cliente";
             box.DataValueField = "id_Cliente";
             box.DataSource     = data;
             box.DataBind();
         }
     }
     else if (key.Equals("Empleado"))
     {
         using (ACMEEntities ACME = new ACMEEntities())
         {
             var data = from d in ACME.GET_ID_EMPLEADO1()
                        orderby d.ID_EMPLEADO
                        select new
             {
                 id_Empleado = d.ID_EMPLEADO
             };
             box.DataTextField  = "id_Empleado";
             box.DataValueField = "id_Empleado";
             box.DataSource     = data;
             box.DataBind();
         }
     }
     else if (key.Equals("Producto"))
     {
         using (ACMEEntities ACME = new ACMEEntities())
         {
             var data = from d in ACME.GET_ID_PRODUCTO()
                        orderby d.ID_PRODUCTO
                        select new
             {
                 id_Producto = d.ID_PRODUCTO
             };
             box.DataTextField  = "id_Producto";
             box.DataValueField = "id_Producto";
             box.DataSource     = data;
             box.DataBind();
         }
     }
     else if (key.Equals("Problema"))
     {
         using (ACMEEntities ACME = new ACMEEntities())
         {
             var data = from d in ACME.GET_ID_PROBLEMA()
                        orderby d.ID_PROBLEMA
                        select new
             {
                 id_Problema = d.ID_PROBLEMA
             };
             box.DataTextField  = "id_Problema";
             box.DataValueField = "id_Problema";
             box.DataSource     = data;
             box.DataBind();
         }
     }
     else if (key.Equals("Solucion"))
     {
         using (ACMEEntities ACME = new ACMEEntities())
         {
             var data = from d in ACME.GET_ID_SOLUCION()
                        orderby d.ID_SOLUCION
                        select new
             {
                 id_Solucion = d.ID_SOLUCION
             };
             box.DataTextField  = "id_Solucion";
             box.DataValueField = "id_Solucion";
             box.DataSource     = data;
             box.DataBind();
         }
     }
 }