Esempio n. 1
0
 protected override void OnPreInit(EventArgs e)
 {
     base.OnPreInit(e);
     _viewPort = new Viewport();
     _grid = new GridPanelEx();
     _grid.ItemType = typeof(RoleManagerModel);
     _grid.ReadData += _grid_ReadData;
     _grid.Delete += _grid_Delete;
     _grid.EnableAdd = EnableAddRole;
     _grid.EnableEdit = EnableEditRole;
     _grid.EnableRemove = EnableRemoveRole;
     _grid.Region = Region.Center;
     _grid.ID = "gridRoles";
     _grid.EditorConfig = new GridPanelEditorConfig();
     var _addWindowConfig = new WindowConfig();
     _addWindowConfig.Height = 400;
     _addWindowConfig.Width = 800;
     _addWindowConfig.Url = AddUrl;
     _addWindowConfig.Title = "添加角色";
     _grid.EditorConfig.AddWindow = _addWindowConfig;
     var _editWindowConfig = new WindowConfig();
     _editWindowConfig.Height = 400;
     _editWindowConfig.Width = 800;
     _editWindowConfig.Url = EditUrl;
     _editWindowConfig.Title = "编辑角色";
     _editWindowConfig.ExtraParams.Add(new Parameter("id", "record.data.Id", ParameterMode.Raw));
     _grid.EditorConfig.EditWindow = _editWindowConfig;
     _viewPort.Add(_grid);
     _viewPort.Layout = "border";
     Controls.Add(_viewPort);
 }
Esempio n. 2
0
 public override void RenderView(System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer)
 {
     writer.Write("<!DOCTYPE html>");
     writer.Write("<head>");
     writer.Write("<title>后台管理中心 - " + AppConfig.WebTitle + "</title>");
     writer.Write("</head><body></body>");
     writer.Write(Html.X().ResourceManager().ToHtmlString());
     var _viewPort = new Viewport();
     var _grid = new Xinchen.ExtNetBase.Mvc.GridPanelEx();
     _grid.ItemType = typeof(UserManagerModel);
     _grid.ReadUrl = Url.Action("GetAccounts");
     //_grid.ReadData += _grid_ReadData;
     //_grid.Delete += _grid_Delete;
     //_grid.EnableAdd = EnableAddUser;
     //_grid.EnableEdit = EnableEditUser;
     //_grid.EnableRemove = EnableRemoveUser;
     _grid.Region = Region.Center;
     _grid.ID = "gridUsers";
     _grid.EditorConfig = new GridPanelEditorConfig();
     var _addWindowConfig = new WindowConfig();
     _addWindowConfig.Height = 400;
     _addWindowConfig.Width = 800;
     _addWindowConfig.Url = Url.Action("AddAccount");
     _addWindowConfig.Title = "添加用户";
     _grid.EditorConfig.AddWindow = _addWindowConfig;
     var _editWindowConfig = new WindowConfig();
     _editWindowConfig.Height = 400;
     _editWindowConfig.Width = 800;
     _editWindowConfig.Url = Url.Action("UpdateAccount") + "?id=@id";
     _editWindowConfig.Title = "编辑用户";
     _editWindowConfig.ExtraParams.Add(new Parameter("id", "record.data.Id", ParameterMode.Raw));
     _grid.EditorConfig.EditWindow = _editWindowConfig;
     _viewPort.Add(_grid);
     _viewPort.Layout = "border";
     writer.Write(_viewPort.ToBuilder().ToHtmlString());
 }
