/// <summary> /// Method to Load Kolej Entity /// </summary> /// <param name="argReader">IDataReader Object is an Input.</param> /// <returns>Returns Kolej Entity</returns> private MenuEn LoadObject(IDataReader argReader) { MenuEn loItem = new MenuEn(); loItem.MenuName = GetValue <string>(argReader, "PageName"); return(loItem); }
/// <summary> /// Method to Get Menus. /// </summary> /// <param name="argEn">Menu Entity is an Input.MenuID is an Input Property</param> /// <returns>List of Menu Entity</returns> public MenuEn GetMenus(MenuEn argEn) { MenuEn loEnList = new MenuEn(); string sqlCmd = "select PageName from UR_MenuMaster where MenuID ='" + argEn.MenuId + "'"; try { if (!FormHelp.IsBlank(sqlCmd)) { using (IDataReader loReader = _DatabaseFactory.ExecuteReader(Helper.GetDataBaseType, DataBaseConnectionString, sqlCmd).CreateDataReader()) { while (loReader.Read()) { loEnList = LoadObject(loReader); } loReader.Close(); } } } catch (Exception ex) { throw ex; } return(loEnList); }
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; } }
protected string GetMenuName(int menuId) { MenuEn menuEn = new MenuEn(); MenuBAL menuBal = new MenuBAL(); menuEn.MenuId = menuId; menuEn = menuBal.GetMenus(menuEn); return(menuEn.MenuName); }
public static void RegistrarMenu(MenuEn _menu) { try { ConsultasAd.RegistrarMenu(_menu); } catch (Exception ex) { throw ex; } }
/// <summary> /// Method to Get Menus. /// </summary> /// <param name="argEn">Menu Entity is an Input.MenuID is an Input Property</param> /// <returns>List of Menu Entity</returns> public MenuEn GetMenus(MenuEn argEn) { try { MenuDAL loDs = new MenuDAL(); return(loDs.GetMenus(argEn)); } 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); }