// GET: FUNCIONES/Edit/5
        public ActionResult Edit(decimal id)
        {
            metodo = "EDITAR";
            DatoSesion datoSesion = (DatoSesion)Session["datoSesion"];

            if (!datoSesion.RevisarPermiso(nombre, metodo))
            {
                ViewBag.funcion = datoSesion.getFuncion(nombre);
                var users = db.USUARIOS.Include(u => u.ROLES);
                return(View("Index", users.ToList()));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FUNCIONES fUNCIONES = db.FUNCIONES.Find(id);

            if (fUNCIONES == null)
            {
                return(HttpNotFound());
            }
            ViewBag.BORRAR_ID      = new SelectList(db.BORRAR, "ID", "NOMBRE", fUNCIONES.BORRAR_ID);
            ViewBag.EDITAR_ID      = new SelectList(db.EDITAR, "ID", "NOMBRE", fUNCIONES.EDITAR_ID);
            ViewBag.FORMULARIOS_ID = new SelectList(db.FORMULARIOS, "ID", "NOMBRE", fUNCIONES.FORMULARIOS_ID);
            ViewBag.LEER_ID        = new SelectList(db.LEER, "ID", "NOMBRE", fUNCIONES.LEER_ID);
            ViewBag.ROLES_ID       = new SelectList(db.ROLES, "ID", "NOMBRE", fUNCIONES.ROLES_ID);
            return(View(fUNCIONES));
        }
        public bool RevisarPermiso(string nombre, string metodo)
        {
            bool salida = true;
            FUNCIONES funcion = getFuncion(nombre);
            switch (metodo)
            {
                case "LEER":
                    if(funcion.LEER.ID != 1)
                    {
                        salida = false;
                    }
                    break;
                case "EDITAR":
                    if (funcion.EDITAR.ID != 1)
                    {
                        salida = false;
                    }
                    break;
                case "BORRAR":
                    if (funcion.BORRAR.ID != 1)
                    {
                        salida = false;
                    }
                    break;

                default:
                    break;
            }
            return salida;
        }
    private string ObtenerFunciones(string sCR)
    {
        StringBuilder strBuilder = new StringBuilder();
        int           i          = 0;

        strBuilder.Append("<table id='tblDatos' class='texto MANO' style='width: 400px;' mantenimiento='1'>");
        strBuilder.Append("<colgroup><col style='width:15px;' /><col style='width:385px;' /></colgroup>");
        strBuilder.Append("<tbody>");
        SqlDataReader dr = FUNCIONES.Catalogo(null, "", short.Parse(sCR), 2, 0);

        while (dr.Read())
        {
            strBuilder.Append("<tr id='" + dr["t356_idfuncion"].ToString() + "' style='height:20px' bd='' onclick='mm(event)' onKeyUp=\"mfa(this,'U')\">");
            strBuilder.Append("<td><img src='../../../../images/imgFN.gif'></td><td><input type='text' id='txtFun");
            strBuilder.Append(i.ToString() + "' class='txtL' style='width:380px' maxlength='40' value='");
            strBuilder.Append(dr["t356_desfuncion"].ToString() + "'></td></tr>");
            i++;
        }
        dr.Close();
        dr.Dispose();
        strBuilder.Append("</tbody>");
        strBuilder.Append("</table>");
        strTablaHtml = strBuilder.ToString();
        return("OK@#@" + strBuilder.ToString());
    }
 public static FUNCIONES FuncionSinDatos()
 {
     FUNCIONES salida = new FUNCIONES();
     salida.BORRAR_ID = 2;
     salida.EDITAR_ID = 2;
     salida.LEER_ID = 2;
     return salida;
 }
Exemple #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            FUNCIONES fUNCIONES = db.FUNCIONES.Find(id);

            db.FUNCIONES.Remove(fUNCIONES);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #6
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            FUNCIONES fUNCIONES = await db.FUNCIONES.FindAsync(id);

            db.FUNCIONES.Remove(fUNCIONES);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        // GET: FUNCIONES
        public ActionResult Index()
        {
            DatoSesion datoSesion = (DatoSesion)Session["datoSesion"];
            FUNCIONES  funcion    = datoSesion.getFuncion(nombre);

            ViewBag.funcion = funcion;
            var fUNCIONES = db.FUNCIONES.Include(f => f.BORRAR).Include(f => f.EDITAR).Include(f => f.FORMULARIOS).Include(f => f.LEER).Include(f => f.ROLES);

            return(View(fUNCIONES.ToList()));
        }
Exemple #8
0
        public async Task <ActionResult> Edit([Bind(Include = "ID_FUNCIONES,FUNCDESCRIPCION")] FUNCIONES fUNCIONES)
        {
            if (ModelState.IsValid)
            {
                db.Entry(fUNCIONES).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(fUNCIONES));
        }
        public ActionResult DeleteConfirmed(decimal id)
        {
            FUNCIONES fUNCIONES = db.FUNCIONES.Find(id);

            db.FUNCIONES.Remove(fUNCIONES);
            db.SaveChanges();
            DatoSesion datoSesion = (DatoSesion)Session["datoSesion"];

            Session["datoSesion"] = new DatoSesion(datoSesion.user.NOMBRE, datoSesion.user.PASSWORD);
            return(RedirectToAction("Index"));
        }
Exemple #10
0
 public ActionResult Edit([Bind(Include = "IDFuncion,Fecha,Disponibles,PrecioBruto,IDPeliFK,IDSalaFK")] FUNCIONES fUNCIONES)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fUNCIONES).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IDPeliFK = new SelectList(db.PELICULAS, "IDPelicula", "Titulo", fUNCIONES.IDPeliFK);
     ViewBag.IDSalaFK = new SelectList(db.SALAS, "IDSala", "Ciudad", fUNCIONES.IDSalaFK);
     return(View(fUNCIONES));
 }
