using Comal.Classes; using InABox.Core; using InABox.Wpf; using InABox.WPF; using javax.swing; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace PRSDesktop.Integrations.Logikal { public static class LogikalCommon { //public static JobStatus? JobStatus { get; private set; } //public static TaxCode? TaxCode { get; private set; } //public static ProductDimensionUnit? ProfileUOM { get; private set; } //public static ProductDimensionUnit? ComponentUOM { get; private set; } //public static ProductDimensionUnit? GlassUOM { get; private set; } public static bool CheckSettings(LogikalSettings settings) { // List errors = new(); // // MultiQuery query = new MultiQuery(); // // Progress.ShowModal("Checking Settings", progress => // { // // if (settings.ImportJobs) // query.Add( // new Filter(x => x.ID).IsEqualTo(settings.JobStatus.ID), // Columns.All() // ); // // query.Add( // new Filter(x => x.ID).IsEqualTo(settings.TaxCode.ID), // Columns.All() // ); // // query.Add( // new Filter(x => x.ID) // .InList([settings.ProfileUom.ID, settings.GasketUom, settings.ComponentUom.ID, settings.GlassUom.ID]), // Columns.All() // ); // // query.Query(); // }); // // if (settings.ImportJobs) // { // JobStatus = query.Get().ToObjects().FirstOrDefault(); // if (JobStatus == null) // errors.Add("Job Status has not been configured correctly!"); // } // // TaxCode = query.Get().ToObjects().FirstOrDefault(); // if (TaxCode == null) // errors.Add("Tax Code has not been configured correctly!"); // // var _uoms = query.Get().ToObjects().ToList(); // ProfileUOM = _uoms.FirstOrDefault(x => string.Equals(x.Code, settings.ProfileUom)); // ComponentUOM = _uoms.FirstOrDefault(x => string.Equals(x.Code, settings.ComponentUom)); // GlassUOM = _uoms.FirstOrDefault(x => string.Equals(x.Code, settings.GlassUom)); // // if (ProfileUOM == null) // errors.Add("Profile UOM has not been configured correctly!"); // // if (ComponentUOM == null) // errors.Add("Component UOM has not been configured correctly!"); // // if (GlassUOM == null) // errors.Add("Glass UOM has not been configured correctly!"); // // if (errors.Any()) // { // MessageWindow.ShowMessage( // $"Some Configuration Settings are incorrect:\n\n- {string.Join("\n- ", errors)}\n\nPlease correct this and try again.", // "Error"); // return false; // } return true; } } }