public static void RegistrarMenu(MenuEn _menu) { try { ConsultasAd.RegistrarMenu(_menu); } catch (Exception ex) { throw ex; } }
public Rol_X_Menu() { rol = new RolEn(); menu = new MenuEn(); }
public static void RegistrarMenu(MenuEn _menu) { try { using (SqlConnection con = DataBaseManager.OpenSqlDatabase(user, pass, servidor, baseDatos)) { using (SqlCommand command = con.CreateCommand()) { command.CommandText = "PA_MENU"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@ID_MENU", _menu.Id_menu); command.Parameters.AddWithValue("@COD_OBJETO", _menu.Cod_objeto); command.Parameters.AddWithValue("@DESC_MENU", _menu.Desc_menu); command.ExecuteNonQuery(); } } } catch (Exception ex) { throw ex; } }
public static List<MenuEn> ConsultaMenu(UsuariosEn _usuario) { List<MenuEn> response = new List<MenuEn>(); try { using (SqlConnection con = DataBaseManager.OpenSqlDatabase(user, pass, servidor, baseDatos)) { using (SqlCommand command = con.CreateCommand()) { command.CommandText = "sp_consulta_menuxuser"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@p_username", _usuario.User_name); using (SqlDataReader dr = command.ExecuteReader()) { while (dr.Read()) { MenuEn tmp = new MenuEn(); tmp.Cod_objeto = dr["cod_objeto"].ToString() ?? string.Empty; tmp.Id_menu = dr["id_menu"] != DBNull.Value ?Convert.ToInt32(dr["id_menu"]) : 0; response.Add(tmp); } } } } } catch (Exception ex) { throw ex; } return response; }