Exemple #11
0
        public async Task <ActionResult> Create([Bind(Include = "ID_FUNCIONES,FUNCDESCRIPCION")] FUNCIONES fUNCIONES)
        {
            if (ModelState.IsValid)
            {
                db.FUNCIONES.Add(fUNCIONES);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(fUNCIONES));
        }
    protected string Grabar(string sCR, string strFunciones)
    {
        string sResul = "";

        try
        {
            oConn = Conexion.Abrir();
            tr    = Conexion.AbrirTransaccion(oConn);
        }
        catch (Exception ex)
        {
            sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex);
            return(sResul);
        }

        try
        {
            string[] aFun = Regex.Split(strFunciones, "///");
            foreach (string oFun in aFun)
            {
                string[] aValores = Regex.Split(oFun, "##");
                switch (aValores[0])
                {
                case "I":
                    FUNCIONES.Insert(tr, Utilidades.unescape(aValores[2]), short.Parse(sCR));
                    break;

                case "U":
                    FUNCIONES.Update(tr, int.Parse(aValores[1]), Utilidades.unescape(aValores[2]), short.Parse(sCR));
                    break;

                case "D":
                    FUNCIONES.Delete(tr, int.Parse(aValores[1]));
                    break;
                }
            }
            Conexion.CommitTransaccion(tr);
            sResul = "OK@#@";
        }
        catch (Exception ex)
        {
            Conexion.CerrarTransaccion(tr);
            sResul = "Error@#@" + Errores.mostrarError("Error al actualizar las funciones", ex);
        }
        finally
        {
            Conexion.Cerrar(oConn);
        }

        return(sResul);
    }
Exemple #13
0
        // GET: FORMULARIOS
        public ActionResult Index()
        {
            datoSesion = (DatoSesion)Session["datoSesion"];
            FUNCIONES funcion = datoSesion.getFuncion(nombre);

            /*
             * if (datoSesion == null)
             * {
             *  funcion = DatoSesion.FuncionSinDatos();
             * }
             */
            ViewBag.funcion = funcion;
            return(View(db.FORMULARIOS.ToList()));
        }
Exemple #14
0
        // GET: FUNCIONES/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FUNCIONES fUNCIONES = await db.FUNCIONES.FindAsync(id);

            if (fUNCIONES == null)
            {
                return(HttpNotFound());
            }
            return(View(fUNCIONES));
        }
Exemple #15
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FUNCIONES fUNCIONES = db.FUNCIONES.Find(id);

            if (fUNCIONES == null)
            {
                return(HttpNotFound());
            }
            return(View(fUNCIONES));
        }
 public FUNCIONES getFuncion(string nombre)
 {
     FUNCIONES salida = new FUNCIONES();
     try
     {
         salida = this.funciones.Where(x => x.FORMULARIOS.NOMBRE.ToLower() == nombre).First();
     }
     catch (Exception)
     {
         salida = new FUNCIONES();
         salida.BORRAR_ID = 2;
         salida.EDITAR_ID = 2;
         salida.LEER_ID = 2;
     }
     return salida;
 }
