コード例 #1
0
        public void Edit(EntReferencia referencia)
        {
            int filasAfectadas = data.Edit(referencia.Id, referencia.Dato, referencia.TipoId, referencia.ContactoId);

            if (filasAfectadas != 1)
            {
                throw new ApplicationException("Error al Editar Referencia");
            }
        }
コード例 #2
0
        public void Create(EntReferencia referencia, int IdContacto)
        {
            int filasAfectadas = data.Create(referencia.Dato, referencia.TipoId, IdContacto);

            if (filasAfectadas != 1)
            {
                throw new ApplicationException("Error al Crear Referencia");
            }
        }
コード例 #3
0
        public void Delete(EntReferencia referencia)
        {
            int filasAfectadas = data.Delete(referencia.Id);

            if (filasAfectadas != 1)
            {
                throw new ApplicationException("Error al Borrar Referencia");
            }
        }
コード例 #4
0
 public ActionResult DeleteR(EntReferencia referencia)
 {
     try
     {
         comandoR.Delete(referencia);
         TempData["resultado"] = $"Registro Eliminidao";
         return(RedirectToAction("Datos"));
     }
     catch (Exception error)
     {
         TempData["error"] = error.Message;
         EntReferencia r = comandoR.Obtener(referencia.Id);
         return(View("DeleteR", r));
     }
 }
コード例 #5
0
        public ActionResult DeleteR(int id)
        {
            EntReferencia referencia = new EntReferencia();

            try
            {
                referencia = comandoR.Obtener(id);
                return(View(referencia));
            }
            catch (Exception error)
            {
                TempData["error"] = error.Message;
                return(RedirectToAction("Datos"));
            }
        }
コード例 #6
0
 public ActionResult EditR(EntReferencia referencia)
 {
     try
     {
         comandoR.Edit(referencia);
         TempData["resultado"] = $"Se edito correctamente la Referencia";
         return(RedirectToAction("Datos"));
     }
     catch (Exception error)
     {
         TempData["error"] = error.Message;
         List <EntTipo> ls = comandoT.Obtener();
         ViewBag.TipoId = new SelectList(ls, "Id", "Nombre", referencia.TipoId);
         return(View("EditR", referencia));
     }
 }
コード例 #7
0
        public ActionResult EditR(int id)
        {
            EntReferencia referencia = new EntReferencia();

            try
            {
                referencia = comandoR.Obtener(id);
                List <EntTipo> ls = comandoT.Obtener();
                ViewBag.TipoId = new SelectList(ls, "Id", "Nombre", referencia.TipoId);
                return(View(referencia));
            }
            catch (Exception error)
            {
                TempData["error"] = error.Message;
                return(RedirectToAction("Datos"));
            }
        }
コード例 #8
0
        public EntReferencia Obtener(int id)
        {
            EntReferencia r    = new EntReferencia();
            DataRow       fila = data.Obtener(id);

            r.Id         = Convert.ToInt32(fila["Id"]);
            r.TipoId     = Convert.ToInt32(fila["TipoId"]);
            r.ContactoId = Convert.ToInt32(fila["ContactoId"]);
            r.Dato       = fila["Dato"].ToString();
            EntTipo t = new EntTipo();

            t.Id     = Convert.ToInt32(fila["IdTipo"]);
            t.Nombre = fila["Nombre"].ToString();
            t.Estado = Convert.ToBoolean(fila["Estado"]);
            r.Tipo   = t;

            return(r);
        }
コード例 #9
0
 public ActionResult CreateR(EntReferencia referencia)
 {
     try
     {
         EntContacto c = (EntContacto)Session["contacto"];
         comandoR.Create(referencia, c.Id);
         TempData["resultado"] = $"Se Agrego Correctamente La referencia";
         Session["contacto"]   = null;
         return(RedirectToAction("Datos"));
     }
     catch (Exception error)
     {
         TempData["error"] = error.Message;
         List <EntTipo> Tipo = comandoT.Obtener();
         ViewBag.TipoId = new SelectList(Tipo, "Id", "Nombre");
         return(View("CreateR", referencia));
     }
 }
コード例 #10
0
        public EntDatosContacto Obtener(int Id)
        {
            EntDatosContacto Datos = new EntDatosContacto();

            EntContacto contacto = new EntContacto();
            DataRow     fila     = dataC.Obtener(Id);

            contacto.Id         = Convert.ToInt32(fila["Id"]);
            contacto.Nombre     = fila["Nombre"].ToString();
            contacto.Paterno    = fila["Paterno"].ToString();
            contacto.Materno    = fila["Materno"].ToString();
            contacto.Edad       = Convert.ToInt32(fila["Edad"]);
            contacto.Nacimiento = Convert.ToDateTime(fila["Nacimiento"]);
            contacto.NomFoto    = fila["NomFoto"].ToString();
            contacto.UserId     = Convert.ToInt32(fila["UserId"]);
            contacto.Cumpleaños = FelizCumpleaños(contacto.Nombre);
            Datos.Contacto      = contacto;

            List <EntReferencia> ls  = new List <EntReferencia>();
            DataTable            tab = new DataTable();

            tab = dataR.ObtenerPorContacto(Id);
            foreach (DataRow fil in tab.Rows)
            {
                EntReferencia r = new EntReferencia();
                r.Id         = Convert.ToInt32(fil["Id"]);
                r.TipoId     = Convert.ToInt32(fil["TipoId"]);
                r.ContactoId = Convert.ToInt32(fil["ContactoId"]);
                r.Dato       = fil["Dato"].ToString();

                EntTipo t = new EntTipo();
                t.Id     = Convert.ToInt32(fil["IdTipo"]);
                t.Nombre = fil["Nombre"].ToString();
                t.Estado = Convert.ToBoolean(fil["Estado"]);
                r.Tipo   = t;
                ls.Add(r);
            }

            Datos.Referencias = ls;
            return(Datos);
        }
コード例 #11
0
        public List <EntReferencia> ObtenerPorContacto(int Id)
        {
            List <EntReferencia> ls    = new List <EntReferencia>();
            DataTable            tabla = new DataTable();

            tabla = data.ObtenerPorContacto(Id);
            foreach (DataRow fila in tabla.Rows)
            {
                EntReferencia r = new EntReferencia();
                r.Id         = Convert.ToInt32(fila["Id"]);
                r.TipoId     = Convert.ToInt32(fila["TipoId"]);
                r.ContactoId = Convert.ToInt32(fila["ContactoId"]);
                r.Dato       = fila["Dato"].ToString();

                EntTipo t = new EntTipo();
                t.Id     = Convert.ToInt32(fila["IdTipo"]);
                t.Nombre = fila["Nombre"].ToString();
                t.Estado = Convert.ToBoolean(fila["Estado"]);
                r.Tipo   = t;

                ls.Add(r);
            }
            return(ls);
        }