Esempio n. 1
0
        private void GetQueryData(LibQueryCondition condition)
        {
            string conditionStr = string.Empty;

            if (condition != null && condition.QueryFields.Count != 0)
            {
                conditionStr = LibQueryConditionParser.GetQueryData(this.ProgId, condition);
            }
            //else
            //{  //当用户不选择查询条件的时候,使用默认的过滤条件
            //    conditionStr = GetFilterCondition();
            //}
            string powerStr = LibPermissionControl.Default.GetShowCondition(this.Handle, this.ProgId, this.Handle.PersonId);

            if (!string.IsNullOrEmpty(powerStr))
            {
                conditionStr = LibStringBuilder.JoinStringList(new List <string> {
                    conditionStr, powerStr
                }, "and");
            }
            if (string.IsNullOrEmpty(conditionStr))
            {
                if (condition != null)
                {
                    DataSetManager.GetDataSet(this.DataSet, this.DataAccess, this.ProgId);
                }
            }
            else
            {
                SqlBuilder    sqlBuilder = new SqlBuilder(this.ProgId);
                List <string> sqlList    = new List <string>();
                LibDataAccess dataAccess = new LibDataAccess();
                for (int i = 0; i < this.DataSet.Tables.Count; i++)
                {
                    string sql = sqlBuilder.GetQuerySql(0, string.Format("{0}.*", (char)(i + (int)'A')), conditionStr);
                    dataAccess.ExecuteDataTable(sql, this.DataSet.Tables[i]);
                }
            }
        }