Ejemplo n.º 1
0
        public string GetActionColumn()
        {
            ActionColumnDAL dal   = new ActionColumnDAL(connectionString);
            ActionColumn    model = dal.GetActionColumn(_actioncolumnid);

            return(model.ActionColumnName);
        }
Ejemplo n.º 2
0
        public void write_body_cell_with_no_calls()
        {
            var chain = new BehaviorChain();

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(" -");
        }
Ejemplo n.º 3
0
        public void write_body_cell_with_no_calls()
        {
            var chain = new BehaviorChain();

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(" -");
        }
Ejemplo n.º 4
0
        public void write_body_cell_with_only_one_call()
        {
            var chain = new BehaviorChain();
            ActionCall call = ActionCall.For<TargetController>(x => x.Go());
            chain.AddToEnd(call);

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(call.Description);
        }
Ejemplo n.º 5
0
        public void write_body_cell_with_only_one_call()
        {
            var        chain = new BehaviorChain();
            ActionCall call  = ActionCall.For <TargetController>(x => x.Go());

            chain.AddToEnd(call);

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(call.Description);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据指定的ID,从数据库中读取分栏信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int LoadFromID(int id)
        {
            ActionColumnDAL dal   = new ActionColumnDAL(connectionString);
            ActionColumn    model = dal.GetActionColumn(id);

            if (model == null)
            {
                return(-1);
            }

            id = model.ActionColumnid;
            _actioncolumnid   = model.ActionColumnid;
            _actioncolumnname = model.ActionColumnName;
            _link             = model.Link;
            return(model.ActionColumnid);
        }
Ejemplo n.º 7
0
        public void write_body_cell_with_multiple_calls()
        {
            var chain = new BehaviorChain();
            ActionCall call1 = ActionCall.For<TargetController>(x => x.Go());
            chain.AddToEnd(call1);

            ActionCall call2 = ActionCall.For<TargetController>(x => x.GoWithInput(null));
            chain.AddToEnd(call2);

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(call1.Description + ", " + call2.Description);
        }
Ejemplo n.º 8
0
        //查询所有的权限分栏
        public ArrayList Select()
        {
            ArrayList lists = new ArrayList();

            using (SqlDataReader reader = RunProcedure("sp_S_ActionColumns", null))
            {
                while (reader.Read())
                {
                    ActionColumn model = new ActionColumn();
                    model.ActionColumnid   = Convert.ToInt32(reader["actioncolumnid"]);
                    model.ActionColumnName = Convert.ToString(reader["actioncolumnname"]);
                    model.Link             = Convert.ToString(reader["link"]);
                    lists.Add(model);
                }
            }
            return(lists);
        }
Ejemplo n.º 9
0
        public void write_body_cell_with_multiple_calls()
        {
            var        chain = new BehaviorChain();
            ActionCall call1 = ActionCall.For <TargetController>(x => x.Go());

            chain.AddToEnd(call1);

            ActionCall call2 = ActionCall.For <TargetController>(x => x.GoWithInput(null));

            chain.AddToEnd(call2);

            var column = new ActionColumn();

            var tag = new HtmlTag("td");

            column.WriteBody(chain, null, tag);

            tag.Text().ShouldEqual(call1.Description + ", " + call2.Description);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取指定用户的权限分栏
        /// </summary>
        /// <param name="masterid"></param>
        /// <returns></returns>
        public ArrayList GetActionColumns(string masterid)
        {
            ArrayList actioncolumns = new ArrayList();

            SqlParameter[] parameters =
            {
                new SqlParameter("@masterid", SqlDbType.VarChar)
            };
            parameters[0].Value = masterid;
            using (SqlDataReader reader =
                       RunProcedure("sp_GetActioncolumn", parameters))
            {
                while (reader.Read())
                {
                    ActionColumn model = new ActionColumn();
                    model.ActionColumnid   = Convert.ToInt32(reader["actioncolumnid"]);
                    model.ActionColumnName = Convert.ToString(reader["actioncolumnname"]);
                    model.Link             = Convert.ToString(reader["link"]);
                    actioncolumns.Add(model);
                }
            }
            return(actioncolumns);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取指定的ID权限分栏信息
        /// </summary>
        /// <param name="actioncolumnid"></param>
        /// <returns></returns>
        public ActionColumn GetActionColumn(int actioncolumnid)
        {
            ActionColumn model = null;

            SqlParameter[] parameters =
            {
                new SqlParameter("@actioncolumnid", SqlDbType.Int)
            };
            parameters[0].Value = actioncolumnid;

            using (SqlDataReader reader =
                       RunProcedure("sp_SelectActioncolumn", parameters))
            {
                if (reader.Read())
                {
                    model = new ActionColumn();
                    model.ActionColumnid   = Convert.ToInt32(reader["actioncolumnid"]);
                    model.ActionColumnName = Convert.ToString(reader["actioncolumnname"]);
                    model.Link             = Convert.ToString(reader["link"]);
                }
            }

            return(model);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        private ColumnBase CreateActionColumn()
        {
            var column = new ActionColumn
            {
                ID           = "DefaultButtons",
                Width        = new Unit(Width),
                MenuDisabled = true,
                Align        = Alignment.Center,
                MenuText     = Properties.Resources.SActionColumnText,
                Locked       = Locked
            };

            column.PreRender += AddActionItems;

            return(column);

            void AddActionItems(object sender, EventArgs e)
            {
                if (column.Items.Count > 0)
                {
                    return;
                }

                if (LookVisible && !string.IsNullOrEmpty(LookUrl))
                {
                    var actionItem = new ActionItem
                    {
                        Icon    = Icon.Note,
                        Tooltip = Resources.SLook,
                        Handler = string.Format(@"function(view, rowIndex, colIndex, item, eArgs, record){{{0}}}", GetLookScript()),
                        IconCls = ResourceManager.GetIconClassName(Icon.Note) + " CursorPointer",
                    };
                    actionItem.CustomConfig.Add(new ConfigItem("ActionType", "Look"));
                    column.Items.Add(actionItem);
                }

                if (EditVisible && !string.IsNullOrEmpty(EditUrl))
                {
                    var actionItem = new ActionItem
                    {
                        Icon    = Icon.NoteEdit,
                        Tooltip = Resources.SEditText,
                        Handler = string.Format(@"function(view, rowIndex, colIndex, item, eArgs, record){{{0}}}", GetEditScript()),
                        IconCls = ResourceManager.GetIconClassName(Icon.NoteEdit) + " CursorPointer",
                    };
                    actionItem.IsDisabled.Handler = "return !record.data.CanEdit || record.data.id == null;";
                    actionItem.CustomConfig.Add(new ConfigItem("ActionType", "Edit"));
                    column.Items.Add(actionItem);
                }

                if (DeleteVisible)
                {
                    var actionItem = new ActionItem
                    {
                        Icon    = Icon.Cross,
                        Tooltip = Resources.SDeleteText,
                        Handler = string.Format(@"function(view, rowIndex, colIndex, item, eArgs, record){{{0}}}", GetDeleteScript()),
                        IconCls = ResourceManager.GetIconClassName(Icon.Cross) + " CursorPointer",
                    };
                    actionItem.IsDisabled.Handler = "return !record.data.CanDelete;";
                    actionItem.CustomConfig.Add(new ConfigItem("ActionType", "Delete"));
                    column.Items.Add(actionItem);
                }

                var buttons = GetAdditionalButtons();

                if (buttons != null)
                {
                    foreach (var actionItem in buttons)
                    {
                        if (actionItem.Icon != Icon.None)
                        {
                            var iconCls = ResourceManager.GetIconClassName(actionItem.Icon);
                            actionItem.IconCls += iconCls + " CursorPointer";
                        }
                        else
                        {
                            actionItem.IconCls += " CursorPointer";
                        }

                        if (actionItem.CustomConfig.Contains("insertIndex"))
                        {
                            var index = Convert.ToInt32(actionItem.CustomConfig.First(r => r.Name == "insertIndex").Value);
                            column.Items.Insert(index, actionItem);
                        }
                        else
                        {
                            column.Items.Add(actionItem);
                        }
                    }
                }
            }
        }