コード例 #1
0
        public ActionResult Delete(SedesModel model)
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }
            model.sesion = sesion;

            if (!sesion.permisos.havePermission(Privileges[0].Permiso))
            {
                return(Json(new { msg = Notification.notAccess() }));
            }

            try
            {
                if (model.Delete())
                {
                    Log.write(this, "Delete", LOG.BORRADO, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Succes("Sede ELIMINADA con exito: " + model.Sede) }));
                }
                else
                {
                    Log.write(this, "Delete", LOG.ERROR, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Error("Error al Eliminar la Sede = " + model.Sede) }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { msg = Notification.Error(e.Message) }));
            }
        }
コード例 #2
0
        public ActionResult Add(SedesModel model)
        {
            if (sesion == null)
            {
                sesion = SessionDB.start(Request, Response, false, db);
            }
            model.sesion = sesion;

            if (!sesion.permisos.havePermission(Privileges[0].Permiso))
            {
                return(Json(new { msg = Notification.notAccess() }));
            }

            try
            {
                if (model.Add())
                {
                    Log.write(this, "Add", LOG.REGISTRO, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Succes("Sede agregado con exito: " + model.Sede) }));
                }
                else
                {
                    Log.write(this, "Add", LOG.ERROR, "SQL:" + model.sql, sesion);
                    return(Json(new { msg = Notification.Error(" Error al agregar:" + model.Sede) }));
                }
            }
            catch (Exception e)
            {
                return(Json(new { msg = Factory.Notification.Error(e.Message) }));
            }
        }
コード例 #3
0
        public string CreaCombo(string Sql = "", string Clave = "", string Valor = "")
        {
            string     Salida = "";
            SedesModel model  = new SedesModel();

            Salida = model.ComboSql(Sql, Clave, Valor);
            return(Salida);
        }
コード例 #4
0
 public ActionResult Edit(SedesModel model)
 {
     if (model.Edit())
     {
         return(Json(new JavaScriptSerializer().Serialize(model)));
     }
     return(View());
 }