protected void btnSave_Click(object sender, EventArgs e)
        {
            //验证不通过返回
            if (!this.Page.IsValid)
                return;

            SystemApplication obj = new SystemApplication();
            obj.SystemApplicationName = this.txtSystemApplicationName.Text.Trim();
            obj.SystemApplicationDescription = this.txtSystemApplicationDescription.Text.Trim();
            obj.SystemApplicationUrl = this.txtSystemApplicationUrl.Text.Trim();
            obj.SystemApplicationIsSystemApplication = this.chkSystemApplicationIsSystemApplication.Checked;

            //添加数据
            try
            {
                ServicesContainerInstance.SystemApplicationServiceInstance.Create(obj);
                ServicesContainerInstance.SystemLogServiceInstance.LogOperationAddOKInfo(ServicesContainerInstance.SystemUserServiceInstance.GetCurrentLoginUser(), ServicesContainerInstance.SystemMoudleServiceInstance.GetSystemMoudleByName("系统应用程序"), "系统应用程序", obj.SystemApplicationID,"管理后台程序",WebUtil.GetRequestInfo());
                //this.Context.Items["LastPageStatus"] = this.FormListPageStatusInfo;
                this.Server.Transfer("ListPage.aspx");

                
                //WebMessageBox.ShowOperationOkMessage("操作成功", "用户添加系统应用成功", this.ResolveUrl("ListPage.aspx"));
            }
            catch (ThreadAbortException tae)
            {

            }
            catch (Exception e1)
            {
                this.lblMessage.Text = "添加数据失败,错误原因:" + e1.Message;
                //WebMessageBox.ShowOperationFailedMessageAndHistoryBack("操作失败", "添加数据失败,错误原因:" + e1.Message);
            }
        }
        /// <summary>
        /// 获取指定应用程序下指定菜单的子菜单最大序号
        /// </summary>
        /// <param name="app">应用程序</param>
        /// <param name="parentMenu">父菜单</param>
        /// <returns>子菜单最大序号</returns>
        public int GetMaxOrderByApplicationAndParentMenu(SystemApplication app, SystemMenu parentMenu)
        {
            DetachedCriteria menuCriteria = DetachedCriteria.For(typeof(SystemMenu));
            
            if (app == null)
                menuCriteria.Add(SystemMenuDao.PROPERTY_APPLICATIONID.IsNull());
            else
                menuCriteria.Add(SystemMenuDao.PROPERTY_APPLICATIONID.Eq(app));

            if (parentMenu == null)
                menuCriteria.Add(SystemMenuDao.PROPERTY_PARENTMENUID.IsNull());
            else
                menuCriteria.Add(SystemMenuDao.PROPERTY_PARENTMENUID.Eq(parentMenu));

            menuCriteria.SetProjection(SystemMenuDao.PROPERTY_MENUORDER.Max());

            ISession session = this.DoGetSession(false);

            object result = menuCriteria.GetExecutableCriteria(session).SetMaxResults(1).UniqueResult();

            if (result == null)
                return 0;
            else
                return (int)result;
        }
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public SystemViewBase()
		{
			_systemview_id = 0; 
			_systemview_namecn = String.Empty; 
			_systemview_nameen = String.Empty; 
			_application_id =  null; 
			_systemview_description = String.Empty; 
		}
 /// <summary>
 /// 工具--计算器
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Tsmi_Calc_Click(object sender, EventArgs e)
 {
     //启动计算器
     if (SystemApplication.Open("calc.exe") == null)
     {
         MessageBox.Show("启动失败");
     }
 }
        /// <summary>
        /// 检查角色和应用程序是否对应
        /// </summary>
        /// <param name="role">角色</param>
        /// <param name="application">应用程序</param>
        /// <returns>角色和应用程序是否对应</returns>
        public bool RoleAndApplicationHasRelation(SystemRole role, SystemApplication application)
        {
            List<ICriterion> criterions = new List<ICriterion>();

            criterions.Add(SystemRoleApplicationDao.PROPERTY_ROLEID.Eq(role));

            criterions.Add(SystemRoleApplicationDao.PROPERTY_APPLICATIONID.Eq(application));

            return (this.FindAll(criterions.ToArray()).Count > 0);
        }
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public SystemMoudleBase()
		{
			_moudle_id = 0; 
			_moudle_namecn = String.Empty; 
			_moudle_nameen = String.Empty; 
			_moudle_namedb = String.Empty; 
			_moudle_description = String.Empty; 
			_application_id =  null; 
			_moudle_issystemmoudle = false; 
		}
