public ActionResult Create(ENTIDADES.TipoGestion collection)
        {
            var mensajes = new List <KeyValuePair <string, string> >();

            try
            {
                // TODO: Add insert logic here
                var nun = lg.ListAll().Max(x => x.tipoGestionID) + 1;
                collection.tipoGestionID = nun;
                var sw = lg.add(collection);
                if (sw)
                {
                    mensajes.Add(Util.mensaje(Util.OK, Util.OKMENSAJE));
                }
                else
                {
                    mensajes.Add(Util.mensaje(Util.ERROR, Util.ERRORMENSAJE));
                }
                return(Json(mensajes));
            }
            catch (Exception ex)
            {
                mensajes.Clear();
                mensajes.Add(Util.mensaje(Util.ERROR, ex.Message));
                return(Json(mensajes));
            }
        }
Example #2
0
 public DATA.USER.TipoGestion toTipoGestion(ENTIDADES.TipoGestion o)
 {
     return(new DATA.USER.TipoGestion()
     {
         tipoGestionID = o.tipoGestionID,
         Nombre = o.Nombre
     });
 }
Example #3
0
 public bool add(ENTIDADES.TipoGestion o)
 {
     try
     {
         using (var db = new DATA.USER.COBRANZA_CBEntities())
         {
             db.TipoGestions.Add(toTipoGestion(o));
             db.SaveChanges();
             return(true);
         }
     }
     catch (System.Exception ex)
     {
         throw new Exception("Logica add", ex);
     }
 }
        public ActionResult Edit(ENTIDADES.TipoGestion collection)
        {
            var mensajes = new List <KeyValuePair <string, string> >();

            try
            {
                var sw = lg.update(collection);
                if (sw)
                {
                    mensajes.Add(Util.mensaje(Util.OK, Util.OKMENSAJE));
                }
                else
                {
                    mensajes.Add(Util.mensaje(Util.ERROR, Util.ERRORMENSAJE));
                }
                return(Json(mensajes));
            }
            catch (Exception ex)
            {
                mensajes.Clear();
                mensajes.Add(Util.mensaje(Util.ERROR, ex.Message));
                return(Json(mensajes));
            }
        }
Example #5
0
 public bool delete(ENTIDADES.TipoGestion o)
 {
     try
     {
         using (var db = new DATA.USER.COBRANZA_CBEntities())
         {
             var dr = db.TipoGestions.Where(x => x.tipoGestionID == o.tipoGestionID).FirstOrDefault();
             if (dr != null)
             {
                 db.TipoGestions.Remove(dr);
                 db.SaveChanges();
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }
     catch (System.Exception ex)
     {
         throw new Exception("Logica delete", ex);
     }
 }
        // GET: CompromisoPago/Create
        public ActionResult Create()
        {
            var obj = new ENTIDADES.TipoGestion();

            return(PartialView("_Create", obj));
        }