当前位置: 首页>>代码示例>>C#>>正文


C# WhereSqlClauseBuilder类代码示例

本文整理汇总了C#中WhereSqlClauseBuilder的典型用法代码示例。如果您正苦于以下问题:C# WhereSqlClauseBuilder类的具体用法?C# WhereSqlClauseBuilder怎么用?C# WhereSqlClauseBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WhereSqlClauseBuilder类属于命名空间,在下文中一共展示了WhereSqlClauseBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: QueryParents

		public static IEnumerable<SCSimpleObject> QueryParents(string unitID, bool includingSelf, DateTime timePoint)
		{
			if (string.IsNullOrEmpty(unitID) == false)
			{
				string timeString = timePoint == DateTime.MinValue ? TSqlBuilder.Instance.DBCurrentTimeFunction : TSqlBuilder.Instance.FormatDateTime(timePoint);

				WhereSqlClauseBuilder where = new WhereSqlClauseBuilder().AppendCondition("ID", unitID);

				string sql = string.Format(sqlTemplate, timeString, where.ToSqlString(TSqlBuilder.Instance));

				DataTable table = DbHelper.RunSqlReturnDS(sql, ConnectionName).Tables[0];
				DataView view = new DataView(table);
				view.Sort = "ID";

				SCSimpleObjectCollection tempParents = new SCSimpleObjectCollection();

				FillAllParents(unitID, view, includingSelf, tempParents);

				tempParents.Reverse();

				return tempParents;
			}
			else
			{
				return emptyResult;
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:27,代码来源:AURecursiveDataSource.cs

示例2: SchemaStrict

 private static ConnectiveSqlClauseCollection SchemaStrict(ConnectiveSqlClauseCollection c, string prefix, PC.StandardObjectSchemaType schema)
 {
     WhereSqlClauseBuilder where = new WhereSqlClauseBuilder();
     where.AppendItem(prefix + "SchemaType", schema);
     c.Add(where);
     return c;
 }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:7,代码来源:OguObjectGenerator1.cs

示例3: Query

		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);
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:28,代码来源:CagetoryDataSource.cs

示例4: BindDataGrid

		private void BindDataGrid()
		{
			WhereSqlClauseBuilder builder = ConditionMapping.GetWhereSqlClauseBuilder(this.UserUploadCondition);

			if (this.processUsers.ReadOnly)
			{
				this.ObjectDataSourceUploadLogs.Condition = builder;
			}
			else
			{
				ConnectiveSqlClauseCollection collection = new ConnectiveSqlClauseCollection(LogicOperatorDefine.And);
				collection.Add(builder);

				WhereSqlClauseBuilder userwherebuilder = new WhereSqlClauseBuilder();
				userwherebuilder.LogicOperator = LogicOperatorDefine.Or;
				foreach (var item in this.processUsers.SelectedOuUserData)
				{
					userwherebuilder.AppendItem("OPERATOR_ID", item.ID);
				}
				collection.Add(userwherebuilder);

				this.ObjectDataSourceUploadLogs.Condition = collection.ToSqlString(TSqlBuilder.Instance);
			}
			this.ObjectDataSourceUploadLogs.LastQueryRowCount = -1;

			this.DeluxeGridUploadLog.PageIndex = 0;
			this.DeluxeGridUploadLog.SelectedKeys.Clear();
			this.DeluxeGridUploadLog.DataBind();
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:29,代码来源:UserUploadFileHistory.aspx.cs

示例5: OnBuildQueryCondition

		protected override void OnBuildQueryCondition(QueryCondition qc)
		{
			qc.FromClause = "SC.OperationLog";
			qc.SelectFields = "*";
			if (string.IsNullOrEmpty(qc.OrderByClause))
				qc.OrderByClause = "CreateTime DESC";

			WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

			if (this.catelog.IsNotEmpty())
			{
				builder.AppendItem("SchemaType", this.catelog);
			}

			if (this.operationType.IsNotEmpty())
			{
				builder.AppendItem("OperationType", operationType);
			}

			if (builder.IsEmpty == false && qc.WhereClause.IsNotEmpty())
			{
				qc.WhereClause += " AND ";
			}

			qc.WhereClause += builder.ToSqlString(TSqlBuilder.Instance);
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:26,代码来源:SchemaLogDataSource.cs

示例6: LoadCurrentUsers

		public SchemaObjectCollection LoadCurrentUsers(string ownerID)
		{
			ownerID.CheckStringIsNullOrEmpty("ownerID");

			var timePointBuilder = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder(DateTime.MinValue);

			WhereSqlClauseBuilder whereBuilder = new WhereSqlClauseBuilder();

			whereBuilder.AppendItem("C.OwnerID", ownerID);

			timePointBuilder.Add(whereBuilder);

			string sql = string.Format(
				"SELECT SC.* FROM {0} SC INNER JOIN SC.ConditionCalculateResult C ON SC.ID = C.UserID WHERE {1}",
				ORMapping.GetMappingInfo(typeof(SchemaObjectBase)).TableName, timePointBuilder.ToSqlString(TSqlBuilder.Instance));

			SchemaObjectCollection result = new SchemaObjectCollection();

			using (DbContext context = DbContext.GetContext(this.GetConnectionName()))
			{
				result.LoadFromDataView(DbHelper.RunSqlReturnDS(sql, this.GetConnectionName()).Tables[0].DefaultView);
			}

			return result;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:25,代码来源:ConditionCalculateResultAdapter.cs

示例7: GetConditionHistoryEntries

		/// <summary>
		/// 获取与指定对象关联的条件历史
		/// </summary>
		/// <param name="id">对象ID</param>
		/// <param name="type">类型,如果为<see langword="null"/>则不限。</param>
		/// <returns></returns>
		public IEnumerable<SCCondition> GetConditionHistoryEntries(string id, string type)
		{
			SCConditionCollection entries = new SCConditionCollection();
			using (var context = DbHelper.GetDBContext(this.GetConnectionName()))
			{
				Database db = DatabaseFactory.Create(context);

				WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
				builder.AppendItem("OwnerID", id);

				if (type != null)
				{
					builder.AppendItem("Type", type);
				}

				var sql = @"SELECT *  FROM [SC].[Conditions] WHERE " + builder.ToSqlString(TSqlBuilder.Instance) + " ORDER BY [VersionEndTime] DESC, SortID ASC";
				var cmd = db.GetSqlStringCommand(sql);
				using (var dr = db.ExecuteReader(cmd))
				{
					ORMapping.DataReaderToCollection(entries, dr);
				}

				return entries;
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:31,代码来源:HistoryAdapter.cs

示例8: OnBuildQueryCondition

		protected override void OnBuildQueryCondition(QueryCondition qc)
		{
			base.OnBuildQueryCondition(qc);
			qc.SelectFields = "*";
			qc.FromClause = TimePointContext.Current.UseCurrentTime ? "SC.AUAdminScopeItemSnapshot_Current" : "SC.AUAdminScopeItemSnapshot";

			if (string.IsNullOrEmpty(qc.OrderByClause))
				qc.OrderByClause = "AUScopeItemName ASC";

			WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
			builder.AppendCondition("SchemaType", this.scopeType).NormalFor("Status");
			var timeBuilder = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder();

			var allCondition = new ConnectiveSqlClauseCollection(builder, timeBuilder).ToSqlString(TSqlBuilder.Instance);

			if (string.IsNullOrEmpty(qc.WhereClause))
			{
				qc.WhereClause = allCondition;
			}
			else
			{
				qc.WhereClause = qc.WhereClause + "AND (" + allCondition + ")";
			}

		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:25,代码来源:AdminScopeItemDataSource.cs

示例9: BuildCondition

		private void BuildCondition(QueryCondition qc)
		{
			WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
			if (this.deepOption == 1)
			{
				builder.AppendCondition("C.ContainerID", this.scope.ID);
			}
			else
			{
				if (deepOption == 2)
				{
					builder.AppendItem("C.ContainerID", this.scope.ID, "<>");
				}
			}
			builder.NormalFor("C.Status").NormalFor("S.Status").NormalFor("SM.Status").NormalFor("AUS.Status");
			var timeBulder1 = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder("C.");
			var timeBulder2 = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder("S.");
			var time3 = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder("AUS.");
			var time4 = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder("SM.");

			var conditionClause = new ConnectiveSqlClauseCollection(builder, timeBulder1, timeBulder2, time3, time4).ToSqlString(TSqlBuilder.Instance);

			if (string.IsNullOrEmpty(qc.WhereClause) == false)
				qc.WhereClause += " AND (" + conditionClause + ")";
			else
				qc.WhereClause = conditionClause;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:27,代码来源:AUAdminScopeFullMemberDataSource.cs

示例10: QueryApplications

        public SchemaObjectCollection QueryApplications(string[] schemaTypes, bool includingDeleted, DateTime timePoint)
        {
            SchemaObjectCollection result = new SchemaObjectCollection();

            ConnectiveSqlClauseCollection timeConditionC = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder(timePoint, "SC.");

            InSqlClauseBuilder schemaBuilder = new InSqlClauseBuilder("SC.SchemaType");

            schemaBuilder.AppendItem(schemaTypes);

            WhereSqlClauseBuilder builderC = new WhereSqlClauseBuilder();

            if (includingDeleted == false)
                builderC.AppendItem("SC.Status", (int)SchemaObjectStatus.Normal);

            ConnectiveSqlClauseCollection connectiveBuilder = new ConnectiveSqlClauseCollection(schemaBuilder, builderC, timeConditionC);

            string sql = string.Format("SELECT SC.*" +
                "\nFROM SC.SchemaObject SC" +
                "\nWHERE {0}", connectiveBuilder.ToSqlString(TSqlBuilder.Instance));

            DataTable table = DbHelper.RunSqlReturnDS(sql, this.GetConnectionName()).Tables[0];

            result.LoadFromDataView(table.DefaultView);

            return result;
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:27,代码来源:SCSnapshotAdapter_Permission.cs

示例11: OnBuildQueryCondition

		protected override void OnBuildQueryCondition(QueryCondition qc)
		{
			qc.FromClause = TimePointContext.Current.UseCurrentTime ? "SC.SchemaUserSnapshot_Current O INNER JOIN SC.UserAndContainerSnapshot_Current R ON O.ID = R.UserID" : "SC.SchemaUserSnapshot O INNER JOIN SC.UserAndContainerSnapshot R ON O.ID = R.UserID";
			qc.SelectFields = "O.*";
			if (string.IsNullOrEmpty(this.orderBy))
				qc.OrderByClause = "R.VersionStartTime DESC";
			else
				qc.OrderByClause = orderBy;
			base.OnBuildQueryCondition(qc);

			WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();

			var timeCondition1 = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder("R.");
			var timeCondition2 = VersionStrategyQuerySqlBuilder.Instance.TimePointToBuilder("O.");

			builder.AppendItem("R.ContainerID", this.containerId);
			InnerBuildWhere(builder);

			builder.AppendItem("O.Status", (int)SchemaObjectStatus.Normal);
			builder.AppendItem("R.Status", (int)SchemaObjectStatus.Normal);

			var allConditions = new ConnectiveSqlClauseCollection(timeCondition1, timeCondition2, builder);

			if (string.IsNullOrEmpty(qc.WhereClause))
			{
				qc.WhereClause = allConditions.ToSqlString(TSqlBuilder.Instance);
			}
			else
			{
				qc.WhereClause = allConditions.ToSqlString(TSqlBuilder.Instance) + " AND (" + qc.WhereClause + ")";
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:32,代码来源:ConditionalUsersDataSource.cs

示例12: CalculatePayMonthInfo

 //计算薪资
 public Int32 CalculatePayMonthInfo(String yearMonth)
 {
     int result = 0;
     WhereSqlClauseBuilder builder = new WhereSqlClauseBuilder();
     builder.AppendItem(FeeMonthInfoDBConst.YearMonth, yearMonth);
     builder.AppendItem(FeeMonthInfoDBConst.UseFlag, Status.True.ToString("D"));
     builder.AppendItem(FeeMonthInfoDBConst.FeeType, FeeType.Parameter.ToString("D"), "<>");
     builder.AppendItem(FeeMonthInfoDBConst.FeeType, FeeType.Tax.ToString("D"), "<>");
     builder.AppendItem(String.Concat("ISNULL(",FeeMonthInfoDBConst.CalculateExp,",'')<>''"));
     List<FeeInfo> feeList = FeeInfoAdapter.Instance.GetFeeInfoList(yearMonth, builder);
     foreach (FeeMonthInfo feeMonthInfo in feeList.Where(fe => !String.IsNullOrEmpty(fe.CalculateExp)))
     {
         String caculateExp = FeeInfoAdapter.Instance.ConvertExp(yearMonth, feeMonthInfo.CalculateExp);
         //if (feeMonthInfo.FeeType.Equals(FeeType.Tax))
         //{
         //    caculateExp = "ISNULL(DBO.CACULATETAX(''" + yearMonth + "'',''" + FeeInfoAdapter.Instance.GetTaxFeeID(yearMonth, feeMonthInfo.FeeID) + "''," + FeeInfoAdapter.Instance.ConvertExp(yearMonth, FeeInfoAdapter.Instance.GetTaxFeeCalculateExp(yearMonth, feeMonthInfo.FeeID)) + "),0)";
         //}
         //else
         //{
         //    caculateExp = FeeInfoAdapter.Instance.ConvertExp(yearMonth, feeMonthInfo.CalculateExp);
         //}
         String sql = String.Format(@"DECLARE @SQL VARCHAR(8000)
                                     SELECT @SQL=ISNULL(@SQL + '],[','') + Convert(nvarchar(32),FEE_ID) FROM FEE_MONTH F WHERE (F.FEE_TYPE={5} OR F.FEE_TYPE={6}) AND ISNULL(CALCULATE_EXP,'')='' AND YEAR_MONTH={0}
                                     EXEC ('INSERT INTO PAY_MONTH(YEAR_MONTH,PERSON_ID,PERSON_NAME,FEE_ID,FEE_NAME,FEE_VALUE,PAY_MONEY,FORMULA)
                                     SELECT ''{0}'' AS ''YEAR_MONTH'', PERSON_ID, PERSON_NAME, ''{1}'' AS ''FEE_ID'', ''{2}'' AS ''FEE_NAME'', {3} AS ''FEE_VALUE'', {3} AS ''PAY_MONEY'',''{4}'' AS ''FORMULA''
                                     FROM (SELECT PERSON_ID, PERSON_NAME, FEE_ID,PAY_MONEY FROM PAY_MONTH WHERE YEAR_MONTH=''{0}'')P PIVOT(MAX(PAY_MONEY) FOR FEE_ID IN ([' + @SQL + ']))B') "
             , yearMonth, feeMonthInfo.FeeID, feeMonthInfo.FeeName, caculateExp, caculateExp.Replace("'", ""), FeeType.Common.ToString("D"), FeeType.Parameter.ToString("D"));
         result += _DataHelper.ExecuteSql(sql);
     }
     return result;
 }
开发者ID:notinmood,项目名称:HilandCompany,代码行数:32,代码来源:PayMonthInfoAdapter.cs

示例13: dataSourceMain_Selecting

		protected void dataSourceMain_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
		{
			WhereSqlClauseBuilder where = new WhereSqlClauseBuilder();
			where.AppendItem("TASK_GUID", Request.QueryString["id"]);

			dataSourceMain.Condition = where;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:7,代码来源:TaskPendingDetail.aspx.cs

示例14: GetReferenceHistoryEntries

		public IEnumerable<ReferenceHistoryEntry> GetReferenceHistoryEntries(string objId)
		{
			ReferenceHistoryEntryCollection list = new ReferenceHistoryEntryCollection();

			WhereSqlClauseBuilder where1 = new WhereSqlClauseBuilder();
			where1.AppendItem("R.ObjectID", objId);

			WhereSqlClauseBuilder where2 = new WhereSqlClauseBuilder();
			where2.AppendItem("R.ParentID", objId);

			var sql = string.Format(@"SELECT R.[ParentID], R.[ObjectID], R.[VersionStartTime], R.[VersionEndTime], R.[Status], R.[IsDefault], R.[InnerSort], R.[CreatorID], R.[CreatorName],O.Name, O.DisplayName
FROM [SC].[SchemaRelationObjectsSnapshot] R LEFT JOIN SC.SchemaObjectSnapshot_Current O ON R.ParentID = O.ID
WHERE O.VersionStartTime <=R.VersionStartTime AND (O.VersionEndTime IS NULL OR O.VersionEndTime>=R.VersionEndTime) AND {0}
UNION
SELECT R.[ParentID], R.[ObjectID], R.[VersionStartTime], R.[VersionEndTime], R.[Status], R.[IsDefault], R.[InnerSort], R.[CreatorID], R.[CreatorName],O.Name, O.DisplayName
FROM [SC].[SchemaRelationObjectsSnapshot] R LEFT JOIN SC.SchemaObjectSnapshot_Current O ON R.ObjectID = O.ID
WHERE O.VersionStartTime <=R.VersionStartTime AND (O.VersionEndTime IS NULL OR O.VersionEndTime>=R.VersionEndTime) AND {1} ORDER BY VersionStartTime ASC
", where1.ToSqlString(TSqlBuilder.Instance), where2.ToSqlString(TSqlBuilder.Instance));

			using (var context = DbHelper.GetDBContext(this.GetConnectionName()))
			{
				Database db = DatabaseFactory.Create(context);

				var cmd = db.GetSqlStringCommand(sql);
				using (var dr = db.ExecuteReader(cmd))
				{
					ORMapping.DataReaderToCollection(list, dr);
				}
			}

			return list;
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:32,代码来源:HistoryAdapter.cs

示例15: OnBuildQueryCondition

		protected override void OnBuildQueryCondition(QueryCondition qc)
		{
			qc.FromClause = TimePointContext.Current.UseCurrentTime ? @"SC.UserAndContainerSnapshot_Current C 
INNER JOIN SC.SchemaUserSnapshot_Current U ON U.ID =C.UserID
INNER JOIN SC.SchemaRoleSnapshot_Current R ON R.ID = C.ContainerID 
INNER JOIN SC.SchemaMembersSnapshot_Current S ON S.MemberID = R.ID
INNER JOIN  SC.SchemaApplicationSnapshot_Current A ON A.ID = S.ContainerID" : @"SC.UserAndContainerSnapshot C 
INNER JOIN SC.SchemaUserSnapshot U ON U.ID =C.UserID
INNER JOIN SC.SchemaRoleSnapshot R ON R.ID = C.ContainerID 
INNER JOIN SC.SchemaMembersSnapshot S ON S.MemberID = R.ID
INNER JOIN  SC.SchemaApplicationSnapshot A ON A.ID = S.ContainerID";
			qc.SelectFields = "R.*, A.ID AS  AppID,A.DisplayName AS AppName,A.Name As AppName2,A.CodeName as AppCodeName";
			base.OnBuildQueryCondition(qc);
			WhereSqlClauseBuilder wb = new WhereSqlClauseBuilder();
			wb.AppendItem("C.UserID", this.userId);
			if (string.IsNullOrWhiteSpace(orderBy))
			{
				qc.OrderByClause = "A.DisplayName";
			}
			else
			{
				qc.OrderByClause = orderBy;
			}
			if (string.IsNullOrWhiteSpace(qc.WhereClause))
			{
				qc.WhereClause = wb.ToSqlString(TSqlBuilder.Instance);
			}
			else
			{
				qc.WhereClause = wb.ToSqlString(TSqlBuilder.Instance) + " AND (" + qc.WhereClause + ")";
			}
		}
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:32,代码来源:SchemaUserRoleDataSource.cs


注:本文中的WhereSqlClauseBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。