public static void ToSql(Exists expression, StringBuilder builder) { if (null == expression) { throw new ArgumentNullException("expression"); } if (null == builder) { throw new ArgumentNullException("builder"); } if (expression.Operands.Count > 0) { IToken operand = expression.Operands.First(); if (operand is ViewToken) { builder.Append(" exists ("); ViewToken viewToken = operand as ViewToken; View view = viewToken.ViewsManager.Views[viewToken.ViewName]; view.ToSql(builder, true); builder.Append(")"); } else { operand.ToSql(builder); builder.Append(" IS NOT NULL AND "); operand.ToSql(builder); builder.Append(" <> ''''"); } } }
public void TestExists() { var classicWay = Exists.InTable("table").Where("1", Is.DifferentWith, "1"); var dbalWay = new Table("table", "colA", "colB").Exists().Where("1", Is.DifferentWith, "1"); Assert.AreEqual(classicWay.Sql, dbalWay.Sql); }
public void CreateAndDelete() { ResetHostingDir(); using var stream = _imageFile.OpenStream(); var key = _host.Add(stream, new ImageOptions() { ImageEditor = ImageEditors.MaxSize(new Size(500, 500), Color.White), }); _host.AddSize(key, "thumbnail", new ImageOptions() { ImageEditor = ImageEditors.MaxSize(new Size(150, 150), Color.White), }); var imagePath = _host.GetAbsoluteImagePath(key); imagePath.Exists.ShouldBeTrue(); var thumbnailPath = _host.GetAbsoluteImagePath(key, "thumbnail"); imagePath.Exists.ShouldBeTrue(); _host.Delete(key.Id); imagePath.Exists.ShouldBeFalse(); thumbnailPath.Exists.ShouldBeFalse(); imagePath.ParentDirectory.Exists.ShouldBeFalse(); imagePath.ParentDirectory.ParentDirectory !.Exists.ShouldBeFalse(); imagePath.ParentDirectory.ParentDirectory !.ParentDirectory !.Exists.ShouldBeTrue(); }
public void ExistsTest1() { int[] ints = { -9, 14, 37, 102 }; const int num = 102; Assert.IsTrue(Exists.Answer(ints, num)); }
public void ExistsTest2() { int[] ints = { -9, 14, 37, 102 }; const int num = 36; Assert.IsFalse(Exists.Answer(ints, num)); }
/// <summary> /// Adds the user to the Database /// </summary> /// <param name="user">The new user to be added</param> /// <returns> /// 0. Ok /// 1. Username Exists /// 2. Error connecting DB /// </returns> public int AddUser(Users user) { IQueryable <Users> Exists; try { try //Trying to establish connection with the DB { _Db.Database.Migrate(); Exists = _Db.Users.Where(a => a.Username == user.Username); //Creating a query on users table for finding the username } catch (Exception e) //returns 2 if the DB connection has issues { return(2); } Users UserExisting = Exists.First(); //Finding a user with the same username return(1); //If found user with the same username, send 1 } catch (Exception) //If the username is unique { _Db.Users.Add(user); //Adding the username to the table _Db.SaveChanges(); //Saving changes return(0); } }
/// <summary> /// Gets the search filter instance. /// </summary> /// <param name="localName">Name of the local.</param> /// <returns></returns> private static SearchFilter GetSearchFilterInstance(string localName) { SearchFilter searchFilter; switch (localName) { case XmlElementNames.Exists: searchFilter = new Exists(); break; case XmlElementNames.Contains: searchFilter = new ContainsSubstring(); break; case XmlElementNames.Excludes: searchFilter = new ExcludesBitmask(); break; case XmlElementNames.Not: searchFilter = new Not(); break; case XmlElementNames.And: searchFilter = new SearchFilterCollection(LogicalOperator.And); break; case XmlElementNames.Or: searchFilter = new SearchFilterCollection(LogicalOperator.Or); break; case XmlElementNames.IsEqualTo: searchFilter = new IsEqualTo(); break; case XmlElementNames.IsNotEqualTo: searchFilter = new IsNotEqualTo(); break; case XmlElementNames.IsGreaterThan: searchFilter = new IsGreaterThan(); break; case XmlElementNames.IsGreaterThanOrEqualTo: searchFilter = new IsGreaterThanOrEqualTo(); break; case XmlElementNames.IsLessThan: searchFilter = new IsLessThan(); break; case XmlElementNames.IsLessThanOrEqualTo: searchFilter = new IsLessThanOrEqualTo(); break; default: searchFilter = null; break; } return(searchFilter); }
public override void Visit(CypherVisitor cypherVisitor) { cypherVisitor.Enter(this); Exists?.Visit(cypherVisitor); Condition.Visit(cypherVisitor); cypherVisitor.Leave(this); }
private async Task Test(string Unexpanded, string ExpectedResult) { this.term.Reset(":" + Unexpanded); Exists Exists = new Exists(this.term, SpfQualifier.Pass); await Exists.Expand(); Assert.AreEqual(ExpectedResult, Exists.Domain); }
public static Exists Exists(this Where where, string values) { Exists _exists = new Exists(values); _exists.SqlString = where.SqlString + _exists.ToString(); return(_exists); }
public static void GenerateBirthdayInboxMessage(DatabaseConnection dbConn, int UserID, int NoticeDaysBefore, int NoticeDaysAfter) { if (NoticeDaysBefore < 0) { NoticeDaysBefore = 30; } if (NoticeDaysAfter < 0) { NoticeDaysAfter = 30; } const string INBOX_TYPE = EInbox.INBOX_TYPE_DATE_OF_BIRTH; DBFilter DateOfBirthFilter = new DBFilter(); DateOfBirthFilter.add(AppUtils.AddRankDBTerm(UserID, "EmpID", true)); //DateOfBirthFilter.add(new Match("EmpDateOfBirth", ">=", AppUtils.ServerDateTime().Date.AddYears(-YEAR_DIFFERENT).AddDays(-NOTICEDAYSAFTER))); //DateOfBirthFilter.add(new Match("EmpDateOfBirth", "<=", AppUtils.ServerDateTime().Date.AddYears(-YEAR_DIFFERENT).AddDays(NOTICEDAYSBEFORE))); DBFilter existsInboxFilter = new DBFilter(); existsInboxFilter.add(new MatchField(EEmpPersonalInfo.db.dbclass.tableName + ".EmpID", EInbox.db.dbclass.tableName + ".EmpID")); existsInboxFilter.add(new MatchField(EEmpPersonalInfo.db.dbclass.tableName + ".EmpID", EInbox.db.dbclass.tableName + ".InboxRelatedRecID")); existsInboxFilter.add(new MatchField(EEmpPersonalInfo.db.dbclass.tableName + ".EmpDateOfBirth", EInbox.db.dbclass.tableName + ".InboxRelatedReferenceDate")); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".InboxType", INBOX_TYPE)); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".UserID", UserID)); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".InboxCreateDate", ">=", AppUtils.ServerDateTime().Date.AddDays(-(NoticeDaysBefore + NoticeDaysAfter)))); Exists existsInbox = new Exists(EInbox.db.dbclass.tableName, existsInboxFilter, true); DateOfBirthFilter.add(existsInbox); DBFilter existsEmpTerminationFilter = new DBFilter(); existsEmpTerminationFilter.add(new MatchField(EEmpPersonalInfo.db.dbclass.tableName + ".EmpID", EEmpTermination.db.dbclass.tableName + ".EmpID")); existsEmpTerminationFilter.add(new Match("EmpTermLastDate", "<=", AppUtils.ServerDateTime().Date)); Exists notExistsEmpTermination = new Exists(EEmpTermination.db.dbclass.tableName, existsEmpTerminationFilter, true); DateOfBirthFilter.add(notExistsEmpTermination); System.Collections.ArrayList empInfoList = EEmpPersonalInfo.db.select(dbConn, DateOfBirthFilter); DateTime BirthdayPeriodFrom = AppUtils.ServerDateTime().Date.AddDays(-NoticeDaysAfter); DateTime BirthdayPeriodTo = AppUtils.ServerDateTime().Date.AddDays(NoticeDaysBefore); foreach (EEmpPersonalInfo empInfo in empInfoList) { DateTime dateOfBirth = empInfo.EmpDateOfBirth; int yearCount = 0; while (dateOfBirth <= BirthdayPeriodFrom) { yearCount++; dateOfBirth = empInfo.EmpDateOfBirth.AddYears(yearCount); } if (dateOfBirth <= BirthdayPeriodTo) { EInbox.CreateAndSaveInboxMessage(dbConn, UserID, 0, empInfo.EmpID, empInfo.EmpID, string.Empty, INBOX_TYPE, string.Empty, string.Empty, empInfo.EmpDateOfBirth); } } }
public override int GetHashCode() { unchecked { var hashCode = FullName?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ Exists.GetHashCode(); hashCode = (hashCode * 397) ^ Size.GetHashCode(); hashCode = (hashCode * 397) ^ (int)NotificationType; return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = Exists.GetHashCode(); hashCode = (hashCode * 397) ^ Size.GetHashCode(); hashCode = (hashCode * 397) ^ (FullName != null ? FullName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)NotificationType; return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (Exists != false) { hash ^= Exists.GetHashCode(); } if (Data.Length != 0) { hash ^= Data.GetHashCode(); } return(hash); }
public override int GetHashCode() { unchecked { var hashCode = Exists.GetHashCode(); hashCode = (hashCode * 397) ^ BlockId; hashCode = (hashCode * 397) ^ TextureIndex; hashCode = (hashCode * 397) ^ Tint.GetHashCode(); hashCode = (hashCode * 397) ^ LightTopLeft.GetHashCode(); hashCode = (hashCode * 397) ^ LightTopRight.GetHashCode(); hashCode = (hashCode * 397) ^ LightBottomLeft.GetHashCode(); hashCode = (hashCode * 397) ^ LightBottomRight.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int hash = 1; if (conditionTypeCase_ == ConditionTypeOneofCase.Exists) { hash ^= Exists.GetHashCode(); } if (conditionTypeCase_ == ConditionTypeOneofCase.UpdateTime) { hash ^= UpdateTime.GetHashCode(); } hash ^= (int)conditionTypeCase_; return(hash); }
public TDomain Execute(TGetCommand commandMessage) { TDomain entity = _repository.GetById(commandMessage.Id); bool isAccessible = new Exists <TDomain>() .And(new IsAccessibleWith <TDomain>(_permisionSet)) .And(new CanRunWithCommand <TGetCommand, TDomain>(commandMessage, _commandPermisions)) .IsSatisfiedBy(entity); if (!isAccessible) { throw new SecurityException(Resources.Error_AccessDenied); } return(entity); }
/// <summary> /// Gets the search filter instance. /// </summary> /// <param name="localName">Name of the local.</param> /// <returns></returns> private static SearchFilter GetSearchFilterInstance(string localName) { SearchFilter searchFilter; switch (localName) { case XmlElementNames.Exists: searchFilter = new Exists(); break; case XmlElementNames.Contains: searchFilter = new ContainsSubstring(); break; case XmlElementNames.Excludes: searchFilter = new ExcludesBitmask(); break; case XmlElementNames.Not: searchFilter = new Not(); break; case XmlElementNames.And: searchFilter = new SearchFilterCollection(LogicalOperator.And); break; case XmlElementNames.Or: searchFilter = new SearchFilterCollection(LogicalOperator.Or); break; case XmlElementNames.IsEqualTo: searchFilter = new IsEqualTo(); break; case XmlElementNames.IsNotEqualTo: searchFilter = new IsNotEqualTo(); break; case XmlElementNames.IsGreaterThan: searchFilter = new IsGreaterThan(); break; case XmlElementNames.IsGreaterThanOrEqualTo: searchFilter = new IsGreaterThanOrEqualTo(); break; case XmlElementNames.IsLessThan: searchFilter = new IsLessThan(); break; case XmlElementNames.IsLessThanOrEqualTo: searchFilter = new IsLessThanOrEqualTo(); break; default: searchFilter = null; break; } return searchFilter; }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append(Exists.ToString() + COMMA); sb.Append(TabToString(Artists)); sb.Append(TabToString(Characters)); sb.Append(TabToString(Series)); sb.Append(TabToString(Tags)); sb.Append(Convert.ToInt64(Size) + COMMA); sb.Append(Convert.ToInt16(Width) + COMMA); sb.Append(Convert.ToInt16(Height) + COMMA); sb.Append(Source + COMMA); sb.Append(FileName + COMMA); sb.Append(Checksum); return(sb.ToString()); }
public static string WriteExists(Exists exists, SqlParameterCollection parameters) { StringBuilder builder = new StringBuilder(); if (exists.ExistType == Exists.ExistTypes.NotExists) { builder.Append("NOT "); } builder.Append("EXISTS ("); SelectQuery select = (SelectQuery)exists.SelectQuery; builder.Append(select.GetSQL(parameters)); builder.Append(")"); return(builder.ToString()); }
protected override async Task<Action<AsyncCodeActivityContext>> ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) { PropertyDescriptor ftpSessionProperty = context.DataContext.GetProperties()[WithFtpSession.FtpSessionPropertyName]; IFtpSession ftpSession = ftpSessionProperty?.GetValue(context.DataContext) as IFtpSession; if (ftpSession == null) { throw new InvalidOperationException("FTPSessionNotFoundException"); } bool exists = await ftpSession.DirectoryExistsAsync(RemotePath.Get(context), cancellationToken); return (asyncCodeActivityContext) => { Exists.Set(asyncCodeActivityContext, exists); }; }
public static void GenerateWorkPermitExpiryInboxMessage(DatabaseConnection dbConn, int UserID, int NoticeDaysBefore, int NoticeDaysAfter) { if (NoticeDaysBefore < 0) { NoticeDaysBefore = 30; } if (NoticeDaysAfter < 0) { NoticeDaysAfter = 30; } const string INBOX_TYPE = EInbox.INBOX_TYPE_WORKPERMITEXPIRY; DBFilter WorkPermitExpiryFilter = new DBFilter(); WorkPermitExpiryFilter.add(AppUtils.AddRankDBTerm(UserID, "EmpID", true)); WorkPermitExpiryFilter.add(new Match("EmpPermitExpiryDate", ">=", AppUtils.ServerDateTime().Date.AddDays(-NoticeDaysAfter))); WorkPermitExpiryFilter.add(new Match("EmpPermitExpiryDate", "<=", AppUtils.ServerDateTime().Date.AddDays(NoticeDaysBefore))); DBFilter existsInboxFilter = new DBFilter(); existsInboxFilter.add(new MatchField(EEmpPermit.db.dbclass.tableName + ".EmpID", EInbox.db.dbclass.tableName + ".EmpID")); existsInboxFilter.add(new MatchField(EEmpPermit.db.dbclass.tableName + ".EmpPermitID", EInbox.db.dbclass.tableName + ".InboxRelatedRecID")); existsInboxFilter.add(new MatchField(EEmpPermit.db.dbclass.tableName + ".EmpPermitExpiryDate", EInbox.db.dbclass.tableName + ".InboxRelatedReferenceDate")); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".InboxType", INBOX_TYPE)); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".UserID", UserID)); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".InboxCreateDate", ">=", AppUtils.ServerDateTime().Date.AddDays(-(NoticeDaysBefore + NoticeDaysAfter)))); Exists existsInbox = new Exists(EInbox.db.dbclass.tableName, existsInboxFilter, true); WorkPermitExpiryFilter.add(existsInbox); DBFilter existsEmpTerminationFilter = new DBFilter(); existsEmpTerminationFilter.add(new MatchField(EEmpPermit.db.dbclass.tableName + ".EmpID", EEmpTermination.db.dbclass.tableName + ".EmpID")); existsEmpTerminationFilter.add(new Match("EmpTermLastDate", "<=", AppUtils.ServerDateTime().Date)); Exists notExistsEmpTermination = new Exists(EEmpTermination.db.dbclass.tableName, existsEmpTerminationFilter, true); WorkPermitExpiryFilter.add(notExistsEmpTermination); System.Collections.ArrayList empInfoList = EEmpPermit.db.select(dbConn, WorkPermitExpiryFilter); foreach (EEmpPermit empWorkPermit in empInfoList) { EInbox.CreateAndSaveInboxMessage(dbConn, UserID, 0, empWorkPermit.EmpID, empWorkPermit.EmpPermitID, string.Empty, INBOX_TYPE, string.Empty, string.Empty, empWorkPermit.EmpPermitExpiryDate); } }
public async Task should_create_time_entry() { // GIVEN var command = new CreateTimeEntries(new TimeEntryModel(DateTimeOffset.UtcNow, (int)TimeEntryType.In, UserProfileScenarioBuilder.Job1)); // WHEN var ids = await _sandbox.Mediator !.Send(command); // THEN _sandbox.Should !.Mediator !.Be("CreateTimeEntry -> TimeEntryAdded"); // TODO: check if event store has event // await _sandbox.Should!.Cassandra.Exists(id); await _sandbox.Should !.Redis !.Exists.Set("time-entry", ids.First()); await _sandbox.Should !.Redis !.Exists.SortedSet("time-entry", "by-when", 1); }
public void Execute(TDeleteCommand commandMessage) { TDomain entity = _repository.GetById(commandMessage.Id); bool isModifiable = new Exists <TDomain>() .And(new IsAccessibleWith <TDomain>(_permisionSet)) .And(new CanRunWithCommand <TDeleteCommand, TDomain>(commandMessage, _commandPermisions)) .IsSatisfiedBy(entity); if (!isModifiable) { throw new SecurityException(Resources.Error_AccessDenied); } entity = _preCommitActions.Aggregate(entity, (current, preCommitAction) => preCommitAction.Execute(commandMessage, current)); _repository.Delete(entity); }
public override int GetHashCode() { int hashcode = 157; unchecked { if (__isset.mid) { hashcode = (hashcode * 397) + Mid.GetHashCode(); } if (__isset.exists) { hashcode = (hashcode * 397) + Exists.GetHashCode(); } if (__isset.contact) { hashcode = (hashcode * 397) + Contact.GetHashCode(); } } return(hashcode); }
public void Write(BinaryWriter writer) { // Write user identification writer.Write(IdentifiedByUsername); // Write the username to configuration writer.Write(Username); // Write the security identifier to configuration writer.Write(SecurityID); // Write other settings Exists.Write(writer); Password.Write(writer); PasswordExpired.Write(writer); PasswordChangeDisabled.Write(writer); PasswordNeverExpires.Write(writer); AccountDisabled.Write(writer); AccountLockedOut.Write(writer); }
public static void GenerateTerminationInboxMessage(DatabaseConnection dbConn, int UserID, int NoticeDaysBefore, int NoticeDaysAfter) { if (NoticeDaysBefore < 0) { NoticeDaysBefore = 15; } if (NoticeDaysAfter < 0) { NoticeDaysAfter = 15; } const string INBOX_TYPE = EInbox.INBOX_TYPE_TERMINATION; DBFilter TerminationFilter = new DBFilter(); TerminationFilter.add(AppUtils.AddRankDBTerm(UserID, "EmpID", true)); TerminationFilter.add(new Match("EmpTermLastDate", ">=", AppUtils.ServerDateTime().Date.AddDays(-NoticeDaysAfter))); TerminationFilter.add(new Match("EmpTermLastDate", "<=", AppUtils.ServerDateTime().Date.AddDays(NoticeDaysBefore))); DBFilter existsInboxFilter = new DBFilter(); existsInboxFilter.add(new MatchField(EEmpTermination.db.dbclass.tableName + ".EmpID", EInbox.db.dbclass.tableName + ".EmpID")); existsInboxFilter.add(new MatchField(EEmpTermination.db.dbclass.tableName + ".EmpTermID", EInbox.db.dbclass.tableName + ".InboxRelatedRecID")); existsInboxFilter.add(new MatchField(EEmpTermination.db.dbclass.tableName + ".EmpTermLastDate", EInbox.db.dbclass.tableName + ".InboxRelatedReferenceDate")); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".InboxType", INBOX_TYPE)); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".UserID", UserID)); existsInboxFilter.add(new Match(EInbox.db.dbclass.tableName + ".InboxCreateDate", ">=", AppUtils.ServerDateTime().Date.AddDays(-(NoticeDaysBefore + NoticeDaysAfter)))); Exists existsInbox = new Exists(EInbox.db.dbclass.tableName, existsInboxFilter, true); TerminationFilter.add(existsInbox); System.Collections.ArrayList empInfoList = EEmpTermination.db.select(dbConn, TerminationFilter); foreach (EEmpTermination empTerm in empInfoList) { //EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); //empInfo.EmpID = empTerm.EmpID; //if (EEmpPersonalInfo.db.select(dbConn, empInfo)) EInbox.CreateAndSaveInboxMessage(dbConn, UserID, 0, empTerm.EmpID, empTerm.EmpTermID, string.Empty, INBOX_TYPE, string.Empty, string.Empty, empTerm.EmpTermLastDate); } }
public TDomain Execute(TCreateCommand commandMessage) { TDomain entity = _creator.Create(commandMessage); bool wasCreatedSuccsfully = new Exists <TDomain>() .And(new IsAccessibleWith <TDomain>(_permisionSet)) .And(new CanRunWithCommand <TCreateCommand, TDomain>(commandMessage, _commandPermisions)) .IsSatisfiedBy(entity); if (!wasCreatedSuccsfully) { throw new SecurityException(Resources.Error_AccessDenied); } entity = _preCommitActions.Aggregate(entity, (current, preCommitAction) => preCommitAction.Execute(commandMessage, current)); _validationEngine.Validate(entity); _repository.Insert(entity); return(entity); }
public Select AddClause(ISelectMember clause) { switch (clause) { case From from: _from = from; break; case IWhere where: _where = where; break; case GroupBy groupBy: _groupBy = groupBy; break; case OrderBy orderBy: _orderBy = orderBy; break; case Offset offset: _offset = offset; break; case Limit limit: _limit = limit; break; case For @for: _for = @for; break; case Exists exists: _exists = exists; break; } return(this); }
public override string ToString() { var sb = new StringBuilder("ContactReport("); bool __first = true; if (Mid != null && __isset.mid) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Mid: "); Mid.ToString(sb); } if (__isset.exists) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Exists: "); Exists.ToString(sb); } if (Contact != null && __isset.contact) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Contact: "); Contact.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
//// Start 0000140, Ricky So, 201/12/15 //protected void Page_Prerender(object sender, EventArgs e) //{ // if (!Page.IsPostBack) // { // empView = emploadData(empInfo, EEmpPayroll.db, empRepeater); // } //} //// End 0000140, Ricky So, 201/12/15 public DataView emploadData(ListInfo info, DBManager db, Repeater repeater) { DBFilter filter = new DBFilter();// empSBinding.createFilter(); //if (info != null && info.orderby != null && !info.orderby.Equals("")) // filter.add(info.orderby, info.order); string select = "* "; string from = "from [" + EEmpPersonalInfo.db.dbclass.tableName + "] e "; DBFilter empPayrollFilter = new DBFilter(); empPayrollFilter.add(new MatchField("e.EmpID", "ep.EmpID")); empPayrollFilter.add(new Match("ep.EmpPayStatus", "C")); // empPayrollFilter.add(new Match("ep.PayPeriodID", CurPayPeriodID)); // Start 000140, Ricky So, 2014/12/15 DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime().Date, AppUtils.ServerDateTime().Date); empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID")); empPayrollFilter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter)); // End 000140, Ricky So, 2014/12/15 DateTime dtPayPeriodFr, dtPayPeriodTo; if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo)) { DBFilter payPeriodFilter = new DBFilter(); // refer to Date To of payperiod payPeriodFilter.add(new Match("pp.PayPeriodTo", "<=", dtPayPeriodTo)); payPeriodFilter.add(new Match("pp.PayPeriodTo", ">=", dtPayPeriodFr)); empPayrollFilter.add(new IN("PayperiodID ", "Select payperiodID from PayrollPeriod pp", payPeriodFilter)); } else { empPayrollFilter.add(new Match("1", "2")); } DBFilter mpfRecordFilter = new DBFilter(); mpfRecordFilter.add(new Match("ORSOPlanID", ORSOPlanID.SelectedValue)); empPayrollFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from ORSORecord", mpfRecordFilter)); Exists exists = new Exists(EEmpPayroll.db.dbclass.tableName + " ep", empPayrollFilter); filter.add(exists); DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info); if (table.Rows.Count != 0) { ReportExportControl2.Visible = true; ReportExportControl1.Visible = true; } else { ReportExportControl2.Visible = false; ReportExportControl1.Visible = false; } empView = new DataView(table); //if (info != null) //{ // info.loadPageList(null, empPrevPage, empNextPage, empFirstPage, empLastPage); // CurPage.Value = info.page.ToString(); // NumPage.Value = info.numPage.ToString(); //} if (repeater != null) { repeater.DataSource = empView; repeater.DataBind(); } return(empView); }
// Use this for initialization void Start() { storage = this.gameObject.GetComponent<Exists>(); }
public static void ToSql(Exists expression, StringBuilder builder) { if (null == expression) throw new ArgumentNullException("expression"); if (null == builder) throw new ArgumentNullException("builder"); if (expression.Operands.Count > 0) { IToken operand = expression.Operands.First(); if (operand is ViewToken) { builder.Append(" exists ("); ViewToken viewToken = operand as ViewToken; View view = viewToken.ViewsManager.Views[viewToken.ViewName]; view.ToSql(builder, true); builder.Append(")"); } else { operand.ToSql(builder); builder.Append(" IS NOT NULL AND "); operand.ToSql(builder); builder.Append(" <> ''''"); } } }
protected override Expression ParseQuantifier(TokenSet followers) { Token kind = this.currentToken; SourceLocationBuilder slb = this.GetSourceLocationBuilderForLastScannedToken(); this.GetNextToken(); TokenSet followersOrLeftBraceOrSemicolonOrUnaryStart = followers | TS.LeftBraceOrRightParenthesisOrSemicolonOrUnaryStart | TS.PrimaryStart; List<LocalDeclarationsStatement> boundVariables = this.ParseQuantifierBoundVariables(followersOrLeftBraceOrSemicolonOrUnaryStart); IEnumerable<IEnumerable<Expression>> triggers = this.ParseQuantifierTriggers(followers | TS.UnaryStart | TS.PrimaryStart); Expression condition = this.ParseExpression(followers); slb.UpdateToSpan(this.scanner.SourceLocationOfLastScannedToken); Expression result; if (kind == Token.Exists) result = new Exists(boundVariables, condition, slb); else if (kind == Token.Forall) result = new Forall(boundVariables, condition, slb); else if (kind == Token.Lambda) result = new VccLambda(boundVariables, new CompileTimeConstant(true, SourceDummy.SourceLocation), condition, slb); else throw new InvalidOperationException(); this.compilation.ContractProvider.AssociateTriggersWithQuantifier(result, triggers); return result; }