public DataView Query(int startRowIndex, int maximumRows, string appName, string programName, WfApplicationAuthType authType, string where, string orderBy, ref int totalCount)
		{
			WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

			if (string.IsNullOrEmpty(appName) == false)
			{
				builder.AppendItem("APPLICATION_NAME", appName);

				if (string.IsNullOrEmpty(programName) == false)
				{
					builder.AppendItem("PROGRAM_NAME", programName);
				}
			}

			if (authType != WfApplicationAuthType.None)
			{
				builder.AppendItem("AUTH_TYPE", authType.ToString());
			}

			string sql = builder.ToSqlString(TSqlBuilder.Instance);

			if (string.IsNullOrEmpty(where) == false)
			{
				sql = (string.IsNullOrEmpty(sql) ? where : sql + " AND (" + where + ")");
			}

			return base.Query(startRowIndex, maximumRows, sql, orderBy, ref totalCount);
		}
Example #2
0
        protected void HandleDelete(object sender, EventArgs e)
        {
            if (this.SupervisiorMode)
            {
                LinkButton lb = sender as LinkButton;
                if (lb != null)
                {
                    string appName             = lb.Attributes["data-appname"];
                    string pgname              = lb.Attributes["data-pgname"];
                    WfApplicationAuthType type = (WfApplicationAuthType)Enum.Parse(typeof(WfApplicationAuthType), lb.Attributes["data-type"]);

                    using (System.Transactions.TransactionScope scope = TransactionScopeFactory.Create())
                    {
                        WfApplicationAuth auth = WfApplicationAuthAdapter.Instance.Load(appName, pgname, type);
                        if (auth != null)
                        {
                            WfApplicationAuthAdapter.Instance.Delete(auth);
                        }

                        scope.Complete();
                    }
                }
            }
            else
            {
                WebUtility.ShowClientError("只有管理员可以进行删除", "", "失败");
            }

            this.InnerRefreshList();
        }
        public WfApplicationAuthCollection Load(string appName, WfApplicationAuthType authType)
        {
            appName.CheckStringIsNullOrEmpty("appName");

            return(WfApplicationAuthAdapter.Instance.Load(builder =>
            {
                builder.AppendItem("APPLICATION_NAME", appName).AppendItem("AUTH_TYPE", authType.ToString());
            }));
        }
        public WfApplicationAuth Load(string appName, string progName, WfApplicationAuthType authType)
        {
            appName.CheckStringIsNullOrEmpty("appName");
            progName.CheckStringIsNullOrEmpty("progName");

            return(WfApplicationAuthAdapter.Instance.Load(builder =>
            {
                builder.AppendItem("APPLICATION_NAME", appName);
                builder.AppendItem("PROGRAM_NAME", progName);
                builder.AppendItem("AUTH_TYPE", authType.ToString());
            }).FirstOrDefault());
        }
        /// <summary>
        /// 是否包含某一应用下的某一类权限
        /// </summary>
        /// <param name="appName"></param>
        /// <param name="progName"></param>
        /// <returns></returns>
        public bool Contains(string appName, string progName, WfApplicationAuthType authType)
        {
            bool result = false;

            foreach (WfApplicationAuth authData in this)
            {
                if (string.Compare(appName, authData.ApplicationName, true) == 0 &&
                    string.Compare(progName, authData.ProgramName, true) == 0 &&
                    authData.AuthType == authType)
                {
                    result = true;
                    break;
                }
            }

            return(result);
        }
Example #6
0
        protected void ServerChangeRole(object sender, EventArgs e)
        {
            if (this.SupervisiorMode)
            {
                string appName             = postAppName.Value;
                string pgName              = postProgram.Value;
                WfApplicationAuthType type = (WfApplicationAuthType)Enum.Parse(typeof(WfApplicationAuthType), postType.Value);

                string roleId = postRole.Value;

                var auth = WfApplicationAuthAdapter.Instance.Load(appName, pgName, type);

                if (auth != null)
                {
                    auth.RoleID          = roleId;
                    auth.RoleDescription = postRoleName.Value;
                    WfApplicationAuthAdapter.Instance.Update(auth);
                }
            }

            this.InnerRefreshList();
        }
Example #7
0
 public int GetQueryCount(string appName, string programName, WfApplicationAuthType authType, string where, ref int totalCount)
 {
     return((int)ObjectContextCache.Instance[ContextCacheKey]);
 }
Example #8
0
        public DataView Query(int startRowIndex, int maximumRows, string appName, string programName, WfApplicationAuthType authType, string where, string orderBy, ref int totalCount)
        {
            WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

            if (string.IsNullOrEmpty(appName) == false)
            {
                builder.AppendItem("APPLICATION_NAME", appName);

                if (string.IsNullOrEmpty(programName) == false)
                {
                    builder.AppendItem("PROGRAM_NAME", programName);
                }
            }

            if (authType != WfApplicationAuthType.None)
            {
                builder.AppendItem("AUTH_TYPE", authType.ToString());
            }

            string sql = builder.ToSqlString(TSqlBuilder.Instance);

            if (string.IsNullOrEmpty(where) == false)
            {
                sql = (string.IsNullOrEmpty(sql) ? where : sql + " AND (" + where + ")");
            }

            return(base.Query(startRowIndex, maximumRows, sql, orderBy, ref totalCount));
        }
		public int GetQueryCount(string appName, string programName, WfApplicationAuthType authType, string where, ref int totalCount)
		{
			return (int)ObjectContextCache.Instance[ContextCacheKey];
		}