コード例 #1
0
 static void PrintMagazine
 (
     [NotNull] PeriodInfo info
 )
 {
     _writer.WriteLine("<tr>");
     _writer.WriteLine("<td>");
     _writer.WriteLine(HtmlText.Encode(info.Title));
     _writer.WriteLine("</td>");
     _writer.WriteLine("<td>");
     _writer.WriteLine(HtmlText.Encode(info.Expected));
     _writer.WriteLine("</td>");
     _writer.WriteLine("<td>");
     _writer.WriteLine(HtmlText.Encode(info.Registered));
     _writer.WriteLine("</td>");
     _writer.WriteLine("<td>");
     _writer.WriteLine(HtmlText.Encode(info.Missing));
     _writer.WriteLine("</td>");
     _writer.WriteLine("</tr>");
 }
コード例 #2
0
        private static void ProcessMagazine
        (
            [NotNull] MagazineInfo magazine
        )
        {
            Console.WriteLine(magazine);
            if (ReferenceEquals(magazine.QuarterlyOrders, null))
            {
                Console.WriteLine(Resources.HaventOrders);
                return;
            }
            QuarterlyOrderInfo order = magazine.QuarterlyOrders.FirstOrDefault
                                       (
                o => o.Period.SameString(_period)
                                       );

            if (ReferenceEquals(order, null) ||
                string.IsNullOrEmpty(order.FirstIssue) ||
                string.IsNullOrEmpty(order.LastIssue))
            {
                Console.WriteLine(Resources.NoOrderInfoFor, _period);
                return;
            }

            MagazineIssueInfo[] issues = _manager.GetIssues(magazine, _year);

            string[] registered = issues.Select(i => i.Number).ToArray();
            registered = NumberText.Sort(registered).ToArray();

            NumberText first   = order.FirstIssue;
            NumberText current = first.Clone();
            NumberText last    = order.LastIssue;

            PeriodInfo info = new PeriodInfo
            {
                Title      = magazine.ExtendedTitle,
                Expected   = first + "-" + last,
                Registered = CompressIfPossible(registered)
            };

            _list.Add(info);

            List <string> missingIssues = new List <string>();

            while (current <= last)
            {
                MagazineIssueInfo found = issues.FirstOrDefault
                                          (
                    i => Match(i.Number, current)
                                          );
                if (ReferenceEquals(found, null))
                {
                    missingIssues.Add(current.ToString());
                }

                current = current.Increment();
            }

            info.Missing = CompressIfPossible(missingIssues);

            Console.WriteLine(Resources.Present, info.Registered);
            Console.WriteLine(Resources.Missing, info.Missing);
        }