1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- using Comal.Classes;
- using InABox.Core;
- using InABox.Database;
- namespace PRS.Shared;
- public class Update_6_31 : DatabaseUpdateScript
- {
- public override VersionNumber Version => new (6, 31);
-
- private static Dictionary<string, Tuple<string, string>> _6_31_module_map = new()
- {
- { "Assignments", new("Assignments", "Assignments") },
- { "Daily Report", new("Daily Report", "Assignments") },
- { "Delivered On Site", new("Delivered On Site", "Delivery Items") },
- { "Deliveries", new("Deliveries", "Deliveries") },
- { "Digital Forms", new("Digital Forms", "DigitalForm") },
- { "Employee List", new("Employees", "Employee") },
- { "Equipment List", new("Equipment", "Equipment") },
- { "Factory Floor", new("Factory", "Manufacturing Packets") },
- { "Incoming Consignments", new("Consignments", "Consignment") },
- { "Manufacturing Status", new("Manufacturing Packets", "Manufacturing Packets") },
- { "Product List", new("Products", "Products") },
- { "Projects", new("Job Details", "Job Details") },
- { "Purchase Orders", new("Purchase Orders", "PurchaseOrder") },
- { "Quotes", new("Quotes", "Quotes") },
- { "Rack List", new("Shipping", "Shipments") },
- { "Site Requisitions", new("Requisitions", "Requisition") },
- { "Staff TimeSheets", new("Timesheets", "TimeSheet") },
- { "Stock Locations", new("Stock Locations", "StockLocation") },
- { "Stock Movements", new("Stock Movements", "StockMovement") },
- { "Task List", new("Tasks By Status", "Kanban") },
- };
-
- public override bool Update()
- {
- var modules = DbFactory.Provider.Query(new Filter<CustomModule>().All())
- .Rows.Select(x => x.ToObject<CustomModule>()).ToList();
- foreach(var module in modules)
- {
- if (!string.IsNullOrWhiteSpace(module.Section))
- {
- if (_6_31_module_map.TryGetValue(module.Section, out var map))
- {
- module.Section = map.Item1;
- module.DataModel = map.Item2;
- module.AllRecords = true;
- }
- else
- {
- Logger.Send(LogType.Error, "", $"Custom Module '{module.Name}' has section name '{module.Section}' and will no longer be visible!");
- }
- }
- }
- DbFactory.Provider.Save(modules);
- return true;
- }
-
- }
|