protected void CargaMenuTemp(IList<co_ca_menu> listMenu) { try { foreach (co_ca_menu menu in listMenu.Where(menu => menu.id_menupadre != 0)) { MenuItem hijo = new MenuItem(); hijo.ID = "MH_" + menu.men_nombreventana; hijo.IconCls = "#Application"; hijo.Text = menu.men_nombre; hijo.DestroyMenu = false; Parameter titulo = new Parameter("title", menu.men_nombre); string strurl = Constants.Load<String>(menu.men_opciones) + menu.men_url + "?k=" + menu.id_menu + "&u=" + FWPConfiguration.get_ID_User(Session.SessionID); strurl = strurl + "&z=" + FWPConfiguration.get_Accesos(Session.SessionID); Parameter url = new Parameter("url", strurl); Parameter id = new Parameter("id", menu.men_nombreventana); Parameter icono = new Parameter("icono", "#Application"); hijo.DirectEvents.Click.Event += Button_WindowDesktop; hijo.DirectEvents.Click.ExtraParams.Add(url); hijo.DirectEvents.Click.ExtraParams.Add(titulo); hijo.DirectEvents.Click.ExtraParams.Add(icono); hijo.DirectEvents.Click.ExtraParams.Add(id); dskPrincipal.StartMenu.MenuItems.Add(hijo); } } catch (Exception ex) { Mensajes.Error(ex.Message); } }
private void InitTreePanel(TreePanel treePanel, TreeStore treeStore, Model model) { treePanel.RootVisible = false; treePanel.AutoDataBind = true; Ext.Net.Parameter parameters = new Ext.Net.Parameter { Name = "id", Value = "record.data.id", Mode = ParameterMode.Raw }; treePanel.DirectEvents.ItemDblClick.ExtraParams.Add(parameters); treePanel.DirectEvents.ItemDblClick.EventMask.ShowMask = true; treePanel.DirectEvents.ItemDblClick.EventMask.Msg = "正在添加"; treeStore.AutoDataBind = true; treeStore.AutoLoad = true; model.Fields.Add(new ModelField("Id", ModelFieldType.Int)); model.Fields.Add(new ModelField("Name", ModelFieldType.String)); treeStore.Model.Add(model); treeStore.Proxy.Add(new PageProxy()); treePanel.Store.Add(treeStore); Ext.Net.Node item = new Ext.Net.Node { NodeID = "0", Text = "根", Expanded = true }; treeStore.Root.Add(item); Add(treePanel); }
// public event TreeStoreBase.ReadDataEventHandler RightReadData; //private void _treePanelLeft_Submit(object sender, SubmitEventArgs e) //{ // List<SubmittedNode> children = e.RootNode.Children; // foreach (SubmittedNode node in children) // { // Ext.Net.Node node2 = new Ext.Net.Node // { // NodeID = node.NodeID, // Text = node.Text, // Leaf = true // }; // this._treePanelRight.GetRootNode().InsertChild(0, node2); // this._treePanelLeft.GetNodeById(node.NodeID).Remove(); // this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID)); // } //} //private void _treePanelRight_Submit(object sender, SubmitEventArgs e) //{ // List<SubmittedNode> children = e.RootNode.Children; // foreach (SubmittedNode node in children) // { // Ext.Net.Node node2 = new Ext.Net.Node // { // NodeID = node.NodeID, // Text = node.Text, // Leaf = true // }; // this._treePanelLeft.GetRootNode().InsertChild(0, node2); // this._treePanelRight.GetNodeById(node.NodeID).Remove(); // this._selectedIds.Remove(ConvertHelper.ToInt32(node.NodeID)); // } //} //private void _treeStoreLeft_ReadData(object sender, NodeLoadEventArgs e) //{ // if (this.LeftReadData != null) // { // this.LeftReadData(sender, e); // } //} //private void _treeStoreRight_ReadData(object sender, NodeLoadEventArgs e) //{ // if (this.RightReadData != null) // { // this.RightReadData(sender, e); // foreach (Ext.Net.Node node in e.Nodes) // { // this._selectedIds.Add(ConvertHelper.ToInt32(node.NodeID)); // } // } //} //public void AddSelected() //{ // MoveNode(this._treePanelLeft, this._treePanelRight); //} //private void btnAddSelected_DirectClick(object sender, DirectEventArgs e) //{ // this.MoveNode(this._treePanelLeft, this._treePanelRight); //} //private void btnRemoveSelected_DirectClick(object sender, DirectEventArgs e) //{ // this.MoveNode(this._treePanelRight, this._treePanelLeft); //} /// <summary> /// 获取已选择的记录 /// </summary> /// <returns></returns> //public int[] GetSelected(bool clearCahce = true) //{ // int[] numArray = this._selectedIds.ToArray(); // if (clearCahce) // { // this.Context.Cache.Remove("_selectedIds"); // } // return numArray; //} private void InitTreePanel(TreePanel treePanel, TreeStore treeStore, Model model) { treePanel.RootVisible = false; treePanel.AutoDataBind = true; Ext.Net.Parameter parameters = new Ext.Net.Parameter { Name = "id", Value = "record.data.id", Mode = ParameterMode.Raw }; var view = new Ext.Net.TreeView(); view.Plugins.Add(new TreeViewDragDrop() { AppendOnly = true }); treePanel.View.Add(view); //treePanel.DirectEvents.ItemDblClick.ExtraParams.Add(parameters); //treePanel.DirectEvents.ItemDblClick.EventMask.ShowMask = true; //treePanel.DirectEvents.ItemDblClick.EventMask.Msg = "正在添加"; treeStore.AutoDataBind = true; treeStore.AutoLoad = true; model.Fields.Add(new ModelField("Id", ModelFieldType.Int)); model.Fields.Add(new ModelField("Name", ModelFieldType.String)); treeStore.Model.Add(model); treePanel.Store.Add(treeStore); Ext.Net.Node item = new Ext.Net.Node { NodeID = "0", Text = "根" }; treeStore.Root.Add(item); Add(treePanel); }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest && !IsPostBack) { SetExtLanguage(); HideShowButtons(); HideShowColumns(); ldMethod.Select("0"); cc.Format = date.Format = effectiveDate.Format = _systemService.SessionHelper.GetDateformat(); //if (string.IsNullOrEmpty(Request.QueryString["employeeId"])) // X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorOperation).Show(); //CurrentEmployee.Text = Request.QueryString["employeeId"]; //cc.Format = _systemService.SessionHelper.GetDateformat(); if (!string.IsNullOrEmpty(Request.QueryString["_employeeId"]) && !string.IsNullOrEmpty(Request.QueryString["_loanId"])) { var p1 = new Ext.Net.Parameter("id", Request.QueryString["_loanId"]); var p2 = new Ext.Net.Parameter("type", "imgEdit"); var col = new Ext.Net.ParameterCollection(); col.Add(p1); col.Add(p2); PoPuP(null, new DirectEventArgs(col)); } //try //{ // AccessControlApplier.ApplyAccessControlOnPage(typeof(loanSelfService), BasicInfoTab, GridPanel1, btnAdd, SaveButton); //} //catch (AccessDeniedException exp) //{ // X.MessageBox.ButtonText.Ok = Resources.Common.Ok; // X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied, "closeCurrentTab()").Show(); // Viewport1.Hidden = true; // return; //} //try //{ // AccessControlApplier.ApplyAccessControlOnPage(typeof(LoanComment), null, loanCommentGrid, null, Button1); // ApplyAccessControlOnLoanComments(); //} //catch (AccessDeniedException exp) //{ // caseCommentsTab.Hidden = true; //} if (purpose.InputType == InputType.Password) { purpose.Visible = false; purposeField.Visible = true; } } }
protected void Page_Load(object sender, EventArgs e) { if (!X.IsAjaxRequest && !IsPostBack) { SetExtLanguage(); HideShowButtons(); HideShowColumns(); FillSchedules(); FillWorkingCalendar(); releaseDate.Format = expiryDate.Format = releaseDateDF.Format = expiryDateDF.Format = _systemService.SessionHelper.GetDateformat(); if (!string.IsNullOrEmpty(Request.QueryString["record"])) { var p1 = new Ext.Net.Parameter("id", Request.QueryString["record"]); var p2 = new Ext.Net.Parameter("type", "imgEdit"); var col = new Ext.Net.ParameterCollection(); col.Add(p1); col.Add(p2); PoPuP(null, new DirectEventArgs(col)); } if (_systemService.SessionHelper.CheckIfIsAdmin()) { return; } try { AccessControlApplier.ApplyAccessControlOnPage(typeof(Branch), BasicInfoTab, GridPanel1, btnAdd, SaveButton); //ApplyAccessControlOnAddress(); } catch (AccessDeniedException exp) { X.MessageBox.ButtonText.Ok = Resources.Common.Ok; X.Msg.Alert(Resources.Common.Error, Resources.Common.ErrorAccessDenied).Show(); Viewport1.Hidden = true; return; } address.Text = string.Empty; } }
protected override void OnLoad(EventArgs e) { if (this._nodeHelper == null) { _nodeHelper = new NodeHelper(Table); } TreeStore.Config config = new TreeStore.Config { NodeParam = "parentId" }; this._treeStore = new TreeStore(config); this._treeStore.ID = "_treeStore"; Model model = new Model { Fields = { new ModelField("Id", ModelFieldType.String), new ModelField("Name", ModelFieldType.String), new ModelField("ParentId", ModelFieldType.String) } }; model.Fields.AddRange(this._nodeHelper.CustomFields); this._treeStore.Model.Add(model); this._treeStore.Proxy.Add(new PageProxy()); this.Store.Add(this._treeStore); this._treeStore.ReadData += new TreeStoreBase.ReadDataEventHandler(this.treeStore_ReadData); base.RemoteRemove += new TreePanel.RemoteRemoveEventHandler(this.TreePanelEx_RemoteRemove); base.RemoteEdit += new TreePanel.RemoteEditEventHandler(this.TreePanelEx_RemoteEdit); base.RemoteMove += new TreePanel.RemoteMoveEventHandler(this.TreePanelEx_RemoteMove); Ext.Net.Button button = new Ext.Net.Button { Text = "刷新", Handler = "App." + this.ID + ".getStore().load();" }; Toolbar toolbar = new Toolbar(); toolbar.Items.Add(button); this.TopBar.Add(toolbar); if (!Ext.Net.X.IsAjaxRequest) { //base.Listeners.NodeDragOver.Handler = "var recs = dragData.records;var prev=-1;for(var i=0;i<recs.length;i++){var recData=recs[i].data;if(prev==-1){prev=recData.Level;}else{if(prev!=recData.Level){return false;}}}if(targetNode.data.Level>=" + this.Level + ")return false;return true;"; Parameter parameters = new Parameter { Name = "parentId", Value = "arguments[1].data.parentId", Mode = ParameterMode.Raw }; this.RemoteExtraParams.Add(parameters); this.On("beforeRemoteAction", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); JFunction fn = new JFunction("Ext.net.Mask.hide();"); this.On("remoteActionRefusal", fn); this.On("remoteActionException", fn); this.On("remoteActionSuccess", fn); this.On("remoteEditRefusal", new JFunction("Ext.Msg.alert('失败了')")); this._treeStore.On("beforeload", new JFunction("Ext.net.Mask.show({ msg : '正在加载' });")); this._treeStore.On("load", new JFunction("Ext.net.Mask.hide();")); Ext.Net.Node node = new Ext.Net.Node(); node.CustomAttributes.Add(new ConfigItem("Id", "")); node.CustomAttributes.Add(new ConfigItem("Name", "根")); node.NodeID = "0"; node.Expanded = true; node.Text = "根"; this.Root.Add(node); Column column = new Column(); this.ColumnModel.Columns.Add(column); TreeColumn column2 = new TreeColumn(); this.ColumnModel.Columns.Add(column2); ActionColumn column3 = new ActionColumn(); if (this.EnableRemove) { ActionItem item2 = new ActionItem(); column3.Items.Add(item2); item2.Icon = Ext.Net.Icon.PageWhiteDelete; item2.Handler = "var record=arguments[5];var tree = App." + this.ID + ";var node = tree.getStore().getNodeById(record.data.Id) || tree.getStore().getNewRecords()[0];Ext.Msg.confirm(\"提示\", \"会删除相关的数据,无法恢复,确认删除?\", function (r) {if (r == \"yes\") {tree.removeNode(node);return;App.direct.RemoveNode(record.data.Id, {success: function (result) {if (result.Success) {node.remove();node.commit();} else {Ext.Msg.alert(\"错误\", result.Message);}},eventMask: {showMask: true,msg: \"正在删除\"}});}});"; item2.Tooltip = "删除"; } this.ColumnModel.Columns.Add(column3); column.ID = "col1"; column.DataIndex = "Id"; column.Width = 50; column.Text = "编号"; column2.ID = "col2"; column2.DataIndex = "Name"; column2.Width = 300; column2.Text = "名称"; column3.ID = "col3"; column3.Text = "操作"; column3.Width = 60; column3.Align = Alignment.Center; if (EnableEdit) { ActionItem item = new ActionItem(); column3.Items.Add(item); item.Icon = Ext.Net.Icon.PageWhiteAdd; item.Handler = "var record=arguments[5]; var tree = App." + this.ID + ";var ep = tree.editingPlugin;var node,store = tree.getStore();if (record.data.Id) {node = store.getNodeById(record.data.Id);}else{node = store.getRootNode();}node.expand(false, function () {node = node.appendChild({Name:'新节点'});setTimeout(function () {ep.startEdit(node, tree.columns[1]);}, 200);});"; item.Tooltip = "添加子节点"; CellEditing editing = new CellEditing(); editing.Listeners.CancelEdit.Handler = " if (e.record.data.Id) {e.record.reject();} else {e.record.remove(true);}"; this.Plugins.Add(editing); this.Editor.Add(new TextField()); TreeView view = new TreeView(); this.View.Add(view); TreeViewDragDrop drop = new TreeViewDragDrop { DragText = "移动到", AppendOnly = true }; view.Plugins.Add(drop); } this.Mode = TreePanelMode.Remote; } base.OnLoad(e); }
void Defaults_AfterItemAdd(Parameter item) { item.CamelName = true; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); GridView item = View.FirstOrDefault(); if (item == null) { item = new GridView(); item.EnableTextSelection = true; this.View.Add(item); } item.ID = this.ID + "View"; item.LoadingText = "正在加载"; item.LoadMask = true; PagingToolbar toolbar = new PagingToolbar(); Ext.Net.Button btnAdd = null; Ext.Net.Button button2 = null; if (this.EnableAdd) { if (EditorConfig == null || EditorConfig.AddWindow == null) { throw new Exception("EditorConfig的属性有误"); } btnAdd = new Ext.Net.Button { Text = "添加" }; btnAdd.Handler = string.Format("App.editWindow.setWidth({0});App.editWindow.setHeight({1});App.editWindow.setTitle('{2}');App.editWindow.show();App.editWindow.loader.load({{url:'{3}'}})", EditorConfig.AddWindow.Width, EditorConfig.AddWindow.Height, EditorConfig.AddWindow.Title, EditorConfig.AddWindow.Url); toolbar.Items.Add(btnAdd); } if (this.EnableRemove) { button2 = new Ext.Net.Button { Text = "删除" }; button2.DirectEvents.Click.EventMask.Msg = "正在删除"; button2.DirectEvents.Click.EventMask.ShowMask = true; button2.DirectEvents.Click.Confirmation.ConfirmRequest = true; button2.DirectEvents.Click.Confirmation.Message = "确认删除?"; button2.DirectEvents.Click.Confirmation.Title = "提示"; Parameter parameters = new Parameter { Name = "ids", Value = "getSelectionIds()", Mode = ParameterMode.Raw }; button2.DirectEvents.Click.ExtraParams.Add(parameters); } if (this.EditorConfig != null) { if (this.EnableAdd) { btnAdd.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.ExtraParams); btnAdd.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.AddWindow.ExtraParams); } if (this.EnableRemove) { button2.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.ExtraParams); button2.DirectEvents.Click.ExtraParams.AddRange(this.EditorConfig.AddWindow.ExtraParams); } } if (this.EnableAdd) { } if (this.EnableRemove) { button2.DirectClick += new ComponentDirectEvent.DirectEventHandler(this.btnRemove_DirectClick); toolbar.Items.Add(button2); } if (BottomBar.Count > 0) { toolbar.Items.AddRange(BottomBar[0].Items); BottomBar.Clear(); } this.BottomBar.Add(toolbar); this.SelectionModel.Add(new CheckboxSelectionModel()); this.InitModel(); this.InitGridCommand(); if (!Ext.Net.X.IsAjaxRequest) { this.AddScript("function getSelectionIds(){var sm=Ext.getCmp(\"" + this.ID + "\").getSelectionModel();var ids=Array();var selections=sm.getSelection();for(var i=0;i<selections.length;i++)ids.push(selections[i].data.Id);return ids.join(',');}"); } }
private void InitGridCommand(CommandColumn commandColumn) { commandColumn.ID = "_cmdCol"; commandColumn.Sortable = false; commandColumn.Listeners.Command.Handler = "";//.DirectEvents.Command.EventMask.Msg = "正在加载"; //commandColumn.DirectEvents.Command.EventMask.ShowMask = true; //commandColumn.DirectEvents.Command.Url = CommandUrl;//.Event += new ComponentDirectEvent.DirectEventHandler(this.Command_Event); ParameterCollection extraParams = commandColumn.DirectEvents.Command.ExtraParams; if (this.EditorConfig != null) { Parameter parameters = new Parameter { Name = "command", Value = "command", Mode = ParameterMode.Raw }; this.EditorConfig.ExtraParams.Add(parameters); Parameter parameter3 = new Parameter { Name = "id", Value = "record.data.Id", Mode = ParameterMode.Raw }; this.EditorConfig.ExtraParams.Add(parameter3); foreach (Parameter parameter in this.EditorConfig.ExtraParams) { Parameter param1 = parameter; if (extraParams.All<Parameter>(x => x.Name != param1.Name)) { extraParams.Add(parameter); } } } }
protected void CargaPerfiles(object sender, DirectEventArgs eventArgs) { try { IList<co_ca_usuariosperfiles> up = new bf_ca_usuariosperfiles(). GetData(new co_ca_usuariosperfiles { id_usuario = { id = FWPConfiguration.get_ID_User(Session.SessionID) } }); co_ca_perfiles perfil = new bf_ca_perfiles().GetData(FWPConfiguration.get_Perfil(Session.SessionID)); Menu menu = new Menu(); foreach (co_ca_usuariosperfiles usuper in up) { CheckMenuItem item = new CheckMenuItem(); item.Text = usuper.id_perfil.descripcion; item.Group = "perfil"; item.CheckHandler = "function(item, checked) {checked && #{btnPerfil}.setText('" + usuper.id_perfil.descripcion + "');}"; if (perfil.id_perfil == usuper.id_perfil.id) { item.Checked = true; } item.DirectEvents.Click.Event += OnCheckedChangedPerfil; Parameter idPerfil = new Parameter("idPerfil", usuper.id_perfil.id.ToString()); Parameter descripcion = new Parameter("descripcion", usuper.id_perfil.descripcion); item.DirectEvents.Click.ExtraParams.Add(idPerfil); item.DirectEvents.Click.ExtraParams.Add(descripcion); menu.Add(item); } btnPerfil.Text = perfil.pe_descripcion; btnPerfil.Menu.Add(menu); } catch (Exception ex) { Mensajes.Error(ex.Message); } }
/// <summary> /// /// </summary> /// <param name="idMenuPadre"></param> /// <param name="listMenu"></param> protected Menu CreaMenuHijos(int idMenuPadre, IList<co_ca_menu> listMenu) { try { IList<MenuItem> menusHijos = new List<MenuItem>(); Menu menus = new Menu(); foreach (co_ca_menu menuHijo in listMenu.Where(menusHijo => menusHijo.id_menupadre == idMenuPadre).OrderBy(c => c.men_orden)) { co_ca_menu hijo1 = menuHijo; IEnumerable<co_ca_menu> hijos = listMenu.Where(menHijos => menHijos.id_menupadre == hijo1.id_menu); MenuItem hijo; if (hijos.Any()) { hijo = new MenuItem { Text = menuHijo.men_nombre, IconCls = "#Application", ID = "MP_" + menuHijo.men_nombreventana }; hijo.Menu.Add(CreaMenuHijos(menuHijo.id_menu, listMenu)); } else { hijo = new MenuItem(); hijo.ID = "MH_" + menuHijo.men_nombreventana; hijo.IconCls = "#Application"; hijo.Text = menuHijo.men_nombre; hijo.DestroyMenu = false; Parameter titulo = new Parameter("title", menuHijo.men_nombre); string strurl = menuHijo.men_url; string urltemp = "k=" + menuHijo.id_menu + "&u=" + FWPConfiguration.get_ID_User(Session.SessionID) + "&p=" + FWPConfiguration.get_Perfil(Session.SessionID) + "&z=" + FWPConfiguration.get_Accesos(Session.SessionID); if (strurl.Contains("?")) { strurl = strurl + "&" + urltemp; } else { strurl = strurl + "?" + urltemp; } Parameter url = new Parameter("url", strurl); Parameter id = new Parameter("id", menuHijo.men_nombreventana); Parameter icono = new Parameter("icono", "#Application"); hijo.DirectEvents.Click.Event += Button_WindowDesktop; hijo.DirectEvents.Click.ExtraParams.Add(url); hijo.DirectEvents.Click.ExtraParams.Add(titulo); hijo.DirectEvents.Click.ExtraParams.Add(icono); hijo.DirectEvents.Click.ExtraParams.Add(id); } menusHijos.Add(hijo); } menus.Items.Add(menusHijos); return menus; } catch (Exception e) { throw new Exception(e.Message); } }