protected void fnGeneraOpcionMenu(int idrolv, sysMenu oItemMenu) { Literal lit = new Literal(); List <sysMenu> lstMenuItem = new List <sysMenu>(); BLMenu oBLMenu = new BLMenu(); lstMenuItem = oBLMenu.ObtieneHijosPorID(1, oItemMenu.idMenu); PlaceHolder MainPlaceHolder1 = new PlaceHolder(); MainPlaceHolder1 = (PlaceHolder)this.LoginView2.Controls[0].FindControl("MainPlaceHolder"); if (oItemMenu.fcCss.Contains("parent")) { lit = new Literal(); lit.Text = oItemMenu.fcHtml; MainPlaceHolder1.Controls.Add(lit); lit = DivOpenMenu(lit, MainPlaceHolder1); } foreach (sysMenu itemMenu in lstMenuItem) { if (itemMenu.fcCss.Contains("parent")) { fnGeneraOpcionMenu(1, itemMenu); } else { lit = new Literal(); lit.Text = itemMenu.fcHtml; MainPlaceHolder1.Controls.Add(lit); } } lit = DivCloseMenu(lit, MainPlaceHolder1); return; }
public List <sysMenu> getMenuHijosRolN(string UserName, int idMenuPadre, bool EsTopMenu, string NivelRuta) { string sMensaje = string.Empty; DataSet ds = new DataSet(); Database db = EnterpriseLibraryContainer.Current.GetInstance <Database>("Inventario"); StringBuilder sqlCommand = new StringBuilder(); sqlCommand.Append("stpS_ObtieneMenuHijosN"); DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand.ToString()); dbCommand.CommandType = CommandType.StoredProcedure; db.AddInParameter(dbCommand, "@UserName", DbType.String, UserName); db.AddInParameter(dbCommand, "@idMenuPadre", DbType.Int32, idMenuPadre); db.AddInParameter(dbCommand, "@EsTopMenu", DbType.Boolean, EsTopMenu); db.AddInParameter(dbCommand, "@NivelRuta", DbType.String, NivelRuta); try { ds = db.ExecuteDataSet(dbCommand); List <sysMenu> lstMenu = new List <sysMenu>(); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { sysMenu oMenu = new sysMenu(); oMenu.idMenu = Convert.ToInt32(dr["idMenu"]); oMenu.fcMenuClave = dr["fcMenuClave"].ToString(); oMenu.fcMenuNombre = dr["fcMenuNombre"].ToString(); oMenu.fcMenuRuta = dr["fcMenuRuta"].ToString(); oMenu.idMenuPadre = Convert.ToInt32(dr["idMenuPadre"]); oMenu.fcCss = dr["fcCss"].ToString(); oMenu.Nivel = Convert.ToInt32(dr["Nivel"]); oMenu.cmenuindex = dr["cmenuindex"].ToString(); oMenu.fcHtml = dr["fcHTML"].ToString(); lstMenu.Add(oMenu); } } return(lstMenu); } catch (DataException ex) { throw ex; } }
protected void fnGeneraOpcionMenu(int idrolv, sysMenu oItemMenu, bool EsTopMenu, string NivelRuta) { Literal lit = new Literal(); List <sysMenu> lstMenuItem = new List <sysMenu>(); BLMenu oBLMenu = new BLMenu(); PlaceHolder MainPlaceHolder1 = new PlaceHolder(); if (Session["UserNameLogin"] != null && Session["UserNameLogin"].ToString() != "") { lstMenuItem = oBLMenu.ObtieneHijosPorIDN(Session["UserNameLogin"].ToString(), oItemMenu.idMenu, EsTopMenu, NivelRuta); } else { Response.Redirect("~/Forms/sessionTimeout.html", false); } MainPlaceHolder1 = (PlaceHolder)this.LoginView2.Controls[0].FindControl("MainPlaceHolder"); if (oItemMenu.fcCss.Contains("parent")) { lit = new Literal(); lit.Text = oItemMenu.fcHtml; MainPlaceHolder1.Controls.Add(lit); lit = DivOpenMenu(lit, MainPlaceHolder1); } foreach (sysMenu itemMenu in lstMenuItem) { if (itemMenu.fcCss.Contains("parent")) { fnGeneraOpcionMenu(1, itemMenu, false, NivelRuta); } else { lit = new Literal(); lit.Text = itemMenu.fcHtml; MainPlaceHolder1.Controls.Add(lit); } } lit = DivCloseMenu(lit, MainPlaceHolder1); return; }
void TreeMenu_GetSelectImage(object sender, DevExpress.XtraTreeList.GetSelectImageEventArgs e) { var drv = (sender as TreeList).GetDataRecordByNode(e.Node) as DataRowView; if (drv == null) return; var menu = new sysMenu() { DataRowView = drv }; if (menu.MenuType == 1) { e.NodeImageIndex = 2; } else if (menu.MenuType.In(2, 3)) { e.NodeImageIndex = 3; } else { e.NodeImageIndex = e.Node.Expanded ? 1 : 0; } }
private void ShowView(TreeList tree) { if (tree.FocusedNode != null) { var drv = tree.GetDataRecordByNode(tree.FocusedNode) as DataRowView; if (drv != null) { sysMenu entity = new sysMenu() { DataRowView = drv }; if (entity.MenuType == (int)sysMenuType.Menu) { ShowBusinessView(entity.DataRowView); } else if (entity.MenuType.In((int)sysMenuType.ExternalForm)) { string fileName = Path.Combine(Application.StartupPath, entity.GetFieldValue<string>("MenuFileName")); if (!File.Exists(fileName)) { MessageService.ShowErrorFormatted("菜单对应的文件名不存在.文件名称为:{0}", fileName); return; } var param = ParseFileParameter(entity.FileParameter); ProcessStartInfo startInfo = new ProcessStartInfo(fileName); startInfo.Arguments = param; var customProcess = Process.Start(startInfo); if (entity.IsShowDialog) customProcess.WaitForExit(); } } } }
void txtFind_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { if (TreeMenu.FocusedNode != null) { var drv = TreeMenu.GetDataRecordByNode(TreeMenu.FocusedNode) as DataRowView; if (drv != null) { sysMenu entity = new sysMenu() { DataRowView = drv }; if (entity.MenuType == (int)sysMenuType.Catalog) { TreeMenu.FocusedNode.Expanded = !TreeMenu.FocusedNode.Expanded; e.Handled = true; return; } } } this.ShowView(this.TreeMenu); e.Handled = true; } else if (e.KeyData == Keys.Up) { this.TreeMenu.MovePrevVisible(); e.Handled = true; } else if (e.KeyData == Keys.Down) { this.TreeMenu.MoveNextVisible(); e.Handled = true; } else if (e.KeyData == Keys.Escape) { this.txtFind.EditValue = null; } }