Exemple #17
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FUNCIONES fUNCIONES = db.FUNCIONES.Find(id);

            if (fUNCIONES == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IDPeliFK = new SelectList(db.PELICULAS, "IDPelicula", "Titulo", fUNCIONES.IDPeliFK);
            ViewBag.IDSalaFK = new SelectList(db.SALAS, "IDSala", "Ciudad", fUNCIONES.IDSalaFK);
            return(View(fUNCIONES));
        }
 public ActionResult Edit([Bind(Include = "ID,NOMBRE,DETALLLE,ROLES_ID,LEER_ID,EDITAR_ID,BORRAR_ID,FORMULARIOS_ID")] FUNCIONES fUNCIONES)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fUNCIONES).State = EntityState.Modified;
         db.SaveChanges();
         DatoSesion datoSesion = (DatoSesion)Session["datoSesion"];
         Session["datoSesion"] = new DatoSesion(datoSesion.user.NOMBRE, datoSesion.user.PASSWORD);
         return(RedirectToAction("Index"));
     }
     ViewBag.BORRAR_ID      = new SelectList(db.BORRAR, "ID", "NOMBRE", fUNCIONES.BORRAR_ID);
     ViewBag.EDITAR_ID      = new SelectList(db.EDITAR, "ID", "NOMBRE", fUNCIONES.EDITAR_ID);
     ViewBag.FORMULARIOS_ID = new SelectList(db.FORMULARIOS, "ID", "NOMBRE", fUNCIONES.FORMULARIOS_ID);
     ViewBag.LEER_ID        = new SelectList(db.LEER, "ID", "NOMBRE", fUNCIONES.LEER_ID);
     ViewBag.ROLES_ID       = new SelectList(db.ROLES, "ID", "NOMBRE", fUNCIONES.ROLES_ID);
     return(View(fUNCIONES));
 }
        public ActionResult Create([Bind(Include = "IDReserva,FecReserva,NumButaca,IDUserFK,IDFuncionFK,PrecioNeto")] RESERVA rESERVA)
        {
            FUNCIONES func = db.FUNCIONES.Find(rESERVA.IDFuncionFK);

            func.Disponibles     = (func.Disponibles - 1);
            db.Entry(func).State = EntityState.Modified;
            db.SaveChanges();

            if (ModelState.IsValid)
            {
                db.RESERVA.Add(rESERVA);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IDFuncionFK = new SelectList(db.FUNCIONES, "IDFuncion", "IDFuncion", rESERVA.IDFuncionFK);
            ViewBag.IDUserFK    = new SelectList(db.USUARIOS, "IDUsuario", "FullName", rESERVA.IDUserFK);
            return(View(rESERVA));
        }
Exemple #20
0
        public int obtenerIdUsuario()
        {
            int result = 0;

            if (isSuccess())
            {
                try
                {
                    BE_USUARIO objUsuarioBE = new BE_USUARIO();
                    objUsuarioBE = (BE_USUARIO)HttpContext.Current.Session["USUARIO"];
                    result       = Convert.ToInt32(HttpUtility.UrlEncode(FUNCIONES.DecryptTripleDES(objUsuarioBE.ID_USU_IN_CRYPT, key_crypt)));
                }
                catch (Exception ex)
                {
                    result = 0;
                }
            }

            return(result);
        }
Exemple #21
0
    private string ObtenerFunciones(string sCR)
    {
        StringBuilder strBuilder = new StringBuilder();

        strBuilder.Append("<table id='tblFun' class='texto MANO' style='width: 275px;'>");
        strBuilder.Append("<colgroup><col style='width:275px;' /></colgroup>");
        strBuilder.Append("<tbody>");
        SqlDataReader dr = FUNCIONES.Catalogo(null, "", short.Parse(sCR), 2, 0);

        while (dr.Read())
        {
            strBuilder.Append("<tr id='" + dr["t356_idfuncion"].ToString() + "' style='height:16px' onclick=\"ms(this);mostrarTecnicos(this.id);\">");
            strBuilder.Append("<td style='padding-left:5px;'>" + dr["t356_desfuncion"].ToString() + "</td></tr>");
        }
        dr.Close();
        dr.Dispose();
        strBuilder.Append("</tbody>");
        strBuilder.Append("</table>");
        strTablaHtml = strBuilder.ToString();
        return("OK@#@" + strBuilder.ToString());
    }
Exemple #22
0
        private string listaFunciones(string sCR)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<table id='tblDatos' class='texto MA' style='width: 396px;'>");
            sb.Append("<colgroup><col style='width:396px;' /></colgroup>");
            sb.Append("<tbody>");
            SqlDataReader dr = FUNCIONES.Catalogo(null, "", short.Parse(sCR), 2, 0);

            while (dr.Read())
            {
                sb.Append("<tr id='" + dr["t356_idfuncion"].ToString() + "' onclick='ms(this)' ondblclick='aceptarClick(this.rowIndex)' onmouseover=TTip(event);>");
                sb.Append("<td><span style='width:390px;' class='NBR'>" + dr["t356_desfuncion"].ToString() + "</span></td></tr>");
            }
            dr.Close();
            dr.Dispose();
            sb.Append("</tbody>");
            sb.Append("</table>");
            strTablaHtml = sb.ToString();
            return("OK@#@" + sb.ToString());
        }
        // GET: FUNCIONES/Details/5
        public ActionResult Details(decimal id)
        {
            metodo = "LEER";
            DatoSesion datoSesion = (DatoSesion)Session["datoSesion"];

            if (!datoSesion.RevisarPermiso(nombre, metodo))
            {
                ViewBag.funcion = datoSesion.getFuncion(nombre);
                var users = db.USUARIOS.Include(u => u.ROLES);
                return(View("Index", users.ToList()));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FUNCIONES fUNCIONES = db.FUNCIONES.Find(id);

            if (fUNCIONES == null)
            {
                return(HttpNotFound());
            }
            return(View(fUNCIONES));
        }
Exemple #24
0
 public static void Cargar_DatagridviewColumns(DetalleDataGridView DATAGRIDVIEW, EventHandler <DetalleDataGridViewEventArgs> METODO_AGREGAR, EventHandler <DetalleDataGridViewEventArgs> METODO_MODIFICAR)
 {
     DATAGRIDVIEW.ReadOnly              = true;
     DATAGRIDVIEW.MultiSelect           = false;
     DATAGRIDVIEW.AllowUserToAddRows    = false;
     DATAGRIDVIEW.RowHeadersVisible     = false;
     DATAGRIDVIEW.SelectionMode         = DataGridViewSelectionMode.FullRowSelect;
     DATAGRIDVIEW.AllowUserToResizeRows = false;
     DATAGRIDVIEW.Modulos = Mensajes.Modulos;
     DATAGRIDVIEW.Estilo  = Configuracion.DataGridView_Default;
     DATAGRIDVIEW.Cargar_Columnas(new DataGridViewColumn[]
     {
         FUNCIONES.Generar_DataGridViewTextBoxColumn("Nombre", new Propiedades_Columnas()
         {
             Ancho = 250
         }, Configuracion.Columna_No_Editable),
         FUNCIONES.Generar_DataGridViewTextBoxColumn("Dirección", new Propiedades_Columnas()
         {
             Ancho = 120
         }, Configuracion.Columna_No_Editable),
         FUNCIONES.Generar_DataGridViewTextBoxColumn("Puerto", new Propiedades_Columnas()
         {
             Ancho = 80
         }, Configuracion.Columna_No_Editable),
         FUNCIONES.Generar_DataGridViewTextBoxColumn("Estado", new Propiedades_Columnas()
         {
             Ancho = 130
         }, Configuracion.Columna_No_Editable)
     });
     DATAGRIDVIEW.Plantilla = new Modulo_Dispositivo("", "192.168.0.0");
     DATAGRIDVIEW.Titulo    = "Lista de Dispositivos";
     DATAGRIDVIEW.Todos     = "Todos los Dispositivos";
     DATAGRIDVIEW.Doble_Click_Celda_ReadOnly += METODO_MODIFICAR;
     DATAGRIDVIEW.Pre_Agregar_Detalle        += METODO_AGREGAR;
     DATAGRIDVIEW.Pre_Modificar_Detalle      += METODO_MODIFICAR;
 }