public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) ) { from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that } else if ( Visible && ( ItemID == 4656 || ItemID == 4702 ) && DateTime.Now >= m_NextUse ) { Point3D p = GetWorldLocation(); if ( 1 > Utility.Random( Math.Max( Math.Abs( from.X - p.X ), Math.Abs( from.Y - p.Y ) ) ) ) { Effects.PlaySound( from.Location, from.Map, from.GetHurtSound() ); from.PublicOverheadMessage( MessageType.Regular, from.SpeechHue, true, "Ouch!" ); SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, Utility.Dice( 2, 10, 5 ) ); } Effects.PlaySound( GetWorldLocation(), Map, 0x387 ); Timer.DelayCall( TimeSpan.FromSeconds( 0.25 ), new TimerCallback( Down1 ) ); Timer.DelayCall( TimeSpan.FromSeconds( 0.50 ), new TimerCallback( Down2 ) ); Timer.DelayCall( TimeSpan.FromSeconds( 5.00 ), new TimerCallback( BackUp ) ); m_NextUse = DateTime.Now + TimeSpan.FromSeconds( 10.0 ); } }
public Point AddPoint(float value, DateTime timestamp) { var p = new Point(value, timestamp); _points.Add(p); _lastPoint = p; return p; }
public Event(string venue, double lat, double lng, DateTime date) { this.Venue = venue; this.Latitude = lat; this.Longitude = lng; Date = date; }
protected override bool ComparePropertyValue(IOguObject srcOguObject, string srcPropertyName, ADObjectWrapper adObject, string targetPropertyName, string context) { DateTime dtResult = DateTime.MinValue; long adAccountExpiresValue = Convert.ToInt64(adObject.Properties[targetPropertyName]); try { if (adAccountExpiresValue != SynchronizeHelper.ACCOUNT_EXPIRES_MAX_VALUE) { if (adAccountExpiresValue != 0) { DateTime dt = DateTime.FromFileTime(adAccountExpiresValue); //舍弃掉毫秒 dtResult = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Millisecond); } } } catch (System.ArgumentOutOfRangeException) { dtResult = DateTime.MaxValue; } dtResult = SynchronizeContext.Current.ADHelper.GetUserAccountExpirationDate(dtResult); var accountExpiresDate = Convert.ToDateTime(srcOguObject.Properties[srcPropertyName]); return accountExpiresDate == dtResult; }
private string GetDateTime( DateTime val ) { if ( val == DateTime.MinValue ) return ""; return val.ToString( "yyyy'-'MM'-'dd HH':'mm':'ss" ); }
/// <summary> /// Sets a persistent cookie with an expiresAt date /// </summary> public static void SetCookie(this IHttpResponse httpRes, string cookieName, string cookieValue, DateTime expiresAt, string path = "/") { httpRes.Cookies.AddCookie(new Cookie(cookieName, cookieValue, path) { Expires = expiresAt, }); }
public static int Add( Guid pollGuid, Guid siteGuid, String question, bool anonymousVoting, bool allowViewingResultsBeforeVoting, bool showOrderNumbers, bool showResultsWhenDeactivated, bool active, DateTime activeFrom, DateTime activeTo) { SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Polls_Insert", 10); sph.DefineSqlParameter("@PollGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, pollGuid); sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid); sph.DefineSqlParameter("@Question", SqlDbType.NVarChar, 255, ParameterDirection.Input, question); sph.DefineSqlParameter("@AnonymousVoting", SqlDbType.Bit, ParameterDirection.Input, anonymousVoting); sph.DefineSqlParameter("@AllowViewingResultsBeforeVoting", SqlDbType.Bit, ParameterDirection.Input, allowViewingResultsBeforeVoting); sph.DefineSqlParameter("@ShowOrderNumbers", SqlDbType.Bit, ParameterDirection.Input, showOrderNumbers); sph.DefineSqlParameter("@ShowResultsWhenDeactivated", SqlDbType.Bit, ParameterDirection.Input, showResultsWhenDeactivated); sph.DefineSqlParameter("@Active", SqlDbType.Bit, ParameterDirection.Input, active); sph.DefineSqlParameter("@ActiveFrom", SqlDbType.DateTime, ParameterDirection.Input, activeFrom); sph.DefineSqlParameter("@ActiveTo", SqlDbType.DateTime, ParameterDirection.Input, activeTo); int rowsAffected = sph.ExecuteNonQuery(); return rowsAffected; }
public DateClause( DateTime from, DateTime to ) { DateTimeExtensions.NormalizeRange( ref from, ref to ); From = from.Date; To = to.Date; }
/// <inheritdoc/> public async Task<Uri> UploadMessageAsync(Stream content, DateTime expirationUtc, string contentType, string contentEncoding, IProgress<int> bytesCopiedProgress, CancellationToken cancellationToken = default(CancellationToken)) { Requires.NotNull(content, "content"); Requires.Range(expirationUtc > DateTime.UtcNow, "expirationUtc"); string blobName = Utilities.CreateRandomWebSafeName(DesktopUtilities.BlobNameLength); if (expirationUtc < DateTime.MaxValue) { DateTime roundedUp = expirationUtc - expirationUtc.TimeOfDay + TimeSpan.FromDays(1); blobName = roundedUp.ToString("yyyy.MM.dd") + "/" + blobName; } var blob = this.container.GetBlockBlobReference(blobName); // Set metadata with the precise expiration time, although for efficiency we also put the blob into a directory // for efficient deletion based on approximate expiration date. if (expirationUtc < DateTime.MaxValue) { blob.Metadata["DeleteAfter"] = expirationUtc.ToString(CultureInfo.InvariantCulture); } blob.Properties.ContentType = contentType; blob.Properties.ContentEncoding = contentEncoding; await blob.UploadFromStreamAsync(content.ReadStreamWithProgress(bytesCopiedProgress), cancellationToken); return blob.Uri; }
private void ReadExif() { IEnumerable<Directory> directories = ImageMetadataReader.ReadMetadata(this.path); var subIfdDirectory = directories.OfType<ExifSubIfdDirectory>().FirstOrDefault(); var mainIfdDirectory = directories.OfType<ExifIfd0Directory>().FirstOrDefault(); try { this.dateTaken = Convert.ToDateTime(mainIfdDirectory.GetDescription(ExifDirectoryBase.TagDateTime)); this.manufacturer = mainIfdDirectory.GetDescription(ExifDirectoryBase.TagMake); this.model = mainIfdDirectory.GetDescription(ExifDirectoryBase.TagModel); this.iso = Convert.ToInt32(subIfdDirectory?.GetDescription(ExifDirectoryBase.TagIsoEquivalent)); this.fStop = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagFnumber); this.exposureTime = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagExposureTime); this.program = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagExposureProgram); this.metering = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagMeteringMode); this.flashMode = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagFlash); string tempFocal = subIfdDirectory?.GetDescription(ExifDirectoryBase.TagFocalLength); this.focalLength = Convert.ToInt32(tempFocal.Substring(0, tempFocal.Length - 3)); this.valid = true; } catch { this.valid = false; return; } }
public Organisation( User createdByUser, string name, string description, string website, MediaResource avatar, MediaResource background, IEnumerable<string> categories, DateTime createdDateTime, Group parentGroup) : base(createdByUser, name, createdDateTime, parentGroup) { Check.RequireNotNull(categories != null, "categories"); InitMembers(); SetOrganisationDetails( description, website, avatar, background, categories); ApplyEvent(new DomainModelCreatedEvent<Organisation>(this, createdByUser, this)); }
public TraceEventCache () { #if SSHARP started = DateTimePrecise.Now; #else started = DateTime.Now; #endif #if NETCF try { throw new ApplicationException (); } catch (ApplicationException aex) { callstack = aex.StackTrace; } #else manager = Trace.CorrelationManager; callstack = Environment.StackTrace; #endif timestamp = Stopwatch.GetTimestamp (); #if SSHARP process = (int)Crestron.SimplSharp.InitialParametersClass.ApplicationNumber; #if SSHARP_PRO thread = CurrentThread.Name; #else thread = String.Empty; #endif #else thread = Thread.CurrentThread.Name; process = Process.GetCurrentProcess ().Id; #endif }
public MFTestResults TimerTest0() { MFTestResults result = MFTestResults.Pass; try { timerEvent.Reset(); /// Save the current time shifted by 5 hours. timerTime = DateTime.UtcNow - utcTimeShiftAmount; using (Timer t = new Timer(new TimerCallback(TimerCallback), null, new TimeSpan(0, 0, 30), new TimeSpan(-TimeSpan.TicksPerMillisecond))) { /// We shift the utc back by 5 hours. TimeService.SetUtcTime(timerTime.Ticks); /// timer should still fire after 30 seconds even though absolute time has been manipulated. if (!timerEvent.WaitOne(2 * 60 * 1000, false)) { result = MFTestResults.Fail; } /// Reset the changes. TimeService.SetUtcTime((DateTime.UtcNow + utcTimeShiftAmount).Ticks); t.Change(-1, -1); } } catch (Exception ex) { Log.Exception("Unexpected exception", ex); result = MFTestResults.Fail; } return result; }
public Watcher(String path, Client client) { this.client = client; this.path = path; lastRead = DateTime.MinValue; this.Run(); }
/// <summary> /// Inserts a row in the mp_ContentWorkflow table. Returns rows affected count. /// </summary> /// <param name="guid"> guid </param> /// <param name="siteGuid"> siteGuid </param> /// <param name="moduleGuid"> moduleGuid </param> /// <param name="createdDateUtc"> createdDateUtc </param> /// <param name="userGuid"> userGuid </param> /// <param name="status"> status </param> /// <param name="contentText"> contentText </param> /// <param name="customData"> customData </param> /// <param name="customReferenceNumber"> customReferenceNumber </param> /// <param name="customReferenceGuid"> customReferenceGuid </param> /// <returns>int</returns> public static int Create( Guid guid, Guid siteGuid, Guid moduleGuid, Guid userGuid, DateTime createdDateUtc, string contentText, string customData, int customReferenceNumber, Guid customReferenceGuid, string status) { SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_ContentWorkflow_Insert", 10); sph.DefineSqlParameter("@Guid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, guid); sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid); sph.DefineSqlParameter("@ModuleGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, moduleGuid); sph.DefineSqlParameter("@CreatedDateUtc", SqlDbType.DateTime, ParameterDirection.Input, createdDateUtc); sph.DefineSqlParameter("@UserGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, userGuid); sph.DefineSqlParameter("@Status", SqlDbType.NVarChar, 20, ParameterDirection.Input, status); sph.DefineSqlParameter("@ContentText", SqlDbType.NVarChar, -1, ParameterDirection.Input, contentText); sph.DefineSqlParameter("@CustomData", SqlDbType.NVarChar, -1, ParameterDirection.Input, customData); //object customReferenceNumberVal = customReferenceNumber.HasValue ? (object)customReferenceNumber.Value : DBNull.Value; sph.DefineSqlParameter("@CustomReferenceNumber", SqlDbType.Int, ParameterDirection.Input, customReferenceNumber); //object customReferenceGuidVal = customReferenceGuid.HasValue ? (object)customReferenceGuid.Value : DBNull.Value; sph.DefineSqlParameter("@CustomReferenceGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, customReferenceGuid); int rowsAffected = sph.ExecuteNonQuery(); return rowsAffected; }
public void Execute(ISession session, long taskId, DateTime sentDate) { bool closeSession = false; if (session == null) { session = _businessSafeSessionManager.Session; closeSession = true; } var systemUser = session.Load<UserForAuditing>(SystemUser.Id); var taskDueTomorrowEscalation = new EscalationTaskDueTomorrow() { TaskId = taskId, TaskDueTomorrowEmailSentDate = sentDate, CreatedBy = systemUser, CreatedOn = DateTime.Now }; session.Save(taskDueTomorrowEscalation); //Log4NetHelper.Log.Debug("Saved EscalationTaskDueTomorrow sent indicator"); if (closeSession) { session.Close(); } }
public static void PrintOnConsole(string homeTeamName, string awayTeamName, int homeTeamScore, int awayTeamScore, string league, DateTime date) { var stringDate = date.ToString("dd-MMM-yyyyy"); Console.WriteLine("{0}: {1} - {2}: {3}-{4} ({5})", stringDate, homeTeamName, awayTeamName, homeTeamScore, awayTeamScore, league); }
protected Revision (Repository repo, DateTime time, string author, string message) { this.repo = repo; this.Time = time; this.Author = author; this.Message = message; }
public Temblor[] GetTembloresByDate(DateTime fecha) { var temblores = from t in repository.All<Temblor>() where t.Fecha >= fecha.Date && t.Fecha < fecha.Date.AddDays(1) select t; return temblores.ToArray(); }
public Announcement(string description, string type, string operatorName, DateTime? startDate, DateTime? endDate, Coordinate location, IEnumerable<string> modes) { this.OperatorName = operatorName; this.Description = description; this.StartDate = startDate; this.EndDate = endDate; this.Location = location; this.Type = type; this.Modes.AddRange(modes); this.RelativeDateString = TimeConverter.ToRelativeDateString(StartDate, true); if (modes != null) { if (modes.Select(x => x.ToLower()).Contains("bus")) this.ModeImages.Add("/Images/64/W/ModeBus.png"); if (modes.Select(x => x.ToLower()).Contains("rail")) this.ModeImages.Add("/Images/64/W/ModeRail.png"); if (modes.Select(x => x.ToLower()).Contains("taxi")) this.ModeImages.Add("/Images/64/W/ModeTaxi.png"); if (modes.Select(x => x.ToLower()).Contains("boat")) this.ModeImages.Add("/Images/64/W/ModeBoat.png"); if (!this.ModeImages.Any()) this.ModeImages.Add("/Images/64/W/ModeBus.png"); } else { this.Modes.Add("bus"); this.ModeImages.Add("/Images/64/W/ModeBus.png"); } }
public override void Update() { // Bounding Box rectangle = new Rectangle ( (int)Position.X, (int)Position.Y, (int)Size.X, (int)Size.Y ); KeyboardState keyboardState = Keyboard.GetState(); if (Keyboard.GetState().IsKeyDown(Keys.D)) { Position += movingVector; body.ApplyLinearImpulse(movingImpulse); } else if (Keyboard.GetState().IsKeyDown(Keys.A)) { Position -= movingVector; body.ApplyLinearImpulse(-movingImpulse); } if (Keyboard.GetState().IsKeyDown(Keys.W) && !prevKeyboardState.IsKeyDown(Keys.W)) { if ((DateTime.Now - previousJump).TotalSeconds >= jumpInterval) { jumpEffect.Play(); body.ApplyLinearImpulse(jumpingImpulse); previousJump = DateTime.Now; } } prevKeyboardState = keyboardState; }
public void CanStoreAndRetrieveTime(DateTime expectedTime) { // Only supporting accuracy up to the millisecond expectedTime = new DateTime(expectedTime.Year, expectedTime.Month, expectedTime.Day, expectedTime.Hour, expectedTime.Minute, expectedTime.Second, expectedTime.Millisecond, expectedTime.Kind); using (var store = NewDocumentStore()) { using (var session = store.OpenSession()) { session.Store(new Post { PostedAt = expectedTime, Tags = new List<string> { "C#", "Programming", "NoSql" } }); session.SaveChanges(); } using (var session = store.OpenSession()) { var posts = session.Query<Post>() .Customize(q => q.WaitForNonStaleResultsAsOfNow(TimeSpan.FromSeconds(5))) .ToArray(); Assert.Equal(1, posts.Length); Assert.Equal(expectedTime, posts[0].PostedAt); } } }
public StudyDeleteRecord( String _studyInstanceUid_ ,DateTime _timestamp_ ,String _serverPartitionAE_ ,ServerEntityKey _filesystemKey_ ,String _backupPath_ ,String _reason_ ,String _accessionNumber_ ,String _patientId_ ,String _patientsName_ ,String _studyId_ ,String _studyDescription_ ,String _studyDate_ ,String _studyTime_ ,XmlDocument _archiveInfo_ ,String _extendedInfo_ ):base("StudyDeleteRecord") { StudyInstanceUid = _studyInstanceUid_; Timestamp = _timestamp_; ServerPartitionAE = _serverPartitionAE_; FilesystemKey = _filesystemKey_; BackupPath = _backupPath_; Reason = _reason_; AccessionNumber = _accessionNumber_; PatientId = _patientId_; PatientsName = _patientsName_; StudyId = _studyId_; StudyDescription = _studyDescription_; StudyDate = _studyDate_; StudyTime = _studyTime_; ArchiveInfo = _archiveInfo_; ExtendedInfo = _extendedInfo_; }
protected static string ConvertToDisplayDateTime(DateTime? utcDateTime) { // You can change this method to convert the UTC date time into the desired display // offset and format. Here we're converting it to the server timezone and formatting // as a short date and a long time string, using the current thread culture. return utcDateTime.HasValue ? utcDateTime.Value.ToLocalTime().ToString("G") : "[never]"; }
public Capability(string issuerId, DateTime expiryTime) { this.issuerId = issuerId; this.expiryTime = expiryTime; randomVal = randGenerator.Next(); }
/// <summary> /// Queries the calendar for events matching the specified criteria. /// </summary> /// <param name="fullTextQuery"></param> /// <param name="from"></param> /// <param name="until"></param> /// <returns></returns> public CalendarEvent[] GetEvents(string fullTextQuery, DateTime? from, DateTime? until) { EventQuery query = new EventQuery(); query.Uri = new Uri(CALENDAR_URI); query.Query = fullTextQuery; if (from != null) { query.StartTime = from.Value; } if (until != null) { query.EndTime = until.Value; } EventFeed calFeed = _service.Query(query); List<CalendarEvent> events = CollectionUtils.Map<EventEntry, CalendarEvent, List<CalendarEvent>>(calFeed.Entries, delegate(EventEntry e) { return new CalendarEvent(e); }); events.Sort(); return events.ToArray(); }
// Calcul des refinancements public IQueryable<Refinancement> Produire(DateTime dateArchivage) { // INitialisation des budgets IQueryable<Budget> _budgets = uow.Budget .GetAllByGroupeId(groupeId) .Include(b => b.BudgetEquilibre) .Where(b => b.IsActive == true) .Where(b => b.RefinancementImmediat == true) .Where(b => b.TypeNonAlloue != true) // Exclusion des budgets de type 'non alloué' ; // Calculs des écarts var _budgetsHorsReserve = _budgets.Where(b => b.IsBudgetEquilibre != true); // Exclusion des budgets de type réserve de financement (Budget equilibre) IList<Refinancement> _refis = fabriqueRefi.Make(_budgetsHorsReserve, dateArchivage); // Il faut maintenant ajouter les budgets réserve var _reserves = _budgets.Where(b => b.IsBudgetEquilibre == true); IList<Refinancement> _refiReserves = fabriqueRefi.Make(_reserves, dateArchivage); CalculerRefinancementReserves(_refis, _refiReserves); // Retour return _refis .Where(e => e.MontantRefinancement != 0) .OrderBy(e => e.MontantEcart) .AsQueryable<Refinancement>(); }
public Person(int _id, string _name, int _age, DateTime _birth) { ID = _id; Name = _name; Age = _age; Birth = _birth; }
public ViewModel() { mgt = new ManagementClass("Win32_Processor"); procs = mgt.GetInstances(); CPU = new ObservableCollection<Model>(); timer = new DispatcherTimer(); random = new Random(); time = DateTime.Now; cpuCounter = new PerformanceCounter(); cpuCounter.CategoryName = "Processor"; cpuCounter.CounterName = "% Processor Time"; cpuCounter.InstanceName = "_Total"; ramCounter = new PerformanceCounter("Memory", "Available MBytes"); ProcessorID = GetProcessorID(); processes = Process.GetProcesses(); Processes = processes.Length; MaximumSpeed = GetMaxClockSpeed(); LogicalProcessors = GetNumberOfLogicalProcessors(); Cores = GetNumberOfCores(); L2Cache = GetL2CacheSize(); L3Cache = GetL3CacheSize(); foreach (ManagementObject item in procs) L1Cache = ((UInt32)item.Properties["L2CacheSize"].Value / 2).ToString() + " KB"; timer.Interval = TimeSpan.FromMilliseconds(1000); timer.Tick += timer_Tick; timer.Start(); for (int i = 0; i < 60; i++) { CPU.Add(new Model(time, 0,0)); time = time.AddSeconds(1); } }
public static DateTime Merge(DateTime date, string time) { int[] components = time.Split(':').Select(int.Parse).ToArray(); return new DateTime(date.Year, date.Month, date.Day, components[0], components[1], components[2]); }
partial void OnStartTimeChanging(System.DateTime value);
// fetch all rows from table into new List of Contracts, filtered by any column // links: // docLink: http://sql2x.org/documentationLink/ce01ef4a-5cd0-4e51-b211-9c0a15b791a0 public List <CrudeDefaultSystemSettingRefContract> FetchWithFilter(string defaultSystemSettingRcd, string defaultSystemSettingName, System.Guid defaultUserId, System.DateTime dateTime) { var list = new List <CrudeDefaultSystemSettingRefContract>(); List <CrudeDefaultSystemSettingRefData> dataList = CrudeDefaultSystemSettingRefData.FetchWithFilter( defaultSystemSettingRcd: defaultSystemSettingRcd, defaultSystemSettingName: defaultSystemSettingName, defaultUserId: defaultUserId, dateTime: dateTime ); foreach (CrudeDefaultSystemSettingRefData data in dataList) { var crudeDefaultSystemSettingRefContract = new CrudeDefaultSystemSettingRefContract(); DataToContract(data, crudeDefaultSystemSettingRefContract); list.Add(crudeDefaultSystemSettingRefContract); } return(list); }
// Cases like "3 days from today", "5 weeks before yesterday", "2 months after tomorrow" // Note that these cases are of type "date" private List <Token> ExtractRelativeDurationDate(string text, List <Token> tokens, DateObject reference) { var ret = new List <Token>(); var tempTokens = new List <Token>(tokens); var durationEr = Config.DurationExtractor.Extract(text, reference); foreach (var er in durationEr) { // if it is a multiple duration but its type is not equal to Date, skip it here if (IsMultipleDuration(er) && !IsMultipleDurationDate(er)) { continue; } // Some types of duration can be compounded with "before", "after" or "from" suffix to create a "date" // While some other types of durations, when compounded with such suffix, it will not create a "date", but create a "dateperiod" // For example, durations like "3 days", "2 weeks", "1 week and 2 days", can be compounded with such suffix to create a "date" // But "more than 3 days", "less than 2 weeks", when compounded with such suffix, it will become cases like "more than 3 days from today" which is a "dateperiod", not a "date" // As this parent method is aimed to extract RelativeDurationDate, so for cases with "more than" or "less than", we remove the prefix so as to extract the expected RelativeDurationDate if (IsInequalityDuration(er)) { StripInequalityDuration(er); } var match = Config.DateUnitRegex.Match(er.Text); if (match.Success) { ret.AddRange(AgoLaterUtil.ExtractorDurationWithBeforeAndAfter(text, er, ret, Config.UtilityConfiguration)); // Take into account also holiday dates if (ret.Count < 1) { var holidayEr = Config.HolidayExtractor.Extract(text, reference); foreach (var holiday in holidayEr) { tempTokens.Add(new Token((int)holiday.Start, (int)(holiday.Start + holiday.Length))); } } // Check for combined patterns Duration + Date, e.g. '3 days before Monday', '4 weeks after January 15th' if (ret.Count < 1 && tempTokens.Count > 0 && er.Text != match.Value) { var afterStr = text.Substring((int)er.Start + (int)er.Length); var connector = Config.BeforeAfterRegex.MatchBegin(afterStr, trim: true); if (connector.Success) { foreach (var token in tempTokens) { var start = (int)er.Start + (int)er.Length + connector.Index + connector.Length; var length = token.Start - start; if (length > 0 && start + length < text.Length && string.IsNullOrWhiteSpace(text.Substring(start, length))) { Token tok = new Token((int)er.Start, token.End); ret.Add(tok); } } } } } } // Extract cases like "in 3 weeks", which equals to "3 weeks from today" var relativeDurationDateWithInPrefix = ExtractRelativeDurationDateWithInPrefix(text, durationEr, reference); // For cases like "in 3 weeks from today", we should choose "3 weeks from today" as the extract result rather than "in 3 weeks" or "in 3 weeks from today" foreach (var extractResultWithInPrefix in relativeDurationDateWithInPrefix) { if (!IsOverlapWithExistExtractions(extractResultWithInPrefix, ret)) { ret.Add(extractResultWithInPrefix); } } return(ret); }
/// <summary> /// Starts an asynchronous download of historic quotes data. /// </summary> /// <param name="unmanagedIDs">The unmanaged list of IDs</param> /// <param name="fromDate">The startdate of the reviewed period</param> /// <param name="todate">The enddate of the reviewed period</param> /// <param name="interval">The trading period interval</param> /// <param name="userArgs">Individual user argument</param> /// <remarks></remarks> public void DownloadAsync(IEnumerable <string> unmanagedIDs, System.DateTime fromDate, System.DateTime toDate, HistQuotesInterval interval, object userArgs) { if (unmanagedIDs == null) { throw new ArgumentNullException("unmanagedIDs", "The passed list is null."); } this.CheckDates(fromDate, toDate); this.DownloadAsync(new HistQuotesDownloadSettings(unmanagedIDs, fromDate, toDate, interval), userArgs); }
public HistQuotesDownloadSettings(IEnumerable <string> ids, System.DateTime fromDate, System.DateTime toDate, HistQuotesInterval interval) { if (ids == null) { throw new ArgumentNullException("unmanagedIDs", "The passed list is null."); } this.IDs = MyHelper.EnumToArray(ids); this.TextEncoding = System.Text.Encoding.UTF8; this.FromDate = fromDate; this.ToDate = toDate; this.Interval = interval; }
public static System.DateTime ToCSharpTime(long unixTime) { System.DateTime unixStartTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); return(unixStartTime.AddSeconds(Convert.ToDouble(unixTime))); }
partial void OnHireDatePropertyChanged(System.DateTime newValue);
/// <remarks/> public void GetCreditCardDetailsForScheduledEventsAsync(System.DateTime eventDate) { this.GetCreditCardDetailsForScheduledEventsAsync(eventDate, null); }
public int Add(long lngShop_ID, long lngUser_ID, long lngBranch_ID, System.DateTime dtSale_Date, System.DateTime dtModify_Date, long lngPrevious_Amt, long lngSale_Amt_With_Comm, long lngCommission_Amt, long lngSale_Amt_After_Comm, long lngDeposit, long lngBalance, string strReserve1) { var command = DataAccess.CreateCommand(CommandType.Text); command.CommandText = "INSERT INTO Branch_Sale_Summary(Shop_ID, User_ID, Branch_ID, Sale_Date, Modify_Date, Previous_Amt," + " Sale_Amt_With_Comm, Commission_Amt, Sale_Amt_After_Comm, Deposit, Balance, Reserve1) " + " VALUES (@Shop_ID, @User_ID, @Branch_ID, @Sale_Date, @Modify_Date, @Previous_Amt," + " @Sale_Amt_With_Comm, @Commission_Amt, @Sale_Amt_After_Comm, @Deposit, @Balance, @Reserve1)"; var parameter = command.CreateParameter(); parameter.ParameterName = "@Shop_ID"; parameter.Value = lngShop_ID; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@User_ID"; parameter.Value = lngUser_ID; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Branch_ID"; parameter.Value = lngBranch_ID; parameter.DbType = DbType.String; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Sale_Date"; parameter.Value = dtSale_Date; parameter.DbType = DbType.Date; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Modify_Date"; parameter.Value = DateTime.Today; parameter.DbType = DbType.String; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Previous_Amt"; parameter.Value = lngPrevious_Amt; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Sale_Amt_With_Comm"; parameter.Value = lngSale_Amt_With_Comm; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Commission_Amt"; parameter.Value = lngCommission_Amt; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Sale_Amt_After_Comm"; parameter.Value = lngSale_Amt_After_Comm; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Deposit"; parameter.Value = lngDeposit; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Balance"; parameter.Value = lngBalance; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Reserve1"; parameter.Value = strReserve1; parameter.DbType = DbType.String; command.Parameters.Add(parameter); int retVal = DataAccess.ExecuteNonQuery(command); return(retVal); }
/// <summary> /// datetime转换为unixtime /// </summary> /// <param name="time"></param> /// <returns></returns> public static int ConvertDateTimeInt(System.DateTime time) { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); return((int)(time - startTime).TotalSeconds); }
public override void _presenter_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (videoSummarization != null && _startPoint != null && _inkCanvas.Strokes.Count > 0) { Stroke lastStroke = _inkCanvas.Strokes.Last(); //先清空原来选中的关键帧序列 clearPreMessage(); _currPoint = e.GetPosition(_inkCanvas); _currPoint.X -= inkCanvasSpiralSummarizationMargin.Left; _currPoint.Y -= inkCanvasSpiralSummarizationMargin.Top; endIndex = videoSummarization.getSelectedKeyFrameIndex(_currPoint); //记录操作类型与持续时间 recordOperateTrace("UP"); upTime = System.DateTime.Now; if (lastStroke.StylusPoints.Count == 1) { if (startIndex != int.MinValue && startIndex == endIndex && _inkCollector.IsShowUnbrokenKeyFrame) { if (null != mouseGesture) { mouseGesture.Points.Clear(); } if (GlobalValues.locationQuestions.Count > 0) { if (GlobalValues.CurrLocationId + 1 < GlobalValues.locationQuestions.Count) { if (GlobalValues.locationAnswers[GlobalValues.CurrLocationId].IndexOf(videoSummarization.KeyFrames.IndexOf(videoSummarization.ShowKeyFrames[startIndex]) + 1) != -1) { GlobalValues.CurrLocationId++; GlobalValues.LocationQuestion.setQuestion(GlobalValues.locationQuestions[GlobalValues.CurrLocationId]); VideoSummarizationControl.RecordCurrOperationAndTime("第" + (GlobalValues.CurrLocationId - 1).ToString() + "次定位正确"); GlobalValues.LocationQuestion.TBQuestion.Background = new SolidColorBrush(GlobalValues.LocationQuestionBackGrouds[GlobalValues.CurrLocationId]); } } else { VideoSummarizationControl.RecordCurrOperationAndTime("最后一次定位正确"); switch (GlobalValues.summarizationTypeNo) { case 0: VideoSummarizationControl.Record("Spiral"); break; case 1: VideoSummarizationControl.Record("Tile"); break; case 2: VideoSummarizationControl.Record("Tapestry"); break; } MessageBox.Show("恭喜你完成此项任务!"); VideoSummarizationControl.sWriter.Close(); VideoSummarizationControl.myStream.Close(); Environment.Exit(1); } } //定位视频 if (VideoSummarizationControl != null) { //定位视频,position的单位是秒 videoSource = videoSummarization.ShowKeyFrames[startIndex].VideoName; VideoSummarizationTool.locateMediaPlayer(VideoSummarizationControl.mediaPlayer, videoSummarization.ShowKeyFrames[startIndex]); //显示超链接 if (hyperLink != null) { VideoSummarizationControl.TableGrid.Children.Remove(hyperLink.Image); } hyperLink = videoSummarization.ShowKeyFrames[startIndex].HyperLink; if (hyperLink != null) { VideoSummarizationControl.hyperLinkPlayer.Visibility = Visibility.Visible; VideoSummarizationTool.locateMediaPlayer(VideoSummarizationControl.hyperLinkPlayer, hyperLink); hyperLinkSpiralSummarization = videoSummarization.ShowKeyFrames[startIndex].HyperLinkSpiralSummarization; VideoSummarizationControl.hyperLinkPlayer.MouseLeftButtonUp += new MouseButtonEventHandler(hyperLinkPlayer_MouseLeftButtonUp); } //记录操作事件与持续时间 recordOperateEvent("locate"); } } } else { if (startIndex == int.MinValue && mouseGesture != null) { mouseGesture.StopCapture(); } } _startPoint.X = 0; _startPoint.Y = 0; _inkCanvas.Strokes.Remove(lastStroke); } }
/// <summary> /// 时间转换成时间撮 /// </summary> /// <param name="time">时间</param> /// <returns></returns> public static string DateTimeConvertTimeStamp(this DateTime time) { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); return((time - startTime).TotalSeconds.ToString().Substring(0, 10)); }
// fetch all rows from table into new List of Contracts, filtered by any column // links: // docLink: http://sql2x.org/documentationLink/ce01ef4a-5cd0-4e51-b211-9c0a15b791a0 public List <CrudeExternalSystemContract> FetchWithFilter(System.Guid externalSystemId, string externalSystemCode, string externalSystemName, System.Guid userId, System.DateTime dateTime) { var list = new List <CrudeExternalSystemContract>(); List <CrudeExternalSystemData> dataList = CrudeExternalSystemData.FetchWithFilter( externalSystemId: externalSystemId, externalSystemCode: externalSystemCode, externalSystemName: externalSystemName, userId: userId, dateTime: dateTime ); foreach (CrudeExternalSystemData data in dataList) { var crudeExternalSystemContract = new CrudeExternalSystemContract(); DataToContract(data, crudeExternalSystemContract); list.Add(crudeExternalSystemContract); } return(list); }
/// <summary> /// 创建升级支付订单 /// </summary> /// <param name="code"></param> /// <param name="userID"></param> /// <returns></returns> public object CreateUpGradeOrder(string code, string userID) { //1.调用小程序登录API,获取openID IConfig config = new ConfigMiniPersonal(); WeChatMinApi miniApi = new WeChatMinApi(config); Jscode2sessionResult openIDResule = miniApi.Jscode2session(code); if (openIDResule == null || string.IsNullOrWhiteSpace(openIDResule.OpenID)) { return(new { retCode = "Error", retMsg = "无法获取openID,请确认code是否正确", objectData = "" }); } //using (ApplicationDbContext db = new ApplicationDbContext()) //{ // //防止用户重复提交订单,把Vip状态设为升级中 // var vip = db.Vips.FirstOrDefault(s => s.UserID == userID); // vip.State = Common.Enums.VipState.Uploading; // db.SaveChanges(); //} string OrderCode = CreateOrderCode(userID); //创建订单号 decimal Amount = Comm.UpGradeAmount(); //升级费用 if (string.IsNullOrEmpty(OrderCode)) { return(new { retCode = "Error", retMsg = "订单号生成失败", objectData = "" }); } //2.调用支付统一下单API #region 调用支付统一下单API UnifiedPayData payData = new UnifiedPayData() { attach = string.Empty, body = "个人升级成为VIP,提交支付费用", goods_tag = string.Empty, openid = openIDResule.OpenID, out_trade_no = OrderCode, total_fee = (int)Amount * 100, //total_fee = 1,//测试10分订单 trade_type = "JSAPI" }; RequestResult payResult = payment.GetUnifiedOrderResult(payData); WxPayData payreturnData = payResult.objectData; if (payResult.retCode != ReqResultCode.success || payreturnData == null) { return(new { retCode = "Error", retMsg = "请求微信支付统一下单失败", objectData = "" }); } #endregion //3.生成商户订单 #region 生成商户订单 int rows = 0; using (ApplicationDbContext db = new ApplicationDbContext()) { //2.生成商户订单 Order order = new Order() { Amount = 0, Code = OrderCode, ReceivableAmount = Amount, State = Common.Enums.OrderState.UnHandle, Channel = Common.Enums.PayChannel.WxPay, Type = Common.Enums.OrderType.Receivable, UserID = userID, CreateDateTime = DateTime.Now, PayCode = string.Empty, PayInput = JsonConvert.SerializeObject(payData) }; db.Orders.Add(order); rows = db.SaveChanges(); } if (rows <= 0) { return(new { retCode = "Error", retMsg = "保存订单数据失败", objectData = "" }); } #endregion //4.返回支付参数:5个参数,生成签名再返回 System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 当地时区 long ts = (long)(DateTime.Now - startTime).TotalSeconds; // 相差秒数 System.Text.StringBuilder paySignpar = new System.Text.StringBuilder(); paySignpar.Append($"appId={payreturnData.GetValue("appid")?.ToString()}"); paySignpar.Append($"&nonceStr={payreturnData.GetValue("nonce_str")?.ToString()}"); paySignpar.Append($"&package=prepay_id={payreturnData.GetValue("prepay_id")?.ToString()}"); paySignpar.Append($"&signType=MD5"); paySignpar.Append($"&timeStamp={ts.ToString()}"); paySignpar.Append($"&key={ConfigurationManager.AppSettings["wxPayKey"] ?? string.Empty}"); string strPaySignpar = paySignpar.ToString(); var sign = GetMd5Hash(strPaySignpar).ToUpper(); dynamic retModel = new { timeStamp = ts.ToString(), nonceStr = payreturnData.GetValue("nonce_str")?.ToString(), package = "prepay_id=" + payreturnData.GetValue("prepay_id")?.ToString(), signType = "MD5", paySign = sign, total_fee = payData.total_fee / 100m, }; return(new { retCode = "Success", retMsg = "成功", objectData = retModel }); }
partial void OnCreationDateChanging(System.DateTime value);
public int Update(long lngID, long lngShop_ID, long lngUser_ID, long lngBranch_ID, System.DateTime dtSale_Date, System.DateTime dtModify_Date, long lngPrevious_Amt, long lngSale_Amt_With_Comm, long lngCommission_Amt, long lngSale_Amt_After_Comm, long lngDeposit, long lngBalance, string strReserve1) { var command = DataAccess.CreateCommand(CommandType.Text); command.CommandText = "UPDATE Branch_Sale_Summary SET Shop_ID = @Shop_ID, User_ID= @User_ID, Branch_ID= @Branch_ID, " + " Sale_Date= @Sale_Date, Modify_Date= @Modify_Date, Previous_Amt=@Previous_Amt " + " Sale_Amt_With_Comm=@Sale_Amt_With_Comm, Commission_Amt=@Commission_Amt, Sale_Amt_After_Comm=@Sale_Amt_After_Comm " + " Deposit=@Deposit, Balance=@Balance, Reserve1=@Reserve1 " + " WHERE ID = @ID"; var parameter = command.CreateParameter(); parameter.ParameterName = "@Shop_ID"; parameter.Value = lngShop_ID; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@User_ID"; parameter.Value = lngUser_ID; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Branch_ID"; parameter.Value = lngBranch_ID; parameter.DbType = DbType.String; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Sale_Date"; parameter.Value = dtSale_Date; parameter.DbType = DbType.Date; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Modify_Date"; parameter.Value = DateTime.Today; parameter.DbType = DbType.String; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Previous_Amt"; parameter.Value = lngPrevious_Amt; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Sale_Amt_With_Comm"; parameter.Value = lngSale_Amt_With_Comm; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Commission_Amt"; parameter.Value = lngCommission_Amt; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Sale_Amt_After_Comm"; parameter.Value = lngSale_Amt_After_Comm; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Deposit"; parameter.Value = lngDeposit; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Balance"; parameter.Value = lngBalance; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@Reserve1"; parameter.Value = strReserve1; parameter.DbType = DbType.String; command.Parameters.Add(parameter); parameter = command.CreateParameter(); parameter.ParameterName = "@ID"; parameter.Value = lngID; parameter.DbType = DbType.Int64; command.Parameters.Add(parameter); return(DataAccess.ExecuteNonQuery(command)); }
static public int constructor(IntPtr l) { try { int argc = LuaDLL.lua_gettop(l); System.DateTime o; if (argc == 2) { System.Int64 a1; checkType(l, 2, out a1); o = new System.DateTime(a1); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 4) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); o = new System.DateTime(a1, a2, a3); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 7) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); o = new System.DateTime(a1, a2, a3, a4, a5, a6); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int))) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); System.Int32 a7; checkType(l, 8, out a7); o = new System.DateTime(a1, a2, a3, a4, a5, a6, a7); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 5) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Globalization.Calendar a4; checkType(l, 5, out a4); o = new System.DateTime(a1, a2, a3, a4); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(System.Globalization.Calendar))) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); System.Globalization.Calendar a7; checkType(l, 8, out a7); o = new System.DateTime(a1, a2, a3, a4, a5, a6, a7); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(System.Globalization.Calendar))) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); System.Int32 a7; checkType(l, 8, out a7); System.Globalization.Calendar a8; checkType(l, 9, out a8); o = new System.DateTime(a1, a2, a3, a4, a5, a6, a7, a8); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 3) { System.Int64 a1; checkType(l, 2, out a1); System.DateTimeKind a2; checkEnum(l, 3, out a2); o = new System.DateTime(a1, a2); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(System.DateTimeKind))) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); System.DateTimeKind a7; checkEnum(l, 8, out a7); o = new System.DateTime(a1, a2, a3, a4, a5, a6, a7); pushValue(l, true); pushValue(l, o); return(2); } else if (matchType(l, argc, 2, typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(System.DateTimeKind))) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); System.Int32 a7; checkType(l, 8, out a7); System.DateTimeKind a8; checkEnum(l, 9, out a8); o = new System.DateTime(a1, a2, a3, a4, a5, a6, a7, a8); pushValue(l, true); pushValue(l, o); return(2); } else if (argc == 10) { System.Int32 a1; checkType(l, 2, out a1); System.Int32 a2; checkType(l, 3, out a2); System.Int32 a3; checkType(l, 4, out a3); System.Int32 a4; checkType(l, 5, out a4); System.Int32 a5; checkType(l, 6, out a5); System.Int32 a6; checkType(l, 7, out a6); System.Int32 a7; checkType(l, 8, out a7); System.Globalization.Calendar a8; checkType(l, 9, out a8); System.DateTimeKind a9; checkEnum(l, 10, out a9); o = new System.DateTime(a1, a2, a3, a4, a5, a6, a7, a8, a9); pushValue(l, true); pushValue(l, o); return(2); } else if (argc <= 1) { o = new System.DateTime(); pushValue(l, true); pushObject(l, o); return(2); } return(error(l, "New object failed.")); } catch (Exception e) { return(error(l, e)); } }
private void btnFuzzyQuery_Click(object sender, System.EventArgs e) { OleDbConnection connection = null; OleDbDataReader dataReader = null; try { System.ValueType dt = this.dateTimePicker_start.Value; System.ValueType dt2 = this.dateTimePicker_stop.Value; System.ValueType valueType = default(System.DateTime); (System.DateTime)valueType = new System.DateTime(((System.DateTime)dt).Year, ((System.DateTime)dt).Month, ((System.DateTime)dt).Day, 0, 0, 0, 0); System.ValueType startdt = valueType; System.ValueType valueType2 = default(System.DateTime); (System.DateTime)valueType2 = new System.DateTime(((System.DateTime)dt2).Year, ((System.DateTime)dt2).Month, ((System.DateTime)dt2).Day, 23, 59, 59, 999); System.ValueType stopdt = valueType2; System.DateTime value = this.dateTimePicker_stop.Value; if (System.DateTime.Compare(this.dateTimePicker_start.Value, value) > 0) { MessageBox.Show("起始日期大于终止日期!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { string uStr = this.textBox_user.Text.ToString(); this.dataGridView1.Rows.Clear(); int iRecordCount = 0; try { connection = new OleDbConnection(); connection.ConnectionString = this.gLineTestProcessor.dbPathStr; connection.Open(); string sqlcommand; if (this.isAdminFlag) { if (0 >= uStr.Length) { sqlcommand = "select * from TOperationRecord where OperationTime Between #" + valueType + "# and #" + valueType2 + "# ORDER BY ID DESC"; } else { sqlcommand = "select * from TOperationRecord where UEID like '%" + uStr + "%' and OperationTime Between #" + valueType + "# and #" + valueType2 + "# ORDER BY ID DESC"; } } else if (0 >= uStr.Length) { sqlcommand = "select * from TOperationRecord where OperationTime Between #" + valueType + "# and #" + valueType2 + "# and UEID<>'admin' ORDER BY ID DESC"; } else { sqlcommand = "select * from TOperationRecord where UEID like '%" + uStr + "%' and OperationTime Between #" + valueType + "# and #" + valueType2 + "# and UEID<>'admin' ORDER BY ID DESC"; } dataReader = new OleDbCommand(sqlcommand, connection).ExecuteReader(); this.dataGridView1.AllowUserToAddRows = true; while (dataReader.Read()) { this.dataGridView1.Rows.Add(1); int num = iRecordCount + 1; this.dataGridView1.Rows[iRecordCount].Cells[0].Value = System.Convert.ToString(num); this.dataGridView1.Rows[iRecordCount].Cells[1].Value = dataReader["UEID"].ToString(); this.dataGridView1.Rows[iRecordCount].Cells[2].Value = dataReader["OperationTime"].ToString(); this.dataGridView1.Rows[iRecordCount].Cells[3].Value = dataReader["OperationContent"].ToString(); iRecordCount = num; } this.dataGridView1.AllowUserToAddRows = false; dataReader.Close(); dataReader = null; connection.Close(); connection = null; if (iRecordCount <= 0) { MessageBox.Show("查无记录!", "提示", MessageBoxButtons.OK); return; } } catch (System.Exception arg_376_0) { this.dataGridView1.AllowUserToAddRows = false; if (dataReader != null) { dataReader.Close(); dataReader = null; } if (connection != null) { connection.Close(); connection = null; } KLineTestProcessor.ExceptionRecordFunc(arg_376_0.StackTrace); goto IL_3A3; } this.qUserStr = uStr; this.qStartdt = startdt; this.qStopdt = stopdt; this.qMethod = 1; IL_3A3 :; } } catch (System.Exception arg_3A5_0) { KLineTestProcessor.ExceptionRecordFunc(arg_3A5_0.StackTrace); } }
public static long ToUnixtime(System.DateTime date) { System.DateTime unixStartTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0); System.TimeSpan timeSpan = date - unixStartTime; return(Convert.ToInt64(timeSpan.TotalSeconds)); }
public System.Threading.Tasks.Task <SPM.LinkPivotServiceReference.DisplayObject> DisplayLinkPivotPCDAsync(string upstreamSignalID, string upstreamDirection, string downstreamSignalID, string downstreamDirection, int delta, System.DateTime startDate, System.DateTime endDate, int maxYAxis) { return(base.Channel.DisplayLinkPivotPCDAsync(upstreamSignalID, upstreamDirection, downstreamSignalID, downstreamDirection, delta, startDate, endDate, maxYAxis)); }
static public System.DateTime ConvertJavaMiliSecondToDateTime(long javams) { System.DateTime _utcbasetime = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc); System.DateTime _dt = _utcbasetime.Add(new System.TimeSpan(javams * System.TimeSpan.TicksPerMillisecond)).ToLocalTime(); return(_dt); }
public System.Threading.Tasks.Task <SPM.LinkPivotServiceReference.AdjustmentObject[]> GetLinkPivotAsync(int routeId, System.DateTime startDate, System.DateTime endDate, int cycleTime, string direction, double bias, string biasDirection, bool monday, bool tuesday, bool wednesday, bool thursday, bool friday, bool saturday, bool sunday) { return(base.Channel.GetLinkPivotAsync(routeId, startDate, endDate, cycleTime, direction, bias, biasDirection, monday, tuesday, wednesday, thursday, friday, saturday, sunday)); }
private string DownloadURL(IEnumerable <string> ids, System.DateTime fromDate, System.DateTime toDate, HistQuotesInterval interval) { string[] idArr = MyHelper.EnumToArray(ids); if (idArr.Length == 0) { throw new ArgumentNullException("unmanagedIDs", "The passed list is empty"); } else { if (idArr.Length == 1) { if (idArr[0].Trim() == string.Empty) { throw new ArgumentNullException("id", "The passed ID is empty."); } else { System.Text.StringBuilder url = new System.Text.StringBuilder(); url.Append("http://ichart.yahoo.com/table.csv?s="); url.Append(Uri.EscapeDataString(MyHelper.CleanYqlParam(FinanceHelper.CleanIndexID(idArr[0]).ToUpper()))); url.Append("&a="); url.Append(fromDate.Month - 1); url.Append("&b="); url.Append(fromDate.Day); url.Append("&c="); url.Append(fromDate.Year); url.Append("&d="); url.Append(toDate.Month - 1); url.Append("&e="); url.Append(toDate.Day); url.Append("&f="); url.Append(toDate.Year); url.Append("&g="); url.Append(FinanceHelper.GetHistQuotesInterval(interval)); url.Append("&ignore=.csv"); return(url.ToString()); } } else { System.Text.StringBuilder url = new System.Text.StringBuilder(); url.Append("url in ("); for (int i = 0; i <= idArr.Length - 1; i++) { url.Append('\''); url.Append(this.DownloadURL(new string[] { MyHelper.CleanYqlParam(FinanceHelper.CleanIndexID(idArr[i]).ToUpper()) }, fromDate, toDate, interval)); url.Append('\''); if (i < idArr.Length - 1) { url.Append(','); } } url.Append(")"); return(MyHelper.YqlUrl("*", "csv", url.ToString(), null, true)); } } }
//TODO use string format string CreateFileName() { System.DateTime now = System.DateTime.Now; return(recordingFileNamePrefix + now.Day + now.Month + now.Year + "-" + now.Hour + now.Minute + now.Second); }
public static void AppliesTo(FixedYearlyCalendarRule obj, MethodReturnEventArgs <System.Boolean> e, System.DateTime date) { if (obj.CheckValidDate(date)) { e.Result = date.Day == obj.Day && date.Month == obj.Month; } }
/// <summary> /// Frame update /// </summary> public UpdateFrameRequest(System.DateTime timeStamp) { this.TimeStamp = timeStamp; }
// "In 3 days/weeks/months/years" = "3 days/weeks/months/years from now" public List <Token> ExtractRelativeDurationDateWithInPrefix(string text, List <ExtractResult> durationEr, DateObject reference) { var ret = new List <Token>(); var durations = new List <Token>(); foreach (var durationExtraction in durationEr) { var match = Config.DateUnitRegex.Match(durationExtraction.Text); if (match.Success) { durations.Add(new Token( durationExtraction.Start ?? 0, durationExtraction.Start + durationExtraction.Length ?? 0)); } } foreach (var duration in durations) { var beforeStr = text.Substring(0, duration.Start); var afterStr = text.Substring(duration.Start + duration.Length); if (string.IsNullOrWhiteSpace(beforeStr) && string.IsNullOrWhiteSpace(afterStr)) { continue; } ret.AddRange(ExtractInConnector(text, beforeStr, afterStr, duration, out bool success, inPrefix: true)); // Check also afterStr if (!success && Config.CheckBothBeforeAfter) { ret.AddRange(ExtractInConnector(text, afterStr, beforeStr, duration, out success, inPrefix: false)); } } return(ret); }
partial void OnLastChangeDateChanging(System.DateTime value);
// Check every integers and ordinal number for date private List <Token> NumberWithMonth(string text, DateObject reference) { var ret = new List <Token>(); var er = this.Config.OrdinalExtractor.Extract(text); er.AddRange(this.Config.IntegerExtractor.Extract(text)); foreach (var result in er) { // Check that the extracted number is not part of a decimal number (e.g. 123.24) if (result.Start > 1 && (text[(int)result.Start - 1].Equals(',') || text[(int)result.Start - 1].Equals('.')) && char.IsDigit(text[(int)result.Start - 2])) { continue; } var parsed = int.TryParse((this.Config.NumberParser.Parse(result).Value ?? 0).ToString(), out int num); if (!parsed || (num < 1 || num > 31)) { continue; } if (result.Start >= 0) { // Handling cases like '(Monday,) Jan twenty two' var prefixStr = text.Substring(0, result.Start ?? 0); var match = this.Config.MonthEnd.Match(prefixStr); if (match.Success) { var startIndex = match.Index; var endIndex = match.Index + match.Length + (result.Length ?? 0); ExtendWithWeekdayAndYear( ref startIndex, ref endIndex, Config.MonthOfYear.GetValueOrDefault(match.Groups["month"].Value, reference.Month), num, text, reference); ret.Add(new Token(startIndex, endIndex)); continue; } // Handling cases like 'for the 25th' var matches = this.Config.ForTheRegex.Matches(text); bool isFound = false; foreach (Match matchCase in matches) { if (matchCase.Success) { var ordinalNum = matchCase.Groups["DayOfMonth"].Value; if (ordinalNum == result.Text) { var endLength = 0; if (matchCase.Groups["end"].Value.Length > 0) { endLength = matchCase.Groups["end"].Value.Length; } ret.Add(new Token(matchCase.Index, matchCase.Index + matchCase.Length - endLength)); isFound = true; } } } if (isFound) { continue; } // Handling cases like 'Thursday the 21st', which both 'Thursday' and '21st' refer to a same date matches = this.Config.WeekDayAndDayOfMonthRegex.Matches(text); foreach (Match matchCase in matches) { if (matchCase.Success) { var ordinalNum = matchCase.Groups["DayOfMonth"].Value; if (ordinalNum == result.Text && matchCase.Groups["DayOfMonth"].Index == result.Start) { // Get week of day for the ordinal number which is regarded as a date of reference month var date = DateObject.MinValue.SafeCreateFromValue(reference.Year, reference.Month, num); var numWeekDayInt = (int)date.DayOfWeek; // Get week day from text directly, compare it with the weekday generated above // to see whether they refer to the same week day var extractedWeekDayStr = matchCase.Groups["weekday"].Value; if (!date.Equals(DateObject.MinValue) && numWeekDayInt == Config.DayOfWeek[extractedWeekDayStr]) { ret.Add(new Token(matchCase.Index, matchCase.Index + matchCase.Length)); isFound = true; } } } } if (isFound) { continue; } // Handling cases like 'Monday 21', which both 'Monday' and '21' refer to the same date // The year of expected date can be different to the year of referenceDate. matches = this.Config.WeekDayAndDayRegex.Matches(text); foreach (Match matchCase in matches) { if (matchCase.Success) { var matchLength = result.Start + result.Length - matchCase.Index; if (matchLength == matchCase.Length) { // check if day number is compatible with reference month if (DateObjectExtension.IsValidDate(reference.Year, reference.Month, num) || !this.Config.CheckBothBeforeAfter) { ret.Add(new Token(matchCase.Index, result.Start + result.Length ?? 0)); isFound = true; } } } } if (isFound) { continue; } // Handling cases like '20th of next month' var suffixStr = text.Substring(result.Start + result.Length ?? 0); var beginMatch = this.Config.RelativeMonthRegex.MatchBegin(suffixStr.Trim(), trim: true); if (beginMatch.Success && beginMatch.Index == 0) { var spaceLen = suffixStr.Length - suffixStr.Trim().Length; var resStart = result.Start; var resEnd = resStart + result.Length + spaceLen + beginMatch.Length; // Check if prefix contains 'the', include it if any var prefix = text.Substring(0, resStart ?? 0); var prefixMatch = this.Config.PrefixArticleRegex.Match(prefix); if (prefixMatch.Success) { resStart = prefixMatch.Index; } ret.Add(new Token(resStart ?? 0, resEnd ?? 0)); } // Handling cases like 'second Sunday' suffixStr = text.Substring(result.Start + result.Length ?? 0); beginMatch = this.Config.WeekDayRegex.MatchBegin(suffixStr.Trim(), trim: true); if (beginMatch.Success && num >= 1 && num <= 5 && result.Type.Equals(Number.Constants.SYS_NUM_ORDINAL, StringComparison.Ordinal)) { var weekDayStr = beginMatch.Groups["weekday"].Value; if (this.Config.DayOfWeek.ContainsKey(weekDayStr)) { var spaceLen = suffixStr.Length - suffixStr.Trim().Length; ret.Add(new Token(result.Start ?? 0, result.Start + result.Length + spaceLen + beginMatch.Length ?? 0)); } } } // For cases like "I'll go back twenty second of June" if (result.Start + result.Length < text.Length) { var afterStr = text.Substring(result.Start + result.Length ?? 0); var match = this.Config.OfMonth.Match(afterStr); if (match.Success) { var startIndex = result.Start ?? 0; var endIndex = (result.Start + result.Length ?? 0) + match.Length; ExtendWithWeekdayAndYear(ref startIndex, ref endIndex, Config.MonthOfYear.GetValueOrDefault(match.Groups["month"].Value, reference.Month), num, text, reference); ret.Add(new Token(startIndex, endIndex)); } } } return(ret); }
// TODO: Remove the parsing logic from here private void ExtendWithWeekdayAndYear(ref int startIndex, ref int endIndex, int month, int day, string text, DateObject reference) { var year = reference.Year; // Check whether there's a year var suffix = text.Substring(endIndex); var prefix = text.Substring(0, startIndex); endIndex += GetYearIndex(suffix, ref year, out bool success, inPrefix: false); // Check also in prefix if (!success && Config.CheckBothBeforeAfter) { startIndex -= GetYearIndex(prefix, ref year, out success, inPrefix: true); } var date = DateObject.MinValue.SafeCreateFromValue(year, month, day); // Check whether there's a weekday bool isMatchInSuffix = false; var matchWeekDay = this.Config.WeekDayEnd.Match(prefix); // Check for weekday in the suffix if (!matchWeekDay.Success) { matchWeekDay = this.Config.WeekDayStart.Match(suffix); isMatchInSuffix = matchWeekDay.Success; } if (matchWeekDay.Success) { // Get weekday from context directly, compare it with the weekday extraction above // to see whether they reference the same weekday var extractedWeekDayStr = matchWeekDay.Groups["weekday"].Value; var numWeekDayStr = date.DayOfWeek.ToString().ToLowerInvariant(); if (Config.DayOfWeek.TryGetValue(numWeekDayStr, out var weekDay1) && Config.DayOfWeek.TryGetValue(extractedWeekDayStr, out var weekDay2)) { if (!date.Equals(DateObject.MinValue) && weekDay1 == weekDay2) { if (!isMatchInSuffix) { startIndex = matchWeekDay.Index; } else { endIndex += matchWeekDay.Length; } } } } }