public MilkSessionView(IEnumerable <Milk> milks, DateTime dateToDisplay, TraqType traqType) { if (milks == null) { throw new ArgumentNullException(); } SessionDate = dateToDisplay.Date; DailyMilks = milks.Where(milk => milk.StartTimePst.Date == SessionDate).OrderByDescending(milk => milk.StartTimePst); Total = milks.Count(); IsMaxDate = !(milks.Any(milk => milk.StartTimePst >= SessionDate.AddDays(1))); IsMinDate = !(milks.Any(milk => milk.StartTimePst < SessionDate)); IsActiveSession = milks.Any(milk => milk.EndTimeUtc == null); ChorerStats = milks.GroupBy(milk => milk.Chorer) .Select(group => new ChorerSessionStat() { UserName = group.First().Chorer?.GetDescription() ?? "Unknown", Total = group.Count() }); HourlyVolumeStats = milks.Where(milk => milk.Volume != null).Select(group => new ValueDateSessionStat() { Date = group.StartTimePst, Value = (int)group.Volume }); DailyVolumeStats = milks.Where(milk => milk.Volume != null) .GroupBy(milk => milk.StartTimePst.Date).Select(group => new ValueDateSessionStat() { Date = group.First().StartTimePst, Value = group.Sum(g => (int)g.Volume) }); TraqType = traqType; }
public seekerSessions() { Random rndSession = new Random(); this.SessionDate = DateTime.Now; this.SessionID = frmMain.domainAccountData[1] + "-" + SessionDate.ToString("yyyyMMddmmss") + "-" + rndSession.Next(0, 1000); this.Objects = new List <seekerObjects>(); }
public ActionResult Dates(SessionDate sessionDate) { if(ModelState.IsValid) { _sessionRepository.AddDatesToSession(sessionDate.SessionId, new List<SessionDate> { sessionDate }); return RedirectToAction("Edit", new { id = sessionDate.SessionId }); } return View(sessionDate); }
public bool CanBuy(bool IsPreferred, bool IsAdmin) { if (IsAdmin) { return(true); } var timeNow = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, _pstZone); var timeCanBuy = SessionDate.AddDays(-1 * _buyDayMinimum).AddHours(2); return(timeNow >= (IsPreferred ? timeCanBuy.AddDays(-1) : timeCanBuy)); }
internal string WikiLine(int sessionNumber) { var sb = new StringBuilder(); var strSessionNumber = (sessionNumber < 10) ? " " + sessionNumber.ToString() : sessionNumber.ToString(); sb.Append($"|| { strSessionNumber} ||"); sb.Append($" {SessionDate.ToString("ddd dd")} ||"); sb.Append($" {StartTime} {SessionTypeIndicator(SessionType)} ||"); sb.Append($" {ColumnSized(40,Activity.Description)} ||"); sb.Append($" {ColumnSized(20,Activity.Comment)} ||"); return(sb.ToString()); }
public override string ToString() { return($@"{SessionDate.ToString("yyyy-MM-dd")} { SessionDate.ToString("ddd") } { StartTime } { SessionType } { Activity.Description } { Activity.Comment }" ); }
public DiaperChangeView(IEnumerable <Diaper> diapers, DateTime dateToDisplay) { if (diapers == null) { throw new ArgumentNullException(); } SessionDate = dateToDisplay.Date; Total = diapers.Count(); IsMaxDate = !(diapers.Any(diaper => diaper.ChangeTimePst >= SessionDate.AddDays(1))); IsMinDate = !(diapers.Any(diaper => diaper.ChangeTimePst < SessionDate)); ChorerStats = diapers.GroupBy(diaper => diaper.Chorer) .Select(group => new ChorerSessionStat() { UserName = group.First().Chorer?.GetDescription() ?? "Unknown", Total = group.Count() }); DailyChanges = diapers.Where(diaper => diaper.ChangeTimePst.Date == SessionDate).OrderByDescending(diaper => diaper.ChangeTimePst); }
protected override void PackRequest() { MemoryStream requestStream = new MemoryStream(); BinaryWriter requestWriter = new BinaryWriter(requestStream, Encoding.Unicode); requestWriter.Write(OperatorId); requestWriter.Write(SessionNum); if (SessionDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture).Length > 0) { requestWriter.Write((ushort)SessionDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture).Length); requestWriter.Write(SessionDate.ToString("MM/dd/yyyy", CultureInfo.InvariantCulture).ToCharArray()); } else { throw new Exception("GetDailySalesData: Invalid date."); } // Set the bytes to be sent. m_requestPayload = requestStream.ToArray(); // Close the streams. requestWriter.Close(); }
public string SessionKey() { return(SessionDate.ToString("yyyy-MM-dd") + StartTime); }
public SettlementSession GetPrevious() { return(new SettlementSession(Instrument, Instrument.ThisOrPreviousTradingDay(SessionDate.AddDays(-1)))); }
public SettlementSession GetNext() { return(new SettlementSession(Instrument, Instrument.ThisOrNextTradingDay(SessionDate.AddDays(1)))); }