public string ToString(string format, IFormatProvider fp) { if (String.IsNullOrEmpty(format)) { format = "f"; } char first = format.ToLower()[0]; if (format.Length == 1) { switch (first) { case 'c': return(Caption); case 'd': return(DateTaken.ToShortDateString()); case 'f': return(FileName); } } else if (first == 'd') { return(DateTaken.ToString( format.Substring(1), fp)); } throw new FormatException(); }
public override string ToString() { /// <summary> /// Override ToString method for display, although not used /// </summary> return(Title.ToString() + "\t" + DateTaken.ToShortDateString() + "\t" + Description.ToString()); }
public bool Equals(ImageBase other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(Path, other.Path) && Size == other.Size && DateModified.Equals(other.DateModified) && Height == other.Height && Width == other.Width && DateTaken.Equals(other.DateTaken) && Latitude.Equals(other.Latitude) && Longitude.Equals(other.Longitude)); }
public IActionResult deleteAsst(int id) { if (HttpContext.Session.GetInt32("Permission") < 9) { return(RedirectToAction("updateAllKids")); } if (HttpContext.Session.GetInt32("Permission") == null) { return(RedirectToAction("Index", "Home")); } DateTaken deleteThisAsst = _context.DateTaken.SingleOrDefault(x => x.id == id); _context.DateTaken.Remove(deleteThisAsst); _context.SaveChanges(); return(RedirectToAction("updateAssessmentPage", "Update", new { id = HttpContext.Session.GetInt32("kidId") })); }
public IActionResult updateAssessments(DateTakenViewModel model) { if (HttpContext.Session.GetInt32("Permission") < 5) { return(RedirectToAction("dashboard", "Dashboard")); } if (HttpContext.Session.GetInt32("Permission") == null) { return(RedirectToAction("Index", "Home")); } if (!ModelState.IsValid) { int?id = HttpContext.Session.GetInt32("kidId"); ViewBag.singleKid = _context.Kids.Where(kiddo => kiddo.id == id).Include(t => t.Teacher).ToArray(); List <DateTaken> DateTakens = _context.DateTaken.Where(x => x.KidId == id).Include(a => a.Assessment).OrderByDescending(d => d.Date).ToList(); ViewBag.assessmentsTaken = DateTakens; TimeSpan age = DateTime.Now - ViewBag.singleKid[0].Birthdate; double decimalYears = age.TotalDays / 365; var years = Math.Truncate(decimalYears); double decimalMonths = (age.TotalDays % 365) / 30; var months = Convert.ToInt32(decimalMonths); if (months == 12) { months = 11; } ViewBag.years = years; ViewBag.months = months; ViewBag.assessments = _context.Assessments; ViewBag.permission = HttpContext.Session.GetInt32("Permission"); return(View("updateAssessmentPage")); } Kid kid = _context.Kids.SingleOrDefault(x => x.id == HttpContext.Session.GetInt32("kidId")); Assessment assessment = _context.Assessments.SingleOrDefault(a => a.Name == model.Asst); DateTaken newDateTaken = new DateTaken { Date = model.Date, Score = model.Score, Progress = model.Progress, Comment = model.Comment, AssessmentId = assessment.id, KidId = kid.id }; _context.DateTaken.Add(newDateTaken); _context.SaveChanges(); return(RedirectToAction("updateAssessmentPage", new { id = HttpContext.Session.GetInt32("kidId") })); }
public override int GetHashCode() { // ReSharper disable NonReadonlyMemberInGetHashCode unchecked { var hashCode = Path != null?Path.GetHashCode() : 0; hashCode = (hashCode * 397) ^ Size.GetHashCode(); hashCode = (hashCode * 397) ^ DateModified.GetHashCode(); hashCode = (hashCode * 397) ^ (int)Height; hashCode = (hashCode * 397) ^ (int)Width; hashCode = (hashCode * 397) ^ DateTaken.GetHashCode(); hashCode = (hashCode * 397) ^ Latitude.GetHashCode(); hashCode = (hashCode * 397) ^ Longitude.GetHashCode(); return(hashCode); } }
public string ToString(string format, IFormatProvider fp) { if (String.IsNullOrEmpty(format)) { format = "f"; } char first = format.ToLower()[0]; if (format.Length == 1) { switch (first) { case 'c': return(Caption); case 'd': return(DateTaken.ToShortDateString()); case 'f': return(FileName); } } else { string theRest = format.Substring(1); if (first == 'd') { return(DateTaken.ToString(theRest, fp)); } else if (first == 'f') { if (theRest == "b") { return(Path.GetFileName(FileName)); } else if (theRest == "B") { return(Path.GetFileNameWithoutExtension(FileName)); } } } throw new FormatException(); }
public string ToString(string format, IFormatProvider formatProvider) { if (string.IsNullOrEmpty(format)) { format = "f"; } char first = format.ToLower()[0]; if (format.Length == 1) { switch (first) { case 'c': return(Caption); case 'd': return(DateTaken.ToShortDateString()); case 'f': return(FileName); } } else if (first == 'd') { return(DateTaken.ToString(format.Substring(1), formatProvider)); } if (format.Length == 2) { switch (format) { case "fb": return(FileName); case "fB": return(Path.GetFileNameWithoutExtension(FileName)); } } throw new FormatException(); //throw new Exception("The method or " + // "operation is not implemented."); }
/// <summary> /// Returns the sub item item text corresponding to the specified column type. /// </summary> /// <param name="type">The type of information to return.</param> /// <returns>Formatted text for the given column type.</returns> public string GetSubItemText(ColumnType type) { switch (type) { case ColumnType.DateAccessed: if (DateAccessed == DateTime.MinValue) { return(""); } else { return(DateAccessed.ToString("g")); } case ColumnType.DateCreated: if (DateCreated == DateTime.MinValue) { return(""); } else { return(DateCreated.ToString("g")); } case ColumnType.DateModified: if (DateModified == DateTime.MinValue) { return(""); } else { return(DateModified.ToString("g")); } case ColumnType.FileName: return(FileName); case ColumnType.Name: return(Text); case ColumnType.FilePath: return(FilePath); case ColumnType.FileSize: if (FileSize == 0) { return(""); } else { return(Utility.FormatSize(FileSize)); } case ColumnType.FileType: return(FileType); case ColumnType.Dimensions: if (Dimensions == Size.Empty) { return(""); } else { return(string.Format("{0} x {1}", Dimensions.Width, Dimensions.Height)); } case ColumnType.Resolution: if (Resolution == SizeF.Empty) { return(""); } else { return(string.Format("{0} x {1}", Resolution.Width, Resolution.Height)); } case ColumnType.ImageDescription: return(ImageDescription); case ColumnType.EquipmentModel: return(EquipmentModel); case ColumnType.DateTaken: if (DateTaken == DateTime.MinValue) { return(""); } else { return(DateTaken.ToString("g")); } case ColumnType.Artist: return(Artist); case ColumnType.Copyright: return(Copyright); case ColumnType.ExposureTime: return(ExposureTime); case ColumnType.FNumber: if (FNumber == 0.0f) { return(""); } else { return(FNumber.ToString("f2")); } case ColumnType.ISOSpeed: if (ISOSpeed == 0) { return(""); } else { return(ISOSpeed.ToString()); } case ColumnType.ShutterSpeed: return(ShutterSpeed); case ColumnType.Aperture: return(Aperture); case ColumnType.UserComment: return(UserComment); default: throw new ArgumentException("Unknown column type", "type"); } }
public override string ToString() { return(Title.ToString() + "\t" + DateTaken.ToShortDateString() + "\t" + Description.ToString()); }
public override int GetHashCode() { return(ProcessList.GetHashCode() ^ DateTaken.GetHashCode() ^ SafeMode.GetHashCode()); }
public override bool Equals(object obj) { if (obj == null) { return(false); } Snapshot s = obj as Snapshot; if ((object)s == null) { return(false); } return((ProcessList.All(s.ProcessList.Contains) && ProcessList.Count == s.ProcessList.Count) && (DateTaken.ToString() == s.DateTaken.ToString()) && (SafeMode == s.SafeMode)); }
public override string ToString() { return(Path.GetFileNameWithoutExtension(FileName) + "\t" + DateTaken.ToString("s")); }
public void AdjustTime(TimeSpan span) { DateTaken = DateTaken?.Add(span); ResetNewFileName(); }
public override string ToString() { return($"{FileInfo.FullName} {DateTaken.ToString()}"); }
public bool IsOverDue() { return(DateTaken.Add(LoanPeriod) > DateTime.Now); }