Esempio n. 3
0
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);

            #region 总体布局
            _viewPort = new Viewport();
            _viewPort.Layout = "border";
            _copyright = new Panel();
            _copyright.Title = "版权";
            _copyright.TitleAlign = TitleAlign.Center;
            _copyright.Collapsible = false;
            _copyright.Region = Region.South;
            _copyright.Split = true;
            _menu = new Panel();
            _menu.Title = "导航菜单";
            _menu.Collapsible = true;
            _menu.Region = Region.West;
            _menu.Split = true;
            _menu.Width = 200;
            _workArea = new Ext.Net.TabPanel();
            _workArea.Title = "欢迎使用";
            _workArea.Region = Region.Center;
            _workArea.ID = "tabWork";
            _title = new Panel();
            _title.Title = WebName;
            _title.Collapsible = false;
            _title.Region = Region.North;
            _title.Split = true;
            _viewPort.Items.Add(_title);
            _viewPort.Items.Add(_workArea);
            _viewPort.Items.Add(_copyright);
            _viewPort.Items.Add(_menu);
            #endregion

            #region 个人区
            _personPanel = new Ext.Net.Panel();
            _personPanel.Collapsed = true;
            _personPanel.Collapsible = true;
            _personPanel.Title = "欢迎使用";
            _personPanel.Height = 110;
            _personPanel.BodyPadding = 10;
            _personPanel.Layout = "table";
            _personPanel.LayoutConfig.Add(new TableLayoutConfig()
            {
                Columns = 2
            });
            Image avatarImg = new Image();
            avatarImg.RowSpan = 2;
            avatarImg.Width = avatarImg.Height = 70;
            avatarImg.ImageUrl = BaseResource.avatar;
            _personPanel.Add(avatarImg);
            _personPanel.Add(new Label(userInfo.Username));

            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.Width = 80;
            buttonGroup.Layout = "vbox";
            buttonGroup.Add(new KeyButton()
            {
                Text = "修改密码",
                ID = "btnChangePassword",
                OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();"
            });

            btnExit = new Button()
            {
                Text = "安全退出",
                ID = "btnExit",
                Icon = Icon.KeyDelete
            };
            var clickEvent = btnExit.DirectEvents.Click;
            clickEvent.Event += clickEvent_Event;
            clickEvent.EventMask.Set("正在退出");
            clickEvent.Confirmation.ConfirmRequest = true;
            clickEvent.Confirmation.Title = "提示";
            clickEvent.Confirmation.Message = "确定退出?";
            buttonGroup.Add(btnExit);
            _personPanel.Add(buttonGroup);
            _menu.Add(_personPanel);
            winChangePassword = new Window()
            {
                Icon = Icon.Key,
                BodyPadding = 10,
                Width = 300,
                Height = 210,
                Modal = true,
                Hidden = true,
                AutoShow = false,
                ID = "winChangePassword",
                Title = "修改密码",
                Loader = new ComponentLoader()
                {
                    Url = ResolveClientUrl("~/user/changepassword.aspx"),
                    Mode = LoadMode.Frame
                }
            };
            winChangePassword.Loader.LoadMask.Set("正在加载");
            Controls.Add(winChangePassword);
            #endregion

            _menuPanel = new TreePanel()
            {
                Title = "功能菜单",
                Height = 500,
                RootVisible = false,
                ID = "mainMenu"
            };

            _menuStore = new TreeStore()
            {
                NodeParam = "parentId"
            };
            _menuStore.ReadData += _menuStore_ReadData;
            _menuPanel.Store.Add(_menuStore);
            _menuPanel.Root.Add(new Node()
            {
                NodeID = "0",
                Text = "Root",
                Expanded = true
            });
            _menu.Add(_menuPanel);
            var itemClick = _menuPanel.DirectEvents.ItemClick;
            itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.id);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.id).isLeaf();";
            itemClick.EventMask.Set("正在加载");
            itemClick.Event += itemClick_Event;
            itemClick.ExtraParams.Add(new Parameter("id", "record.data.id", ParameterMode.Raw));

            #region 隐藏顶级窗口
            _winParentWindow = new Window();
            _winParentWindow.Hidden = true;
            _winParentWindow.Loader = new ComponentLoader();
            _winParentWindow.Loader.Mode = LoadMode.Frame;
            _winParentWindow.Width = 800;
            _winParentWindow.Modal = true;
            _winParentWindow.Height = 600;
            _winParentWindow.ID = "_topWin";
            Controls.Add(_winParentWindow);
            #endregion

            Controls.Add(_viewPort);
        }
        private void _Count_Radio(System.Web.UI.ControlCollection objcol, string radname)
        {
            try
            {
                int iID;
                int iNO;

                foreach (object obj in objcol)
                {
                    System.Type itype = obj.GetType();
                    if (itype.Namespace == "Ext.Net" || itype.Namespace == "System.Web.UI.HtmlControls")
                    {
                        switch (itype.Name)
                        {
                        case "HtmlForm":
                            System.Web.UI.HtmlControls.HtmlForm htmlform = (System.Web.UI.HtmlControls.HtmlForm)obj;
                            _Count_Radio(htmlform.Controls, radname);
                            break;

                        case "Viewport":
                            Ext.Net.Viewport viewport = (Ext.Net.Viewport)obj;
                            _Count_Radio(viewport.Controls, radname);
                            break;

                        case "FormPanel":
                            Ext.Net.FormPanel formpanel = (Ext.Net.FormPanel)obj;
                            _Count_Radio(formpanel.Controls, radname);
                            break;

                        case "Panel":
                            Ext.Net.Panel panel = (Ext.Net.Panel)obj;
                            _Count_Radio(panel.Controls, radname);
                            break;

                        case "TabPanel":
                            Ext.Net.TabPanel tabpanel = (Ext.Net.TabPanel)obj;
                            _Count_Radio(tabpanel.Controls, radname);
                            break;

                        case "Container":
                            Ext.Net.Container container = (Ext.Net.Container)obj;
                            _Count_Radio(container.Controls, radname);
                            break;

                        case "FieldSet":
                            Ext.Net.FieldSet fieldset = (Ext.Net.FieldSet)obj;
                            _Count_Radio(fieldset.Controls, radname);
                            break;

                        case "ContentContainer":
                            Ext.Net.ContentContainer contentcontainer = (Ext.Net.ContentContainer)obj;
                            _Count_Radio(contentcontainer.Controls, radname);
                            break;

                        case "RadioGroup":
                            Ext.Net.RadioGroup radioGroup = (Ext.Net.RadioGroup)obj;
                            _Count_Radio(radioGroup.Controls, radname);
                            break;

                        case "Radio":
                            Ext.Net.Radio radio = (Ext.Net.Radio)obj;

                            string[] s = radio.ID.Split('_');
                            iID = Convert.ToInt16(s[1]);
                            iNO = Convert.ToInt16(s[2]);

                            if (iID > 1 && iID < 38)
                            {
                                if (radio.Value.Equals(true))
                                {
                                    iSCORE = iSCORE + iNO - 1;
                                }
                            }
                            break;

                        case "":

                            break;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _ErrorMsgShow(ex.Message.ToString());
            }
        }
Esempio n. 5
0
 private void InitComponents()
 {
     this.btnRefresh = new Ext.Net.Button {
         Icon = Icon.ArrowRefresh, Text = "Tải lại", ToolTip = "Tải lại"
     };
     this.btnSelect = new Ext.Net.Button {
         Icon = Icon.Find, Text = "Chọn", ToolTip = "Chọn và đóng"
     };
     this.storeMain = new Ext.Net.Store
     {
         ID       = "storeMain",
         PageSize = 20,
         AutoLoad = true,
         Model    =
         {
             new Model              {
                 IDProperty = "No",
                 Fields     =
                 {
                     new ModelField {
                         Name = "No"
                     },
                     new ModelField {
                         Name = "Description"
                     },
                     new ModelField {
                         Name = "Base_Unit_of_Measure"
                     }
                 }
             }
         }
     };
     this.grdMain = new Ext.Net.GridPanel
     {
         ID          = "grdMain",
         ColumnModel =
         {
             Columns           =
             {
                 new Column {
                     DataIndex = "No",                   Text = "No",                   Width = 100
                 },
                 new Column {
                     DataIndex = "Description",          Text = "Description",          Width = 100
                 },
                 new Column {
                     DataIndex = "Base_Unit_of_Measure", Text = "Base Unit of Measure", Width = 100
                 }
             }
         },
         Plugins        = { new FilterHeader {
                            } },
         BottomBar      = { new PagingToolbar {
                            } },
         SelectionModel = { new RowSelectionModel {
                                Mode = SelectionMode.Single
                            } }
     };
     this.grdMain.Store.Add(this.storeMain);
     this.pnlMain = new Ext.Net.Panel
     {
         Region = Region.Center,
         Border = false,
         TopBar =
         {
             new Toolbar
             {
                 Items ={ this.btnRefresh,             new ToolbarSeparator(), this.btnSelect }
             }
         },
         ContentControls = { this.grdMain }
     };
     this.viewPort = new Viewport {
         Layout = "Border", Items = { this.pnlMain }
     };
     this.Form.Controls.Add(this.viewPort);
 }
Esempio n. 6
0
 public override void Initialize(System.ComponentModel.IComponent component)
 {
     base.Initialize(component);
     this.viewPort = component as Viewport;
 }
Esempio n. 7
0
        public override void RenderView(System.Web.Mvc.ViewContext viewContext, System.IO.TextWriter writer)
        {
            writer.Write("<!DOCTYPE html>");
            writer.Write("<head>");
            writer.Write("<title>后台管理中心 - " + AppConfig.WebTitle + "</title>");
            writer.Write("</head><body></body>");
            var x = Html.X();
            writer.Write(x.ResourceManager().ToHtmlString());
            #region 总体布局
            var viewPort = new Viewport();
            viewPort.Layout = "border";
            var _copyright = new Panel();
            _copyright.Title = AppConfig.WebName + " 版权所有";
            _copyright.TitleAlign = TitleAlign.Center;
            _copyright.Collapsible = false;
            _copyright.Region = Region.South;
            _copyright.Split = true;
            var _menu = new Panel();
            _menu.Title = "导航菜单";
            _menu.Collapsible = true;
            _menu.Region = Region.West;
            _menu.Split = true;
            _menu.Width = 200;
            var _workArea = new Ext.Net.TabPanel();
            _workArea.Title = "欢迎使用";
            _workArea.Region = Region.Center;
            _workArea.ID = "tabWork";
            var _title = new Panel();
            _title.Title = AppConfig.WebTitle;
            _title.Collapsible = false;
            _title.Region = Region.North;
            _title.Split = true;
            viewPort.Items.Add(_title);
            viewPort.Items.Add(_workArea);
            viewPort.Items.Add(_copyright);
            viewPort.Items.Add(_menu);
            #endregion

            #region 个人区
            var _personPanel = new Ext.Net.Panel();
            _personPanel.Collapsed = true;
            _personPanel.Collapsible = true;
            _personPanel.Title = "欢迎使用";
            _personPanel.Height = 110;
            _personPanel.BodyPadding = 10;
            _personPanel.Layout = "table";
            _personPanel.LayoutConfig.Add(new TableLayoutConfig()
            {
                Columns = 2
            });
            Image avatarImg = new Image();
            avatarImg.RowSpan = 2;
            avatarImg.Width = avatarImg.Height = 70;
            //avatarImg.ImageUrl = BaseResource.avatar;
            _personPanel.Add(avatarImg);
            _personPanel.Add(new Label(UserInfo.Username));

            ButtonGroup buttonGroup = new ButtonGroup();
            buttonGroup.Width = 80;
            buttonGroup.Layout = "vbox";
            buttonGroup.Add(new Button()
            {
                Icon= Ext.Net.Icon.Key,
                Text = "修改密码",
                ID = "btnChangePassword",
                OnClientClick = "App.winChangePassword.show();App.winChangePassword.getLoader().load();"
            });

            var btnExit = new Button()
            {
                Text = "安全退出",
                ID = "btnExit",
                Icon = Icon.KeyDelete
            };

            buttonGroup.Add(btnExit);
            _personPanel.Add(buttonGroup);
            _menu.Add(_personPanel);
            var winChangePassword = new Window()
            {
                Icon = Icon.Key,
                BodyPadding = 10,
                Width = 300,
                Height = 210,
                Modal = true,
                Hidden = true,
                AutoShow = false,
                ID = "winChangePassword",
                Title = "修改密码",
                Loader = new ComponentLoader()
                {
                    Url = Url.Action("changePassword", "account"),
                    Mode = LoadMode.Frame
                }
            };
            #endregion

            var _menuPanel = new TreePanel()
            {
                Title = "功能菜单",
                Height = 500,
                RootVisible = false,
                ID = "mainMenu"
            };

            var _menuStore = new TreeStore()
             {
                 NodeParam = "parentId"
             };
            _menuStore.Proxy.Add(x.AjaxProxy().Url(Url.Action("GetMenus")).ActionMethods(y => y.Read = HttpMethod.POST));
            //_menuStore.ReadData += _menuStore_ReadData;
            _menuPanel.Store.Add(_menuStore);
            _menuPanel.Root.Add(new Node()
            {
                NodeID = "0",
                Text = "Root",
                Expanded = true
            });
            _menu.Add(_menuPanel);
            var itemClick = _menuPanel.DirectEvents.ItemClick;
            itemClick.Before = "var tree=arguments[0],eventType=arguments[1],eventName=arguments[2],extraParams=arguments[3];var tab = App.tabWork.getComponent('menu' + extraParams.menuid);if (tab) {App.tabWork.setActiveTab(tab);return false;}return tree.getStore().getNodeById(extraParams.menuid).isLeaf();";
            itemClick.Url = Url.Action("OpenPage");
            itemClick.ExtraParams.Add(new Parameter("menuid", "record.data.id", ParameterMode.Raw));
            writer.Write(viewPort.ToBuilder().ToHtmlString());
        }