Ejemplo n.º 1
0
 /// <summary>
 /// Does the archiving of the Shepherd content.
 /// </summary>
 /// <param name="URL">The requested URL.</param>
 /// <param name="sqlConnectionString">The SQL connection string.</param>
 /// <param name="archivalDelay">The archival delay.</param>
 /// <param name="rowLimit">The row limit.</param>
 /// <param name="reportProgress">An action to trace progress in a log stream.</param>
 /// <param name="trace">An action to trace progress in a log stream.</param>
 public static void DoArchivingContent(string URL, string sqlConnectionString, int archivalDelay, int rowLimit, Action <ProgressChangedEventArgs> reportProgress, Action <String> trace)
 {
     reportProgress(new ProgressChangedEventArgs(1, String.Format("Starting DoArchivingContent URL: {0}, connection string: {1}, ArchivalDelay: {2}, RowLimit: {3}", URL, sqlConnectionString, archivalDelay, rowLimit)));
     trace("Establishing connection with the SP site and SQL database to execute ArchiveShipping.");
     using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
     {
         using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
         {
             _spedc.RowLimit = rowLimit;
             ArchiveShipping(_spedc, _sqledc, archivalDelay, reportProgress, trace);
         }
     }
     trace("Establishing connection with the SP site and SQL database to execute ArchiveDictionaries .");
     using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
     {
         using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
         {
             _spedc.RowLimit = rowLimit;
             ArchiveDictionaries(_spedc, _sqledc, archivalDelay, reportProgress, trace);
         }
     }
     trace("Establishing connection with the SP site and SQL database to execute ArchiveRouts.");
     using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
     {
         using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
         {
             _spedc.RowLimit = rowLimit;
             ArchiveRouts(_spedc, _sqledc, archivalDelay, reportProgress, trace);
         }
     }
     trace("Establishing connection with the SP site and SQL database to execute ArchiveBusinessDescription.");
     using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
     {
         using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
         {
             _spedc.RowLimit = rowLimit;
             ArchiveBusinessDescription(_spedc, _sqledc, archivalDelay, reportProgress, trace);
         }
     }
     trace("Establishing connection with the SP site and SQL database to execute ArchiveCarrierPerformanceReport.");
     using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
     {
         using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
         {
             _spedc.RowLimit = rowLimit;
             ArchiveCarrierPerformanceReport(_spedc, _sqledc, archivalDelay, reportProgress, trace);
         }
     }
     //Business Description
     reportProgress(new ProgressChangedEventArgs(1, "Updating Activities Logs"));
     using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
         ArchivingOperationLogs.UpdateActivitiesLogs <Linq2SQL.ArchivingOperationLogs>(_sqledc, ArchivingOperationLogs.OperationName.Archiving, reportProgress);
     reportProgress(new ProgressChangedEventArgs(1, "Finished DoArchivingContent"));
 }
