Example #1
0
        /// <summary>
        /// Devuelve los datos de una opcion de menu en base a su id
        /// </summary>
        /// <param name="id">Id de la opcion</param>
        /// <returns>Json result</returns>
        public ActionResult SFpocmJ3(string sid)
        {
            CustomJSON globalResponse = new CustomJSON();
            BEMenuItem Item           = new BEMenuItem();

            string _err = string.Empty;

            if (User != null)
            {
                try
                {
                    Item = new BLMenu().Listar_byId(Convert.ToInt16(sid));
                    globalResponse.DATA = Item;
                }
                catch (Exception ex)
                {
                    globalResponse.ERR = ex.Message;
                }
            }
            else
            {
                return(RedirectToAction("Index", "Account", new { act = "timeout" }));
            }
            return(Json(globalResponse, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        /// <summary>
        /// Devuelve los datos de un elemento de menu por su Id
        /// </summary>
        /// <param name="Id">Id Item</param>
        /// <returns>BEMenuItem Items</returns>
        public BEMenuItem Listar_byId(int Id)
        {
            BEMenuItem Item = new BEMenuItem();

            try
            {
                using (SqlConnection oConexion = new SqlConnection(DBConexion))
                {
                    SqlCommand oComando = new SqlCommand(sp_listar_byId, oConexion);
                    oComando.Parameters.Add("@p_ido", SqlDbType.Int).Value = Id;
                    oComando.CommandType = CommandType.StoredProcedure;
                    oConexion.Open();

                    using (SqlDataReader dr = oComando.ExecuteReader())
                    {
                        while (dr.Read() && dr.HasRows)
                        {
                            Item.Id = DataUtil.ObjectToInt(dr["i_id"]);

                            Item.Nombre      = DataUtil.ObjectToString(dr["s_nom"]);
                            Item.Descripcion = DataUtil.ObjectToString(dr["s_des"]);

                            Item.Controlador = DataUtil.ObjectToString(dr["s_con"]);
                            Item.Metodo      = DataUtil.ObjectToString(dr["s_met"]);
                            Item.Parametro   = DataUtil.ObjectToString(dr["s_par"]);
                            Item.Url         = DataUtil.ObjectToString(dr["s_url"]);

                            Item.Icono = DataUtil.ObjectToString(dr["s_ico"]);
                            Item.Orden = DataUtil.ObjectToInt(dr["i_ord"]);

                            Item.IsPopup = new ItemGenerico
                            {
                                IntValue = DataUtil.ObjectToInt(dr["i_pop"])
                            };
                            Item.IsVisible = new ItemGenerico
                            {
                                IntValue = DataUtil.ObjectToInt(dr["i_vis"])
                            };
                            Item.IsGrupo = new ItemGenerico
                            {
                                IntValue = DataUtil.ObjectToInt(dr["i_grp"])
                            };
                            Item.Padre = new ItemGenerico
                            {
                                IntValue = DataUtil.ObjectToInt(dr["i_idp"])
                            };
                        }
                    }
                    oComando.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Item);
        }
Example #3
0
 /// <summary>
 /// Graba o actualiza los datos de un elemento de menu (opcion)
 /// </summary>
 /// <param name="model">modelo</param>
 /// <returns>ResponserData</returns>
 public ResponserData Grabar(BEMenuItem model)
 {
     try
     {
         return(DA.Grabar(model));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
        /// <summary>
        /// Graba o actualiza los datos de un elemento de menu (opcion)
        /// </summary>
        /// <param name="model">modelo</param>
        /// <returns>ResponserData</returns>
        public ResponserData Grabar(BEMenuItem model)
        {
            ResponserData Responser = new ResponserData();

            try
            {
                using (SqlConnection oConexion = new SqlConnection(DBConexion))
                {
                    SqlCommand oComando = new SqlCommand(sp_grabar, oConexion);
                    oComando.CommandType = CommandType.StoredProcedure;

                    oComando.Parameters.Add("@p_ido", SqlDbType.Int).Value          = model.Id;
                    oComando.Parameters.Add("@p_idp", SqlDbType.Int).Value          = model.Padre.Id;
                    oComando.Parameters.Add("@p_nom", SqlDbType.VarChar, 150).Value = model.Nombre;
                    oComando.Parameters.Add("@p_des", SqlDbType.VarChar, 150).Value = model.Descripcion;

                    oComando.Parameters.Add("@p_con", SqlDbType.VarChar, 80).Value  = model.Controlador;
                    oComando.Parameters.Add("@p_met", SqlDbType.VarChar, 80).Value  = model.Metodo;
                    oComando.Parameters.Add("@p_par", SqlDbType.VarChar, 30).Value  = model.Parametro;
                    oComando.Parameters.Add("@p_url", SqlDbType.VarChar, 150).Value = model.Url;

                    oComando.Parameters.Add("@p_ico", SqlDbType.VarChar, 40).Value = model.Icono;

                    oComando.Parameters.Add("@p_ipo", SqlDbType.Bit).Value = model.IsPopup.IntValue;
                    oComando.Parameters.Add("@p_ivi", SqlDbType.Bit).Value = model.IsVisible.IntValue;
                    oComando.Parameters.Add("@p_igr", SqlDbType.Bit).Value = model.IsGrupo.IntValue;

                    oComando.Parameters.Add("@p_ord", SqlDbType.Int).Value = model.Orden;

                    oComando.Parameters.Add("@p_usr", SqlDbType.VarChar, 12).Value = model.RowAudit.IUsr;
                    oComando.Parameters.Add("@p_ipc", SqlDbType.VarChar, 15).Value = model.RowAudit.IP;
                    oConexion.Open();

                    using (SqlDataReader dr = oComando.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            Responser.Mensaje    = DataUtil.ObjectToString(dr["s_msg"]);
                            Responser.Estado     = (ResponserEstado)DataUtil.ObjectToInt(dr["i_est"]);
                            Responser.TipoAlerta = (BootstrapAlertType)DataUtil.ObjectToInt(dr["i_btp"]);
                        }
                    }
                    oComando.Dispose();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Responser);
        }
Example #5
0
        /// <summary>
        /// Graba la opción de menú
        /// </summary>
        /// <returns>Json</returns>
        public ActionResult TW5UTjZN(List <string> model)
        {
            CustomJSON    globalResponse = new CustomJSON();
            ResponserData oResponse      = new ResponserData();

            if (User != null)
            {
                try
                {
                    var sid = model[0];
                    var pad = model[1];
                    var nom = model[2];
                    var des = model[3];
                    var con = model[4];
                    var met = model[5];
                    var par = model[6];
                    var url = model[7];
                    var ico = model[8];
                    var ord = model[9];
                    var pop = model[10];
                    var vis = model[11];
                    var grp = model[12];

                    var e = User;

                    BEMenuItem Item = new BEMenuItem
                    {
                        Id    = Convert.ToInt16(model[0]),
                        Padre = new ItemGenerico
                        {
                            Id = Convert.ToInt16(model[1])
                        },
                        Nombre      = model[2].Trim(),
                        Descripcion = model[3].Trim(),
                        Controlador = model[4].Trim(),
                        Metodo      = model[5].Trim(),
                        Parametro   = model[6].Trim(),
                        Url         = model[7].Trim(),
                        Icono       = model[8].Trim(),
                        Orden       = (model[9] == string.Empty) ? 0 : Convert.ToInt16(model[9]),
                        IsPopup     = new ItemGenerico
                        {
                            IntValue = Convert.ToInt16(model[10])
                        },
                        IsVisible = new ItemGenerico
                        {
                            IntValue = Convert.ToInt16(model[11])
                        },
                        IsGrupo = new ItemGenerico
                        {
                            IntValue = Convert.ToInt16(model[12])
                        },
                        RowAudit = new IRowAudit
                        {
                            IUsr = Convert.ToInt16(Peach.DecriptText(User.CID)),
                            IP   = Common.PageUtility.GetUserIpAddress()
                        }
                    };

                    oResponse           = new BLMenu().Grabar(Item);
                    globalResponse.DATA = oResponse;
                }
                catch (Exception ex)
                {
                    globalResponse.ERR = ex.Message;
                }
            }
            else
            {
                return(RedirectToAction("Index", "Account", new { act = "timeout" }));
            }
            return(Json(globalResponse, JsonRequestBehavior.AllowGet));
        }