public override string ToString() { return(string.Format("[{0} -> {1}]/{2}: {3}", FromTime.ToString("HH:mm"), ToTime.ToString("HH:mm"), this.TotalHours(), this.TimeSheetType.ToString())); }
public override string ToString() { if (!String.IsNullOrEmpty(Hospital)) { return(FromTime.ToString("hh\\:mm") + " até " + ToTime.ToString("hh\\:mm") + " no " + Hospital); } return(FromTime.ToString("hh\\:mm") + " até " + ToTime.ToString("hh\\:mm")); }
private void UpdateTimespan() { Properties.Settings.Default.FromTime = FromTime.ToString("o"); Properties.Settings.Default.ToTime = ToTime.ToString("o"); Properties.Settings.Default.Save(); overviewPage.UpdateTimespan(FromTime, ToTime); }
public override string ToString() { return(string.Format( "{0}\n{1} - {2}\n{3}", Subject, FromTime.ToString("HH:mm"), ToTime.ToString("HH:mm"), Teacher )); }
public override string ToString() { if (Every == 1) { return("every hour between " + FromTime.ToString(@"H\:mm") + " and " + ToTime.ToString(@"H\:mm")); } else { return("every " + Every.ToString() + " hours between " + FromTime.ToString(@"H\:mm") + " and " + ToTime.ToString(@"H\:mm")); } }
/// <summary> /// Top of the subreddit from a particular time. /// </summary> /// <param name="timePeriod">Timeperiod you want to start at <seealso cref="FromTime"/></param> /// <param name="max">Maximum number of records to return.</param> /// <returns>The top of the subreddit from a specific time</returns> public Listing <Post> GetTop(FromTime timePeriod, int max = -1) { var period = timePeriod.ToString("g").ToLower(); if (Name == "/") { return(Listing <Post> .Create(WebAgent, "/top.json?t=" + period, max, 100)); } return(Listing <Post> .Create(WebAgent, $"{SubredditTopUrl}?t={period}", max, 100)); }
public override string ToString() { return(string.Concat(FromTime.ToString("h:mm"), " - ", ToTime.ToString("h:mm"))); }
static string QueryString(Sort sort, int limit, FromTime time) => $"?sort={sort.ToString("g")}&limit={limit}&t={time.ToString("g")}";
static void Main(string[] args) { bool isSuccess = false; try { SocketOptions options = new SocketOptions(); options.SetConnectTimeoutMillis(int.MaxValue); options.SetReadTimeoutMillis(int.MaxValue); options.SetTcpNoDelay(true); File.AppendAllText(logFile, "Started pushing data at " + DateTime.Now); if (cassandraUserName != null && cassandraUserName.Length > 0 && cassandraPassword != null && cassandraPassword.Length > 0) { cluster = Cluster.Builder().AddContactPoints(new string[] { cassandraIp }) .WithPort(cassandraPort) .WithCredentials(cassandraUserName, cassandraPassword) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue).Build(); } else { cluster = Cluster.Builder().AddContactPoints(new string[] { cassandraIp }).WithPort(cassandraPort).WithSocketOptions(options).WithQueryTimeout(int.MaxValue).Build(); } currentSession = cluster.Connect("vegamtagdata"); eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, eventHubName); StringBuilder cqlCommandBuilder = new StringBuilder(); cqlCommandBuilder.Append(" select signalid, monthyear, fromtime, totime, avg, max, min, readings, insertdate "); cqlCommandBuilder.Append(" from tagdatacentral where signalid = #signalid and monthyear in (#monthyear) and fromtime > #starttime and fromtime < #endtime"); string cqlCommand = cqlCommandBuilder.ToString(); signalsBuffer.OnBufferLimitReached += SendDataToAzure; IEnumerable<string> signalIdList = File.ReadLines(signalIdListFile); SignalsInfo currentSignal; int count = 1; foreach (var line in signalIdList) { Console.WriteLine("Currently processing the line number: " + count++); File.AppendAllText(logFile, "Currently processing the line" + line); string[] items = line.Split(','); isSuccess = long.TryParse(items[2], out long FromTime); if (!isSuccess) { File.AppendAllText(failedCassandraGetTags, line + Environment.NewLine); continue; } var currentCommand = cqlCommand.Replace("#signalid", items[0]); currentCommand = currentCommand.Replace("#monthyear", GetMonthYearBetween(FromTime, SyncEndTime)); currentCommand = currentCommand.Replace("#starttime", FromTime.ToString()); currentCommand = currentCommand.Replace("#endtime", SyncEndTime.ToString()); try { var resultRowSet = currentSession.Execute(currentCommand); var itemcount = 0; //Just some more code changes foreach (var row in resultRowSet) { currentSignal = new SignalsInfo(); currentSignal.ID = Convert.ToInt32(row["signalid"]); currentSignal.MYear = row["monthyear"].ToString(); currentSignal.FTime = Convert.ToInt64(row["fromtime"]); currentSignal.TTime = Convert.ToInt64(row["totime"]); currentSignal.Avg = Convert.ToDecimal(row["avg"]); currentSignal.Max = Convert.ToDecimal(row["max"]); currentSignal.Min = Convert.ToDecimal(row["min"]); currentSignal.Data = row["readings"].ToString(); currentSignal.CTime = Convert.ToInt64(row["insertdate"]); signalsBuffer.AddSignal(currentSignal); itemcount++; } Console.WriteLine("Finished processing the line number: " + count + " With a total item count of:" + itemcount); File.AppendAllText(logFile, "Finished processing the line" + line + " With a total item count of:" + itemcount); } catch (Exception) { File.AppendAllText(failedCassandraGetTags, line + Environment.NewLine); continue; } } signalsBuffer.FlushData(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main(string[] args) { try { SocketOptions options = new SocketOptions(); options.SetConnectTimeoutMillis(int.MaxValue); options.SetReadTimeoutMillis(int.MaxValue); options.SetTcpNoDelay(true); centralUrl = string.Format("http://{0}", centralUrl); if (cassandraUserName != null && cassandraUserName.Length > 0 && cassandraPassword != null && cassandraPassword.Length > 0) { cluster = Cluster.Builder().AddContactPoints(new string[] { cassandraIp }) .WithPort(cassandraPort) .WithCredentials(cassandraUserName, cassandraPassword) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue).Build(); } else { cluster = Cluster.Builder().AddContactPoints(new string[] { cassandraIp }) .WithPort(cassandraPort) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue) .Build(); } currentSession = cluster.Connect("vegamtagdata"); string currentSignalId = ""; int currentItemCount = 0; StringBuilder cqlCommandBuilder = new StringBuilder(); cqlCommandBuilder.Append(" select signalid, monthyear, fromtime, totime, avg, max, min, readings, insertdate "); cqlCommandBuilder.Append(" from tagdatacentral where signalid = #signalid and monthyear in (#monthyear) and fromtime > #starttime and fromtime < #endtime"); string cqlCommand = cqlCommandBuilder.ToString(); signalsBuffer.OnBufferLimitReached += On_BufferLimitReached; IEnumerable <string> signalIdList = File.ReadLines(signalIdListFile); SignalsInfo currentSignal; foreach (var line in signalIdList) { if (string.IsNullOrWhiteSpace(line)) { continue; } string[] items = line.Split(','); currentSignalId = items[0]; long.TryParse(items[2], out long FromTime); long.TryParse(items[3], out long SyncEndTime); currentItemCount = 0; var currentCommand = cqlCommand.Replace("#signalid", items[0]); currentCommand = currentCommand.Replace("#monthyear", GetMonthYearBetween(FromTime, SyncEndTime)); currentCommand = currentCommand.Replace("#starttime", FromTime.ToString()); currentCommand = currentCommand.Replace("#endtime", SyncEndTime.ToString()); try { var resultRowSet = currentSession.Execute(currentCommand); foreach (var row in resultRowSet) { currentSignal = new SignalsInfo(); currentSignal.ID = Convert.ToInt32(row["signalid"]); currentSignal.MYear = row["monthyear"].ToString(); currentSignal.FTime = Convert.ToInt64(row["fromtime"]); currentSignal.TTime = Convert.ToInt64(row["totime"]); currentSignal.Avg = Convert.ToDecimal(row["avg"]); currentSignal.Max = Convert.ToDecimal(row["max"]); currentSignal.Min = Convert.ToDecimal(row["min"]); currentSignal.Data = row["readings"].ToString(); currentSignal.CTime = Convert.ToInt64(row["insertdate"]); currentItemCount++; signalsBuffer.AddSignal(currentSignal); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Completed pushing data for signalId " + currentSignalId + " with count: " + currentItemCount); File.AppendAllText(SuccessFile, currentSignalId + Environment.NewLine); } signalsBuffer.FlushData(); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static List <Bookings> LoadReservationList() { list_result = Initialization.LoadBookingList(CustFname, CustLname, DOB, Insurance, Vname, FromDate, ToDate, Total_Days, Convert.ToDateTime(FromTime.ToString("HH:mm")), Convert.ToDateTime(ToTime.ToString("HH:mm")), RentalDate, VID, PickUp, DropOff); return(list_result); }
static void Main(string[] args) { try { SocketOptions options = new SocketOptions(); options.SetConnectTimeoutMillis(int.MaxValue); options.SetReadTimeoutMillis(int.MaxValue); options.SetTcpNoDelay(true); if (SourceCassandraUserName != null && SourceCassandraUserName.Length > 0 && SourceCassandraPassword != null && SourceCassandraPassword.Length > 0) { SourceCluster = Cluster.Builder().AddContactPoints(new string[] { SourceCassandraIp }) .WithPort(SourceCassandraPort) .WithCredentials(SourceCassandraUserName, SourceCassandraPassword) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue).Build(); } else { SourceCluster = Cluster.Builder().AddContactPoints(new string[] { SourceCassandraIp }) .WithPort(SourceCassandraPort) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue) .Build(); } SourceCurrentSession = SourceCluster.Connect("vegamtagdata"); Console.WriteLine("Connected to Source Cassandra"); if (DestinationCassandraUserName != null && DestinationCassandraUserName.Length > 0 && DestinationCassandraPassword != null && DestinationCassandraPassword.Length > 0) { DestinationCluster = Cluster.Builder().AddContactPoints(new string[] { DestinationCassandraIp }) .WithPort(DestinationCassandraPort) .WithCredentials(DestinationCassandraUserName, DestinationCassandraPassword) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue).Build(); } else { DestinationCluster = Cluster.Builder().AddContactPoints(new string[] { DestinationCassandraIp }) .WithPort(DestinationCassandraPort) .WithSocketOptions(options) .WithQueryTimeout(int.MaxValue) .Build(); } DestinationCurrentSession = DestinationCluster.Connect("vegamtagdata"); eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, eventHubName); StringBuilder cqlCommandBuilder1 = new StringBuilder(); cqlCommandBuilder1.Append(" insert into tagdatacentral (signalid, monthyear, fromtime, totime, avg, max, min, readings, insertdate) "); cqlCommandBuilder1.Append(" values(?,?,?,?,?,?,?,?,?)"); insertPreparedStmt = DestinationCurrentSession.Prepare(cqlCommandBuilder1.ToString()); Console.WriteLine("Connected to Destination Cassandra"); string currentSignalId = ""; int currentItemCount = 0; StringBuilder cqlCommandBuilder = new StringBuilder(); cqlCommandBuilder.Append(" select signalid, monthyear, fromtime, totime, avg, max, min, readings, insertdate "); cqlCommandBuilder.Append(" from tagdatacentral where signalid = #signalid and monthyear = #monthyear and fromtime > #starttime and fromtime < #endtime"); string cqlCommand = cqlCommandBuilder.ToString(); signalsBuffer.OnBufferLimitReached += On_BufferLimitReached; signalsBuffer.OnBufferLimitReached += SendDataToAzure; IEnumerable <string> signalIdList = File.ReadLines(TagListFileName); SignalsInfo currentSignal; foreach (var line in signalIdList) { if (string.IsNullOrWhiteSpace(line)) { continue; } string[] items = line.Split(','); currentSignalId = items[0]; long.TryParse(items[2], out long FromTime); long.TryParse(items[3], out long SyncEndTime); currentItemCount = 0; var currentCommand = cqlCommand.Replace("#signalid", items[0]); currentCommand = currentCommand.Replace("#monthyear", items[1]); currentCommand = currentCommand.Replace("#starttime", FromTime.ToString()); currentCommand = currentCommand.Replace("#endtime", SyncEndTime.ToString()); try { var resultRowSet = SourceCurrentSession.Execute(currentCommand); foreach (var row in resultRowSet) { currentSignal = new SignalsInfo(); currentSignal.ID = Convert.ToInt32(row["signalid"]); currentSignal.MYear = row["monthyear"].ToString(); currentSignal.FTime = Convert.ToInt64(row["fromtime"]); currentSignal.TTime = Convert.ToInt64(row["totime"]); currentSignal.Avg = Convert.ToDecimal(row["avg"]); currentSignal.Max = Convert.ToDecimal(row["max"]); currentSignal.Min = Convert.ToDecimal(row["min"]); currentSignal.Data = row["readings"].ToString(); currentSignal.CTime = Convert.ToInt64(row["insertdate"]); currentItemCount++; signalsBuffer.AddSignal(currentSignal); } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("Completed pushing data for signalId " + currentSignalId + " with count: " + currentItemCount); File.AppendAllText(SuccessFile, currentSignalId + Environment.NewLine); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public override string ToString() { CultureInfo nlBE = new CultureInfo("nl-BE"); return(Employee.Firstname + " " + Employee.Lastname + ": van " + FromTime.ToString(nlBE) + " tot " + UntilTime.ToString(nlBE)); }