Exemple #7
0
 /// <summary>
 /// 默认构造函数
 /// </summary>
 public SystemMoudleBase()
 {
     _moudle_id             = 0;
     _moudle_namecn         = String.Empty;
     _moudle_nameen         = String.Empty;
     _moudle_namedb         = String.Empty;
     _moudle_description    = String.Empty;
     _application_id        = null;
     _moudle_issystemmoudle = false;
 }
 public SystemApplicationTests()
 {
     systemApplicationUnderTest = new SystemApplication
     {
         Id = null,
         Name = string.Format("My Test Application {0}", Guid.NewGuid()),
         CompanyName = "Aspin",
         ContactPerson = "Mannamarrak",
         ContactNumber = "1234567890"
     };
 }
        /// <summary>
        /// 获取指定系统应用下的Menu
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public List<SystemMenu> GetMenuByApplication(SystemApplication app)
        {
            //创建游离对象
            DetachedCriteria menuQuery = DetachedCriteria.For(typeof(SystemMenu));
            //指定查询条件
            menuQuery.Add(SystemMenuDao.PROPERTY_APPLICATIONID.Eq(app));
            //指定排序规则
            menuQuery.AddOrder(SystemMenuDao.PROPERTY_MENUORDER.Asc());
            menuQuery.AddOrder(SystemMenuDao.PROPERTY_MENUID.Desc());

            return this.FindListByDetachedCriteriaQuery(menuQuery);
        }
Exemple #10
0
        /// <summary>
        /// 获取指定系统应用下的Menu
        /// </summary>
        /// <param name="app"></param>
        /// <returns></returns>
        public List <SystemMenu> GetMenuByApplication(SystemApplication app)
        {
            //创建游离对象
            DetachedCriteria menuQuery = DetachedCriteria.For(typeof(SystemMenu));

            //指定查询条件
            menuQuery.Add(SystemMenuDao.PROPERTY_APPLICATIONID.Eq(app));
            //指定排序规则
            menuQuery.AddOrder(SystemMenuDao.PROPERTY_MENUORDER.Asc());
            menuQuery.AddOrder(SystemMenuDao.PROPERTY_MENUID.Desc());

            return(this.FindListByDetachedCriteriaQuery(menuQuery));
        }
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public SystemMenuBase()
		{
			_menu_id = 0; 
			_menu_name = String.Empty; 
			_menu_description = String.Empty; 
			_menu_url = String.Empty; 
			_menu_urltarget = String.Empty; 
			_menu_iscategory = false; 
			_parentmenu_id =  null; 
			_menu_order = 0; 
			_menu_type = String.Empty; 
			_menu_issystemmenu = false; 
			_menu_isenable = false; 
			_applicationid =  null; 
		}
 /// <summary>
 /// 默认构造函数
 /// </summary>
 public SystemMenuBase()
 {
     _menu_id           = 0;
     _menu_name         = String.Empty;
     _menu_description  = String.Empty;
     _menu_url          = String.Empty;
     _menu_urltarget    = String.Empty;
     _menu_iscategory   = false;
     _parentmenu_id     = null;
     _menu_order        = 0;
     _menu_type         = String.Empty;
     _menu_issystemmenu = false;
     _menu_isenable     = false;
     _applicationid     = null;
 }
