Update_6_38.cs 875 B

123456789101112131415161718192021222324252627282930
  1. using Comal.Classes;
  2. using InABox.Core;
  3. using InABox.Database;
  4. namespace PRS.Shared;
  5. public class Update_6_38 : DatabaseUpdateScript
  6. {
  7. public override VersionNumber Version => new (6, 38);
  8. public override bool Update()
  9. {
  10. Logger.Send(LogType.Information, "", "Converting Job Requisition Dates to Due Dates");
  11. List<JobRequisition> updates = new List<JobRequisition>();
  12. var columns = new Columns<JobRequisition>(x => x.ID);
  13. columns.Add("Date");
  14. CoreTable requis = DbFactory.Provider.Query<JobRequisition>(null, columns);
  15. foreach (var row in requis.Rows)
  16. {
  17. var requi = row.ToObject<JobRequisition>();
  18. requi.Approved = row.Get<DateTime>("Date");
  19. updates.Add(requi);
  20. }
  21. DbFactory.Provider.Save(updates);
  22. return true;
  23. }
  24. }