Ejemplo n.º 2
0
        private static bool DoDestinationMarket(Linq.Entities spedc, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            bool _breakingIssueEncountered = false;

            trace("Entering DoDestinationMarket");
            List <Linq.DestinationMarket> _LoaderOptimizationAll = spedc.DestinationMarket.ToList <Linq.DestinationMarket>();

            _breakingIssueEncountered |= Assumption <Linq.DestinationMarket>(_LoaderOptimizationAll, typeof(Linq.Market).Name, reportProgress, x => x.MarketTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.DestinationMarket>(_LoaderOptimizationAll, typeof(Linq.CityType).Name, reportProgress, x => x.DestinationMarket2CityTitle == null);
            reportProgress(new ProgressChangedEventArgs(1, String.Format("Finished consistency check of list Destination Market with result {0}.", _breakingIssueEncountered ? "Failed" : "Success")));
            return(_breakingIssueEncountered);
        }
Ejemplo n.º 3
0
        private static bool DoSecurityEscortRoute(Linq.Entities spedc, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            bool _breakingIssueEncountered = false;

            trace("Entering DoSecurityEscortRoute");
            List <Linq.SecurityEscortCatalog> _LoaderOptimizationAll = spedc.SecurityEscortRoute.ToList <Linq.SecurityEscortCatalog>();

            _breakingIssueEncountered |= Assumption <Linq.SecurityEscortCatalog>(_LoaderOptimizationAll, typeof(Linq.Partner).Name, reportProgress, x => x.PartnerTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.SecurityEscortCatalog>(_LoaderOptimizationAll, typeof(Linq.FreightPayer).Name, reportProgress, x => x.FreightPayerTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.SecurityEscortCatalog>(_LoaderOptimizationAll, typeof(Linq.Currency).Name, reportProgress, x => x.CurrencyTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.SecurityEscortCatalog>(_LoaderOptimizationAll, typeof(Linq.BusienssDescription).Name, reportProgress, x => x.SecurityEscortCatalog2BusinessDescriptionTitle == null);
            reportProgress(new ProgressChangedEventArgs(1, String.Format("Finished consistency check of list Security Escort Route with result {0}.", _breakingIssueEncountered ? "Failed" : "Success")));
            return(_breakingIssueEncountered);
        }
Ejemplo n.º 4
0
        private static void ArchiveCarrierPerformanceReport(Linq.Entities spedc, Linq2SQL.SHRARCHIVE sqledc, int archivalDelay, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            //CarrierPerformanceReport
            trace("Loading the List CarrierPerformanceReport at ArchiveCarrierPerformanceReport");
            List <Linq.CarrierPerformanceReport> _CarrierPerformanceReport2BeDeleted =
                spedc.CarrierPerformanceReport.ToList <Linq.CarrierPerformanceReport>().Where <Linq.CarrierPerformanceReport>(x => x.Created.IsLatter(archivalDelay)).ToList <Linq.CarrierPerformanceReport>();

            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} CarrierPerformanceReport entries to be deleted.", _CarrierPerformanceReport2BeDeleted.Count)));
            spedc.CarrierPerformanceReport.Delete <Linq.CarrierPerformanceReport, Linq2SQL.History>
                (_CarrierPerformanceReport2BeDeleted, null, x => sqledc.CarrierPerformanceReport.GetAt <Linq2SQL.CarrierPerformanceReport>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            trace("SubmitChanges for the list: CarrierPerformanceReport have been archived.");
            CAS.SharePoint.Client.SP2SQLInteroperability.Extensions.SubmitChanges(spedc, sqledc, (x, y) => reportProgress(y));
            reportProgress(new ProgressChangedEventArgs(1, "The list: CarrierPerformanceReport have been archived."));
        }
Ejemplo n.º 5
0
        private static void ArchiveBusinessDescription(Linq.Entities spedc, Linq2SQL.SHRARCHIVE sqledc, int archivalDelay, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            //BusienssDescription
            trace("Loading the List BusienssDescription at ArchiveBusinessDescription");
            List <Linq.BusienssDescription> _BusinessDescription2BeDeleted =
                spedc.BusinessDescription.ToList <Linq.BusienssDescription>().Where <Linq.BusienssDescription>(x => x.Route.Count == 0 && x.SecurityEscortCatalog.Count == 0).ToList <Linq.BusienssDescription>();

            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} BusienssDescription entries to be deleted.", _BusinessDescription2BeDeleted.Count)));
            spedc.BusinessDescription.Delete <Linq.BusienssDescription, Linq2SQL.History>
                (_BusinessDescription2BeDeleted, null, x => sqledc.BusinessDescription.GetAt <Linq2SQL.BusinessDescription>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            trace("SubmitChanges for the list: BusienssDescription have been archived.");
            CAS.SharePoint.Client.SP2SQLInteroperability.Extensions.SubmitChanges(spedc, sqledc, (x, y) => reportProgress(y));
            reportProgress(new ProgressChangedEventArgs(1, "The list: BusienssDescription have been archived."));
        }
Ejemplo n.º 6
0
        private static bool DoRoute(Linq.Entities spedc, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            bool _breakingIssueEncountered = false;

            trace("Entering DoRoute");
            List <Linq.Route> _LoaderOptimizationAll = spedc.Route.ToList <Linq.Route>();

            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.FreightPayer).Name, reportProgress, x => x.FreightPayerTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.CityType).Name, reportProgress, x => x.Route2CityTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.Currency).Name, reportProgress, x => x.CurrencyTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.BusienssDescription).Name, reportProgress, x => x.Route2BusinessDescriptionTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.ShipmentType).Name, reportProgress, x => x.ShipmentTypeTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.TranspotUnit).Name, reportProgress, x => x.TransportUnitTypeTitle == null);
            _breakingIssueEncountered |= Assumption <Linq.Route>(_LoaderOptimizationAll, typeof(Linq.SAPDestinationPlant).Name, reportProgress, x => x.SAPDestinationPlantTitle == null);
            reportProgress(new ProgressChangedEventArgs(1, String.Format("Finished consistency check of list Route with result {0}.", _breakingIssueEncountered ? "Failed" : "Success")));
            return(_breakingIssueEncountered);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Runs the synchronization of the SharePoint and SQL.
 /// </summary>
 /// <param name="URL">The requested URL.</param>
 /// <param name="sqlConnectionString">The SQL connection string.</param>
 /// <param name="reportProgress">An action to trace progress in a log stream.</param>
 /// <param name="trace">An action to trace progress in a log stream.</param>
 public static void DoSynchronizationContent(string URL, string sqlConnectionString, Action <ProgressChangedEventArgs> reportProgress, Action <String> trace)
 {
     reportProgress(new ProgressChangedEventArgs(1, String.Format("Starting DoSynchronizationContent URL: {0}, connection string: {1}", URL, sqlConnectionString)));
     trace("Establishing connection with the SP site and SQL database.");
     using (Linq.Entities _edc = new Linq.Entities(trace, URL))
     {
         using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
         {
             Synchronizer.Synchronize <Linq2SQL.Commodity, Linq.Commodity>(_sqledc.Commodity, _edc.Commodity, (x, y) => reportProgress(y), Linq.Commodity.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Warehouse, Linq.Warehouse>(_sqledc.Warehouse, _edc.Warehouse, (x, y) => reportProgress(y), Linq.Warehouse.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Partner, Linq.Partner>(_sqledc.Partner, _edc.Partner, (x, y) => reportProgress(y), Linq.Partner.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Currency, Linq.Currency>(_sqledc.Currency, _edc.Currency, (x, y) => reportProgress(y), Linq.Currency.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.FreightPayer, Linq.FreightPayer>(_sqledc.FreightPayer, _edc.FreightPayer, (x, y) => reportProgress(y), Linq.FreightPayer.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.BusinessDescription, Linq.BusienssDescription>(_sqledc.BusinessDescription, _edc.BusinessDescription, (x, y) => reportProgress(y), Linq.BusienssDescription.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.SecurityEscortRoute, Linq.SecurityEscortCatalog>(_sqledc.SecurityEscortRoute, _edc.SecurityEscortRoute, (x, y) => reportProgress(y), Linq.SecurityEscortCatalog.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.SealProtocolLibrary, Linq.SealProtocol>(_sqledc.SealProtocolLibrary, _edc.SealProtocolLibrary, (x, y) => reportProgress(y), Linq.SealProtocol.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Country, Linq.CountryType>(_sqledc.Country, _edc.Country, (x, y) => reportProgress(y), Linq.CountryType.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.City, Linq.CityType>(_sqledc.City, _edc.City, (x, y) => reportProgress(y), Linq.CityType.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.EscortPOLibrary, Linq.EscortPO>(_sqledc.EscortPOLibrary, _edc.EscortPOLibrary, (x, y) => reportProgress(y), Linq.EscortPO.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.FreightPOLibrary, Linq.FreightPO>(_sqledc.FreightPOLibrary, _edc.FreightPOLibrary, (x, y) => reportProgress(y), Linq.FreightPO.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Carrier, Linq.CarrierType>(_sqledc.Carrier, _edc.Carrier, (x, y) => reportProgress(y), Linq.CarrierType.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.SAPDestinationPlant, Linq.SAPDestinationPlant>(_sqledc.SAPDestinationPlant, _edc.SAPDestinationPlant, (x, y) => reportProgress(y), Linq.SAPDestinationPlant.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.ShipmentType, Linq.ShipmentType>(_sqledc.ShipmentType, _edc.ShipmentType, (x, y) => reportProgress(y), Linq.ShipmentType.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.TransportUnitType, Linq.TranspotUnit>(_sqledc.TransportUnitType, _edc.TransportUnitType, (x, y) => reportProgress(y), Linq.TranspotUnit.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Route, Linq.Route>(_sqledc.Route, _edc.Route, (x, y) => reportProgress(y), Linq.Route.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Truck, Linq.Truck>(_sqledc.Truck, _edc.Truck, (x, y) => reportProgress(y), Linq.Truck.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Trailer, Linq.Trailer>(_sqledc.Trailer, _edc.Trailer, (x, y) => reportProgress(y), Linq.Trailer.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Shipping, Linq.Shipping>(_sqledc.Shipping, _edc.Shipping, (x, y) => reportProgress(y), Linq.Shipping.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.CarrierPerformanceReport, Linq.CarrierPerformanceReport>(_sqledc.CarrierPerformanceReport, _edc.CarrierPerformanceReport, (x, y) => reportProgress(y), Linq.CarrierPerformanceReport.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Market, Linq.Market>(_sqledc.Market, _edc.Market, (x, y) => reportProgress(y), Linq.Market.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.DestinationMarket, Linq.DestinationMarket>(_sqledc.DestinationMarket, _edc.DestinationMarket, (x, y) => reportProgress(y), Linq.DestinationMarket.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.Driver, Linq.Driver>(_sqledc.Driver, _edc.Driver, (x, y) => reportProgress(y), Linq.Driver.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.DriversTeam, Linq.ShippingDriversTeam>(_sqledc.DriversTeam, _edc.DriversTeam, (x, y) => reportProgress(y), Linq.ShippingDriversTeam.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.LoadDescription, Linq.LoadDescription>(_sqledc.LoadDescription, _edc.LoadDescription, (x, y) => reportProgress(y), Linq.LoadDescription.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.ShippingPoint, Linq.ShippingPoint>(_sqledc.ShippingPoint, _edc.ShippingPoint, (x, y) => reportProgress(y), Linq.ShippingPoint.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.ScheduleTemplate, Linq.ScheduleTemplate>(_sqledc.ScheduleTemplate, _edc.ScheduleTemplate, (x, y) => reportProgress(y), Linq.ScheduleTemplate.GetMappings(), false);
             Synchronizer.Synchronize <Linq2SQL.TimeSlotsTemplate, Linq.TimeSlotsTemplate>(_sqledc.TimeSlotsTemplate, _edc.TimeSlotsTemplate, (x, y) => reportProgress(y), Linq.TimeSlotsTemplate.GetMappings(), false); //TODO MP
         }
         using (Linq2SQL.SHRARCHIVE _sqledc = Linq2SQL.SHRARCHIVE.Connect2SQL(sqlConnectionString, y => trace(y)))
             CAS.SharePoint.Client.Link2SQL.ArchivingOperationLogs.UpdateActivitiesLogs <Linq2SQL.ArchivingOperationLogs>(_sqledc, CAS.SharePoint.Client.Link2SQL.ArchivingOperationLogs.OperationName.Synchronization, reportProgress);
         reportProgress(new ProgressChangedEventArgs(1, "Finished DoSynchronizationContent"));
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Does the cleanup of the lists <see cref="Linq.ScheduleTemplate"/>, <see cref="Linq.TimeSlotsTemplate"/>, <see cref="Linq.TimeSlotTimeSlot"/>.
        /// </summary>
        /// <param name="spedc">The spedc.</param>
        /// <param name="sqledc">The sqledc.</param>
        /// <param name="reportProgress">The report progress.</param>
        /// <param name="trace">The trace.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        private static bool DoTimeSlotsTemplate(Linq.Entities spedc, Linq2SQL.SHRARCHIVE sqledc, Action <ProgressChangedEventArgs> reportProgress, Action <String> trace)
        {
            trace("Entering DoTimeSlotsTemplate");
            bool _ret = false;

            reportProgress(new ProgressChangedEventArgs(1, "Starting ScheduleTemplate and TimeSlotsTemplate lists processing."));
            IEnumerable <Linq.ScheduleTemplate> _ScheduleTemplate2BeDeleted  = spedc.ScheduleTemplate.ToList <Linq.ScheduleTemplate>().Where <Linq.ScheduleTemplate>(x => x.ShippingPointLookupTitle == null);
            List <Linq.TimeSlotsTemplate>       _TimeSlotsTemplateAll        = spedc.TimeSlotsTemplate.ToList <Linq.TimeSlotsTemplate>();
            List <Linq.TimeSlotsTemplate>       _TimeSlotsTemplate2BeDeleted = new List <Linq.TimeSlotsTemplate>();

            foreach (Linq.ScheduleTemplate _item in _ScheduleTemplate2BeDeleted)
            {
                _TimeSlotsTemplate2BeDeleted.AddRange(_TimeSlotsTemplateAll.Where <Linq.TimeSlotsTemplate>(x => x.ScheduleTemplateTitle == _item));
            }
            _TimeSlotsTemplate2BeDeleted.AddRange(_TimeSlotsTemplateAll.Where <Linq.TimeSlotsTemplate>(x => x.ScheduleTemplateTitle == null));
            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} TimeSlotsTemplate entries to be deleted.", _TimeSlotsTemplate2BeDeleted.Count)));
            spedc.TimeSlotsTemplate.Delete <Linq.TimeSlotsTemplate, Linq2SQL.History>
                (_TimeSlotsTemplate2BeDeleted, null, x => sqledc.TimeSlotsTemplate.GetAt <Linq2SQL.TimeSlotsTemplate>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} ScheduleTemplate entries to be deleted.", _ScheduleTemplate2BeDeleted.Count())));
            spedc.ScheduleTemplate.Delete <Linq.ScheduleTemplate, Linq2SQL.History>
                (_ScheduleTemplate2BeDeleted, null, x => sqledc.ScheduleTemplate.GetAt <Linq2SQL.ScheduleTemplate>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            //TimeSlotTimeSlot
            reportProgress(new ProgressChangedEventArgs(1, "TimeSlot processing."));
            List <Linq.TimeSlotTimeSlot> _TimeSlotAll        = spedc.TimeSlot.ToList <Linq.TimeSlotTimeSlot>().Where <Linq.TimeSlotTimeSlot>(x => x.StartTime.Value < DateTime.Now).ToList <Linq.TimeSlotTimeSlot>();
            List <Linq.TimeSlotTimeSlot> _TimeSlot3BeDeleted = (from _tsx in _TimeSlotAll
                                                                let _notUsed = _tsx.TimeSlot2ShippingIndex != null && (_tsx.TimeSlot2ShippingIndex.ShippingState == Linq.ShippingState.Canceled ||
                                                                                                                       _tsx.TimeSlot2ShippingIndex.ShippingState == Linq.ShippingState.Completed)
                                                                               where _notUsed && _tsx.StartTime.Value < DateTime.Now
                                                                               select _tsx).ToList <Linq.TimeSlotTimeSlot>();

            _TimeSlot3BeDeleted.AddRange(_TimeSlotAll.Where <Linq.TimeSlotTimeSlot>(x => x.TimeSlot2ShippingIndex == null));
            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} Time Slot entries to be deleted.", _TimeSlot3BeDeleted.Count())));
            spedc.TimeSlot.Delete <Linq.TimeSlotTimeSlot, Linq2SQL.History>
                (_TimeSlot3BeDeleted, null, x => null, (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            reportProgress(new ProgressChangedEventArgs(1, "Starting SubmitChanges."));
            CAS.SharePoint.Client.SP2SQLInteroperability.Extensions.SubmitChanges(spedc, sqledc, (x, y) => reportProgress(y));
            trace("Successfully finished cleanup of the following lists ScheduleTemplate, TimeSlotsTemplateTimeSlotsTemplate, TimeSlotTimeSlot");
            return(_ret);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Does the update.
 /// </summary>
 /// <param name="URL">The URL of the SharePoint website.</param>
 /// <param name="routes">The routes catalog.</param>
 /// <param name="routePrefix">The route title prefix.</param>
 /// <param name="reportProgress">The report progress.</param>
 /// <param name="trace">The trace is used to write and log messages to an external trace.</param>
 public static void DoUpdate(string URL, RoutesCatalog routes, string routePrefix, Action <ProgressChangedEventArgs> reportProgress, Action <String> trace)
 {
     reportProgress(new ProgressChangedEventArgs(1, String.Format("Establishing connection with the site {0}.", URL)));
     using (Linq.Entities _edc = new Linq.Entities(trace, URL))
     {
         Dictionaries _dictionary = new Dictionaries();
         reportProgress(new ProgressChangedEventArgs(1, "Starting read current data from the selected site."));
         _dictionary.ReadSiteContent(_edc, x => reportProgress(new ProgressChangedEventArgs(1, x)));
         reportProgress(new ProgressChangedEventArgs(1, "Start updating the site data."));
         ImportTable(_edc, routes.CommodityTable, _dictionary, x => reportProgress(x));
         ImportTable(_edc, routes.PartnersTable, _dictionary, false, x => reportProgress(x));
         ImportTable(_edc, routes.MarketTable, _dictionary, x => reportProgress(x));
         reportProgress(new ProgressChangedEventArgs(1, "Market updated."));
         ImportTable(_edc, routes.GlobalPricelist, routePrefix, _dictionary, false, x => reportProgress(x));
         reportProgress(new ProgressChangedEventArgs(1, "Global Price List updated."));
         reportProgress(new ProgressChangedEventArgs(1, "Data from current site has been read"));
         _edc.SubmitChanges();
         reportProgress(new ProgressChangedEventArgs(1, "Submitted changes."));
     }
 }
Ejemplo n.º 10
0
        private static bool DoLoadDescription(Linq.Entities spedc, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            bool _breakingIssueEncountered = false;

            trace("Entering DoLoadDescription");
            List <Linq.LoadDescription> _LoaderOptimizationAll = spedc.LoadDescription.ToList <Linq.LoadDescription>();

            try
            {
                //_breakingIssueEncountered &= Assumption<Linq.LoadDescription>(_LoaderOptimizationAll, typeof(Linq.Partner).Name, reportProgress, x => x.LoadDescription2PartnerTitle == null);
                _breakingIssueEncountered |= Assumption <Linq.LoadDescription>(_LoaderOptimizationAll, typeof(Linq.Shipping).Name, reportProgress, x => x.LoadDescription2ShippingIndex == null);
            }
            catch (Exception ex)
            {
                _LoaderOptimizationAll    = null;
                _breakingIssueEncountered = false;
                reportProgress(new ProgressChangedEventArgs(1, String.Format("DoLoadDescription - Shipping lookup test aborter by exception: {0}.", ex.Message)));
            }
            reportProgress(new ProgressChangedEventArgs(1, String.Format("Finished consistency check of list Load Description with result {0}.", _breakingIssueEncountered ? "Failed" : "Success")));
            return(_breakingIssueEncountered);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Does the content cleanup.
        /// </summary>
        /// <param name="URL">The requested URL.</param>
        /// <param name="sqlConnectionString">The SQL connection string.</param>
        /// <param name="reportProgress">An action to report the progress.</param>
        /// <param name="trace">An action to trace progress in a log stream.</param>
        /// <exception cref="System.ArgumentException">
        /// Cannot connect to SQL database.;SQLConnectionString
        /// </exception>
        /// <exception cref="System.ApplicationException">DoCleanupContent has encountered breaking inconsistency - review the log and remove problems to pass to next phase.</exception>
        public static void DoCleanupContent(string URL, string sqlConnectionString, Action <ProgressChangedEventArgs> reportProgress, Action <String> trace)
        {
            bool _breakingIssueEncountered = false;

            reportProgress(new ProgressChangedEventArgs(1, String.Format("Starting DoCleanupContent and establishing connection with the site {0}.", URL)));
            reportProgress(new ProgressChangedEventArgs(1, String.Format("Connection string {0}", sqlConnectionString)));
            System.Data.IDbConnection _connection = new SqlConnection(sqlConnectionString);
            using (Linq2SQL.SHRARCHIVE _sqledc = new Linq2SQL.SHRARCHIVE(_connection))
            {
                if (!_sqledc.DatabaseExists())
                {
                    throw new ArgumentException("Cannot connect to SQL database.", "SQLConnectionString");
                }
                using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
                {
                    //Warehouse
                    //Partner

                    _breakingIssueEncountered |= DoTimeSlotsTemplate(_spedc, _sqledc, reportProgress, trace);
                    _breakingIssueEncountered |= DoShippingPoint(_spedc, _sqledc, reportProgress, trace);
                }
            }
            using (Linq2SQL.SHRARCHIVE _sqledc = new Linq2SQL.SHRARCHIVE(_connection))
            {
                if (!_sqledc.DatabaseExists())
                {
                    throw new ArgumentException("Cannot connect to SQL database.", "SQLConnectionString");
                }
                using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
                {
                    _breakingIssueEncountered |= DoLoadDescription(_spedc, reportProgress, trace);
                }
            }
            using (Linq2SQL.SHRARCHIVE _sqledc = new Linq2SQL.SHRARCHIVE(_connection))
            {
                if (!_sqledc.DatabaseExists())
                {
                    throw new ArgumentException("Cannot connect to SQL database.", "SQLConnectionString");
                }
                using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
                {
                    _breakingIssueEncountered |= DoDriversTeam(_spedc, _sqledc, reportProgress, trace);
                }
            }
            using (Linq2SQL.SHRARCHIVE _sqledc = new Linq2SQL.SHRARCHIVE(_connection))
            {
                if (!_sqledc.DatabaseExists())
                {
                    throw new ArgumentException("Cannot connect to SQL database.", "SQLConnectionString");
                }
                using (Linq.Entities _spedc = new Linq.Entities(trace, URL))
                {
                    _breakingIssueEncountered |= DoDriver(_spedc, reportProgress, trace);
                    _breakingIssueEncountered |= DoTruck(_spedc, reportProgress, trace);
                    _breakingIssueEncountered |= DoDestinationMarket(_spedc, reportProgress, trace);
                    _breakingIssueEncountered |= DoCarrierPerformanceReport(_spedc, reportProgress, trace);
                    _breakingIssueEncountered |= DoRoute(_spedc, reportProgress, trace);
                    _breakingIssueEncountered |= DoCity(_spedc, reportProgress, trace);
                    _breakingIssueEncountered |= DoSecurityEscortRoute(_spedc, reportProgress, trace);
                }
            }
            using (Linq2SQL.SHRARCHIVE _sqledc = new Linq2SQL.SHRARCHIVE(_connection))
                CAS.SharePoint.Client.Link2SQL.ArchivingOperationLogs.UpdateActivitiesLogs <Linq2SQL.ArchivingOperationLogs>(_sqledc, CAS.SharePoint.Client.Link2SQL.ArchivingOperationLogs.OperationName.Cleanup, reportProgress);
            reportProgress(new ProgressChangedEventArgs(1, "Finished DoCleanupContent"));
            if (_breakingIssueEncountered)
            {
                throw new ApplicationException("DoCleanupContent has encountered breaking inconsistency - review the log and remove problems to pass to next phase.");
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Archives the dictionaries.
        /// </summary>
        /// <param name="spedc">The <see cref="Linq.Entities"/> representing SharePoint application content database</param>
        /// <param name="sqledc">The <see cref="Linq2SQL.SHRARCHIVE"/> representing the SQL database containing backup of SharePoint content.</param>
        /// <param name="archivalDelay">The archival delay.</param>
        /// <param name="reportProgress">The report progress.</param>
        /// <param name="trace">The trace.</param>
        private static void ArchiveDictionaries(Linq.Entities spedc, Linq2SQL.SHRARCHIVE sqledc, int archivalDelay, Action <ProgressChangedEventArgs> reportProgress, Action <string> trace)
        {
            reportProgress(new ProgressChangedEventArgs(1, "Starting archive the lists: Truck, Trailer, Driver"));
            //Truck
            List <Linq.Truck> _Truck2MarketDeleted = spedc.Truck.ToList <Linq.Truck>().Where <Linq.Truck>(x => x.ToBeDeleted.GetValueOrDefault(false)).ToList <Linq.Truck>();

            trace(String.Format("List of Truck loaded and contains {0} items.", _Truck2MarketDeleted.Count));
            List <Linq.Truck> _Truck2BeDeleted = new List <Linq.Truck>();

            foreach (Linq.Truck _TruckItem in _Truck2MarketDeleted)
            {
                if (_TruckItem.Shipping.Count == 0 && _TruckItem.Shipping0.Count == 0)
                {
                    _Truck2BeDeleted.Add(_TruckItem);
                }
            }
            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} Truck entries to be deleted.", _Truck2BeDeleted.Count)));
            spedc.Truck.Delete <Linq.Truck, Linq2SQL.History>
                (_Truck2BeDeleted, null, x => sqledc.Truck.GetAt <Linq2SQL.Truck>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            _Truck2MarketDeleted = null;
            _Truck2BeDeleted     = null;
            //Trailer
            List <Linq.Trailer> _Trailer2MarketDeleted = spedc.Trailer.ToList <Linq.Trailer>().Where <Linq.Trailer>(x => x.ToBeDeleted.GetValueOrDefault(false)).ToList <Linq.Trailer>();

            trace(String.Format("List of Trailer loaded and contains {0} items.", _Trailer2MarketDeleted.Count));
            List <Linq.Trailer> _Trailer2BeDeleted = new List <Linq.Trailer>();

            foreach (Linq.Trailer _TrailerItem in _Trailer2MarketDeleted)
            {
                if (_TrailerItem.Shipping.Count == 0)
                {
                    _Trailer2BeDeleted.Add(_TrailerItem);
                }
            }
            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} Trailer entries to be deleted.", _Trailer2BeDeleted.Count)));
            spedc.Trailer.Delete <Linq.Trailer, Linq2SQL.History>
                (_Trailer2BeDeleted, null, x => sqledc.Trailer.GetAt <Linq2SQL.Trailer>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            _Trailer2MarketDeleted = null;
            _Trailer2BeDeleted     = null;
            //Driver
            List <Linq.Driver> _DriverMarketDeleted = spedc.Driver.ToList <Linq.Driver>().Where <Linq.Driver>(x => x.ToBeDeleted.GetValueOrDefault(false)).ToList <Linq.Driver>();

            trace(String.Format("List of Driver loaded and contains {0} items.", _DriverMarketDeleted.Count));
            List <Linq.Driver> _Driver2BeDeleted = new List <Linq.Driver>();

            foreach (Linq.Driver _DriverItem in _DriverMarketDeleted)
            {
                if (_DriverItem.ShippingDriversTeam.Count == 0)
                {
                    _Driver2BeDeleted.Add(_DriverItem);
                }
            }
            reportProgress(new ProgressChangedEventArgs(1, String.Format("There are {0} Driver entries to be deleted.", _Driver2BeDeleted.Count)));
            spedc.Driver.Delete <Linq.Driver, Linq2SQL.History>
                (_Driver2BeDeleted, null, x => sqledc.Driver.GetAt <Linq2SQL.Driver>(x), (id, listName) => sqledc.ArchivingLogs.AddLog(id, listName, Extensions.UserName()),
                x => sqledc.History.AddHistoryEntry(x));
            trace("SubmitChanges for the lists: Truck, Trailer, Driver have been archived.");
            CAS.SharePoint.Client.SP2SQLInteroperability.Extensions.SubmitChanges(spedc, sqledc, (x, y) => reportProgress(y));
            reportProgress(new ProgressChangedEventArgs(1, "The lists: Truck, Trailer, Driver have been archived."));
        }