Exemple #13
0
 private void BindManageMenuTreeByApplicationIDAndSelectNodeArray(string appID, List <string> selectNodeID)
 {
     if (appID != "")
     {
         int selectAppId             = int.Parse(appID);
         SystemApplication selectApp = systemApplicationServiceInstance.FindById(selectAppId);
         if (selectApp != null)
         {
             this.tvMenus.Nodes.Clear();
             this.tvMenus.Nodes.Add(systemMenuServiceInstance.GenerateSelectAssignedWebTreeNodeByApplication(selectApp, this.ResolveUrl("~/images/Menu/control_panel.gif"), this.ResolveUrl("~/images/Menu/folders.gif"), this.ResolveUrl("~/images/Menu/folder.gif")));
         }
         TreeViewHelper.CheckTreeViewByValues(this.tvMenus, selectNodeID);
         this.tvMenus.ExpandAll();
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //验证不通过返回
            if (!this.Page.IsValid)
            {
                return;
            }

            SystemApplication obj = new SystemApplication();

            obj.SystemApplicationName        = this.txtSystemApplicationName.Text.Trim();
            obj.SystemApplicationDescription = this.txtSystemApplicationDescription.Text.Trim();
            obj.SystemApplicationUrl         = this.txtSystemApplicationUrl.Text.Trim();

            //添加数据
            this.SaveCurrentData(obj);
        }
        /// <summary>
        /// 获取应用程序下面分配的角色
        /// </summary>
        /// <param name="application">应用程序</param>
        /// <returns>分配的角色</returns>
        public List<SystemRole> GetApplicationAssignRole(SystemApplication application)
        {
            List<ICriterion> criterions = new List<ICriterion>();

            criterions.Add(SystemRoleApplicationDao.PROPERTY_APPLICATIONID.Eq(application));

            List<SystemRoleApplication> listSystemRoleApplication = this.FindAll(criterions.ToArray());

            List<SystemRole> assignRoles = new List<SystemRole>();

            foreach (SystemRoleApplication relation in listSystemRoleApplication)
            {
                assignRoles.Add(relation.RoleID);
            }

            return assignRoles;
        }
 public SystemApplication CreateOrLoadApplication(string s)
 {
     List<SystemApplication> listApplication = this.SelfDao.FindedApplicationsByName(s);
     if (listApplication.Count > 0)
         return listApplication[0];
     else
     {
         SystemApplication app = new SystemApplication()
                                     {
                                         SystemApplicationName = s,
                                         SystemApplicationDescription = s,
                                         SystemApplicationUrl = "#",
                                         SystemApplicationIsSystemApplication = true
                                     };
         this.selfDao.Save(app);
         return app;
     }
 
 }
Exemple #17
0
        public TreeNode GenerateSelectAssignedWebTreeNodeByApplication(SystemApplication app, string rootImageUrl, string groupImageUrl, string itemImageUrl)
        {
            SuperWebTreeNode baseTreeNode = new SuperWebTreeNode(SYSTEMMENU_MIN_DEPTH, SYSTEMMENU_MAX_DEPTH, 0);

            baseTreeNode.ShowCheckBox = false;
            baseTreeNode.SelectAction = TreeNodeSelectAction.None;
            baseTreeNode.Text         = app.SystemApplicationName;
            baseTreeNode.Value        = "0";
            baseTreeNode.ImageUrl     = rootImageUrl;


            List <SystemMenu> listmenu =
                this.SelfDao.GetMenuByApplication(app);

            foreach (SystemMenu groupMenu in listmenu)
            {
                if (groupMenu.MenuIsEnable && groupMenu.MenuIsCategory)
                {
                    SuperWebTreeNode groupTreeNode = new SuperWebTreeNode(SYSTEMMENU_MIN_DEPTH, SYSTEMMENU_MAX_DEPTH, 0);
                    groupTreeNode.Checked      = false;
                    groupTreeNode.SelectAction = TreeNodeSelectAction.None;
                    groupTreeNode.Text         = groupMenu.MenuName;
                    groupTreeNode.ImageUrl     = groupImageUrl;
                    groupTreeNode.Value        = groupMenu.MenuID.ToString();
                    baseTreeNode.ChildNodes.Add(groupTreeNode);
                    foreach (SystemMenu itemMenu in listmenu)
                    {
                        if (itemMenu.MenuIsEnable && !itemMenu.MenuIsCategory && itemMenu.ParentMenuID == groupMenu)
                        {
                            SuperWebTreeNode itemTreeNode = new SuperWebTreeNode(SYSTEMMENU_MIN_DEPTH, SYSTEMMENU_MAX_DEPTH, 0);
                            itemTreeNode.Checked      = false;
                            itemTreeNode.SelectAction = TreeNodeSelectAction.None;
                            itemTreeNode.Text         = itemMenu.MenuName;
                            itemTreeNode.ImageUrl     = itemImageUrl;
                            itemTreeNode.Value        = itemMenu.MenuID.ToString();
                            groupTreeNode.ChildNodes.Add(itemTreeNode);
                        }
                    }
                }
            }

            return(baseTreeNode);
        }
        public TreeNode GenerateSelectAssignedWebTreeNodeByApplication(SystemApplication app, string rootImageUrl, string groupImageUrl, string itemImageUrl)
        {
            SuperWebTreeNode baseTreeNode = new SuperWebTreeNode(SYSTEMMENU_MIN_DEPTH, SYSTEMMENU_MAX_DEPTH, 0);
            baseTreeNode.ShowCheckBox = false;
            baseTreeNode.SelectAction = TreeNodeSelectAction.None;
            baseTreeNode.Text = app.SystemApplicationName;
            baseTreeNode.Value = "0";
            baseTreeNode.ImageUrl = rootImageUrl;


            List<SystemMenu> listmenu =
            this.SelfDao.GetMenuByApplication(app);

            foreach (SystemMenu groupMenu in listmenu)
            {
                if (groupMenu.MenuIsEnable && groupMenu.MenuIsCategory)
                {
                    SuperWebTreeNode groupTreeNode = new SuperWebTreeNode(SYSTEMMENU_MIN_DEPTH, SYSTEMMENU_MAX_DEPTH, 0);
                    groupTreeNode.Checked = false;
                    groupTreeNode.SelectAction = TreeNodeSelectAction.None;
                    groupTreeNode.Text = groupMenu.MenuName;
                    groupTreeNode.ImageUrl = groupImageUrl;
                    groupTreeNode.Value = groupMenu.MenuID.ToString();
                    baseTreeNode.ChildNodes.Add(groupTreeNode);
                    foreach (SystemMenu itemMenu in listmenu)
                    {
                        if (itemMenu.MenuIsEnable && !itemMenu.MenuIsCategory && itemMenu.ParentMenuID == groupMenu)
                        {
                            SuperWebTreeNode itemTreeNode = new SuperWebTreeNode(SYSTEMMENU_MIN_DEPTH, SYSTEMMENU_MAX_DEPTH, 0);
                            itemTreeNode.Checked = false;
                            itemTreeNode.SelectAction = TreeNodeSelectAction.None;
                            itemTreeNode.Text = itemMenu.MenuName;
                            itemTreeNode.ImageUrl = itemImageUrl;
                            itemTreeNode.Value = itemMenu.MenuID.ToString();
                            groupTreeNode.ChildNodes.Add(itemTreeNode);
                        }
                    }
                }
            }

            return baseTreeNode;
        }
        /// <summary>
        /// 工具--记事本
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Tsmi_Notepad_Click(object sender, EventArgs e)
        {
            //启动记事本
            var proNotepad = SystemApplication.Open("notepad.exe");

            if (proNotepad == null)
            {
                MessageBox.Show("启动失败");
                return;
            }

            //调用API,传递数据
            while (proNotepad.MainWindowHandle == IntPtr.Zero)
            {
                proNotepad.Refresh();
            }
            IntPtr vHandle = API.FindWindowEx(proNotepad.MainWindowHandle, IntPtr.Zero, "Edit", null);

            //传递数据给记事本
            API.SendMessage(vHandle, Const.WM_SETTEXT, 0, "");
        }
Exemple #20
0
        /// <summary>
        /// 获取指定应用程序下指定菜单的子菜单最大序号
        /// </summary>
        /// <param name="app">应用程序</param>
        /// <param name="parentMenu">父菜单</param>
        /// <returns>子菜单最大序号</returns>
        public int GetMaxOrderByApplicationAndParentMenu(SystemApplication app, SystemMenu parentMenu)
        {
            DetachedCriteria menuCriteria = DetachedCriteria.For(typeof(SystemMenu));

            if (app == null)
            {
                menuCriteria.Add(SystemMenuDao.PROPERTY_APPLICATIONID.IsNull());
            }
            else
            {
                menuCriteria.Add(SystemMenuDao.PROPERTY_APPLICATIONID.Eq(app));
            }

            if (parentMenu == null)
            {
                menuCriteria.Add(SystemMenuDao.PROPERTY_PARENTMENUID.IsNull());
            }
            else
            {
                menuCriteria.Add(SystemMenuDao.PROPERTY_PARENTMENUID.Eq(parentMenu));
            }
            menuCriteria.SetProjection(SystemMenuDao.PROPERTY_MENUORDER.Max());

            using (ISession session = this.GetSession())
            {
                object result = menuCriteria.GetExecutableCriteria(session).SetMaxResults(1).UniqueResult();

                if (result == null)
                {
                    return(0);
                }
                else
                {
                    return((int)result);
                }
            }
        }
 public void SystemApplication_AddActivityAllocationWithoutSystemApplicationId_Exception()
 {
     var invalidSystemApplication = new SystemApplication { Id = null };
     invalidSystemApplication.GetActivities(Repository);
 }
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public SystemRoleApplicationBase()
		{
			_systemroleapplication_id = 0; 
			_role_id =  null; 
			_application_id =  null; 
		}
        public override void Initialize(string name, NameValueCollection config)
        {

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (string.IsNullOrEmpty(name))
            {
                name = "NHibernateMembershipProvider";
            }
            if (string.IsNullOrEmpty(config["description"]))
            {
                config.Remove("description");
                config.Add("description", "NHibernate Membership Provider");
            }
            base.Initialize(name, config);
            application =
                this.ServicesContainerInstance.SystemApplicationServiceInstance.CreateOrLoadApplication(
                    ConfigurationUtil.GetConfigValue(config["applicationName"],
                                                     HostingEnvironment.ApplicationVirtualPath));
            requiresQuestionAndAnswer =
                Convert.ToBoolean(ConfigurationUtil.GetConfigValue(config["requiresQuestionAndAnswer"], "False"));
            requiresUniqueEmail =
                Convert.ToBoolean(ConfigurationUtil.GetConfigValue(config["requiresUniqueEmail"], "True"));
            enablePasswordRetrieval =
                Convert.ToBoolean(ConfigurationUtil.GetConfigValue(config["enablePasswordRetrieval"], "True"));
            enablePasswordReset =
                Convert.ToBoolean(ConfigurationUtil.GetConfigValue(config["enablePasswordReset"], "True"));
            maxInvalidPasswordAttempts =
                Convert.ToInt32(ConfigurationUtil.GetConfigValue(config["maxInvalidPasswordAttempts"], "5"));
            passwordAttemptWindow =
                Convert.ToInt32(ConfigurationUtil.GetConfigValue(config["passwordAttemptWindow"], "10"));
            minRequiredPasswordLength =
                Convert.ToInt32(ConfigurationUtil.GetConfigValue(config["minRequiredPasswordLength"], "7"));
            minRequiredNonAlphanumericCharacters =
                Convert.ToInt32(ConfigurationUtil.GetConfigValue(config["minRequiredAlphaNumericCharacters"], "1"));
            passwordStrengthRegularExpression =
                Convert.ToString(ConfigurationUtil.GetConfigValue(config["passwordStrengthRegularExpression"],
                                                                  string.Empty));
            string configValue = ConfigurationUtil.GetConfigValue(config["passwordFormat"], "Hashed");
            if (configValue != null)
            {
                if (!(configValue == "Hashed"))
                {
                    if (configValue == "Encrypted")
                    {
                        passwordFormat = MembershipPasswordFormat.Encrypted;
                        goto Label_01FB;
                    }
                    if (configValue == "Clear")
                    {
                        passwordFormat = MembershipPasswordFormat.Clear;
                        goto Label_01FB;
                    }
                }
                else
                {
                    passwordFormat = MembershipPasswordFormat.Hashed;
                    goto Label_01FB;
                }
            }
            throw NhibernateMembershipProviderExceptionUtil.NewProviderException(this, "password format not supported");
        Label_01FB:
            System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration(HostingEnvironment.ApplicationVirtualPath);
            machineKey = (MachineKeySection)configuration.GetSection("system.web/machineKey");
            if ("Auto".Equals(machineKey.Decryption))
            {
                machineKey.DecryptionKey = CryptographyUtil.CreateKey(0x18);
                machineKey.ValidationKey = CryptographyUtil.CreateKey(0x40);
            }
        }
 public override void Initialize(string name, NameValueCollection config)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     if (string.IsNullOrEmpty(name))
     {
         name = "NHibernateRoleProvider";
     }
     if (string.IsNullOrEmpty(config["description"]))
     {
         config.Remove("description");
         config.Add("description", "NHibernate Role Provider");
     }
     base.Initialize(name, config);
     application =
         this.ServicesContainerInstance.SystemApplicationServiceInstance.CreateOrLoadApplication(
             ConfigurationUtil.GetConfigValue(config["applicationName"],
                                              HostingEnvironment.ApplicationVirtualPath));
 }