Beispiel #1
0
        private int CheckMailing(string p_invoicerId, int p_noInvoicee, string p_where, PgDatParameters p_dbps)
        {
            int _noSending = 0;

            lock (SyncEngine)
                _noSending = CheckReEnter(p_invoicerId, p_where, p_dbps);

            if (_noSending > 0)
            {
                MailingArgs _args = new MailingArgs()
                {
                    reSending     = false,
                    invoiceeEMail = "",
                    invoicerId    = p_invoicerId,
                    noInvoicee    = p_noInvoicee,
                    noSending     = _noSending,
                    where         = p_where,
                    dbps          = p_dbps
                };

                // Do not use using statement
                ThreadPoolWait _doneEvent = new ThreadPoolWait();
                _doneEvent.QueueUserWorkItem(DoMailing, _args);

                if (Environment.UserInteractive == true)
                {
                    _doneEvent.WaitOne();
                }
            }

            return(_noSending);
        }
Beispiel #2
0
        private int CheckReporting(string p_invoicerId, int p_noIssuing, string p_where, PgDatParameters p_dbps)
        {
            int _noReporting = 0;

            lock (SyncEngine)
                _noReporting = CheckReEnter(p_invoicerId, p_where, p_dbps);

            if (_noReporting > 0)
            {
                ReportArgs _args = new ReportArgs()
                {
                    invoicerId  = p_invoicerId,
                    noIssuing   = p_noIssuing,
                    noReporting = _noReporting,
                    where       = p_where,
                    dbps        = p_dbps
                };

                // Do not use using statement
                ThreadPoolWait _doneEvent = new ThreadPoolWait();
                _doneEvent.QueueUserWorkItem(DoReporting, _args);

                if (Environment.UserInteractive == true)
                {
                    _doneEvent.WaitOne();
                }
            }

            return(_noReporting);
        }
Beispiel #3
0
        private AssemblyGroup DoCompareFiles(AssemblyManager manager, string[] assemblyFiles)
        {
            string[] assemblyFilesResolved = new string[assemblyFiles.Length];

            for (int i = 0; i < assemblyFiles.Length; i++)
            {
                if (Path.IsPathRooted(assemblyFiles[i]))
                {
                    assemblyFilesResolved[i] = Path.GetFullPath(assemblyFiles[i]);
                }
                else
                {
                    assemblyFilesResolved[i] = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), assemblyFiles[i]));
                }
            }

            AssemblyGroup group = new AssemblyGroup();

            foreach (string file in assemblyFilesResolved)
            {
                if (group.Name == null)
                {
                    group.Name = Path.GetFileName(file);
                }

                if (Path.GetFileName(file) != group.Name)
                {
                    group.Name = "(Multiple Names)";
                    break;
                }
            }

            foreach (string fileName in assemblyFilesResolved)
            {
                AssemblyComparerThread act = new AssemblyComparerThread(manager, group, fileName, _progress);

                if (_config.Multithread)
                {
                    _tpw.QueueUserWorkItem(Execute, act);
                }
                else
                {
                    Execute(act);
                }
            }

            if (_config.Multithread)
            {
                _tpw.WaitOne();

                List <AssemblyDetail> sorted = new List <AssemblyDetail>();

                foreach (string fileName in assemblyFilesResolved)
                {
                    AssemblyDetail sortedDetail = group.Assemblies.Find(delegate(AssemblyDetail detail) { return(string.Compare(detail.Location, fileName, true) == 0); });

                    if (sortedDetail == null)
                    {
                        Log.Error("Unable to sort assembly " + fileName);
                        //Log.Error(" List has " + string.Join(",", group.Assemblies.ConvertAll(delegate(AssemblyDetail detail) { return detail.Location; }).ToArray()));
                    }
                    else
                    {
                        sorted.Add(sortedDetail);
                    }
                }

                group.Assemblies.Clear();
                group.Assemblies.AddRange(sorted);
            }

            ListOperations.AlignLists(group.Assemblies);

            group.PerformCompare(_filter);

            return(group);
        }