private void ShowDateData()
        {
            this.Cursor = Cursors.WaitCursor;
            var location     = (JewishCalendar.Location) this.cmbLocation.SelectedItem;
            var zmanim       = new Zmanim(this._currentJewishDate, location);
            var dy           = DafYomi.GetDafYomi(this._currentJewishDate);
            var holidays     = Zmanim.GetHolidays(this._currentJewishDate, location.IsInIsrael);
            var holidayList  = holidays.Cast <SpecialDay>();
            var netzshkia    = zmanim.GetNetzShkia();
            var netz         = netzshkia != null ? netzshkia[0] : new HourMinute();
            var shkia        = netzshkia != null ? netzshkia[1] : netz;
            var chatzos      = zmanim.GetChatzos();
            var shaaZmanis   = zmanim.GetShaaZmanis();
            var shaaZmanis90 = zmanim.GetShaaZmanis(90);
            var bold         = new Font(this.richTextBox1.Font, FontStyle.Bold | FontStyle.Underline);

            this.richTextBox1.Clear();
            this.richTextBox1.SelectionColor = Color.DarkBlue;
            this.richTextBox1.SelectionFont  = bold;
            this.richTextBox1.SelectedText   = Utils.JewishDOWNames[(int)this._currentJewishDate.DayOfWeek].ToString() +
                                               " - " + this._currentJewishDate.ToShortDateStringHeb() + Environment.NewLine;
            if (holidayList.Count() > 0)
            {
                this.richTextBox1.SelectedText = Environment.NewLine + Zmanim.GetHolidaysText(holidays, " - ", true) +
                                                 Environment.NewLine;
                if (holidayList.Any(h => h.DayType.HasFlag(SpecialDayTypes.HasCandleLighting)))
                {
                    this.AddLine("הדלקת נרות", (shkia - location.CandleLighting).ToString24H());
                }
            }
            this.richTextBox1.SelectionColor = Color.Black;
            this.richTextBox1.SelectedText   = Environment.NewLine;
            this.AddLine("פרשת השבוע",
                         string.Join(" ", Sedra.GetSedra(this._currentJewishDate, location.IsInIsrael).Select(i => i.nameHebrew)));
            this.AddLine("תאריך לועזי", this._currentDate.ToString("D", Program.HebrewCultureInfo));
            if (dy != null)
            {
                this.AddLine("דף היומי", dy.ToStringHeb());
            }
            this.richTextBox1.SelectionFont = this.richTextBox1.Font;
            this.richTextBox1.SelectedText  = string.Format("{0}----------------------------------------------{0}" +
                                                            "זמני היום עבור {1}{0}-----------------------------------------------{0}",
                                                            Environment.NewLine, location.Name);
            this.AddLine("עלות השחר - 90", (netz - 90).ToString24H());
            this.AddLine("עלות השחר - 72", (netz - 72).ToString24H());
            this.AddLine("נץ החמה", netz.ToString24H());
            this.AddLine("סזק\"ש מג\"א", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 3D)).ToString24H());
            this.AddLine("סזק\"ש גר\"א", (netz + (int)Math.Floor(shaaZmanis * 3D)).ToString24H());
            this.AddLine("סז\"ת מג\"א", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 4D)).ToString24H());
            this.AddLine("סז\"ת גר\"א", (netz + (int)Math.Floor(shaaZmanis * 4D)).ToString24H());
            this.AddLine("חצות היום והלילה", chatzos.ToString24H());
            this.AddLine("מנחה גדולה", (chatzos + (int)(shaaZmanis * 0.5)).ToString24H());
            this.AddLine("שקיעת החמה", shkia.ToString24H());
            this.AddLine("צה\"כ 45", (shkia + 45).ToString24H());
            this.AddLine("צה\"כ ר\"ת", (shkia + 72).ToString24H());
            this.Cursor = Cursors.Default;
        }
Exemplo n.º 2
0
        private void ShowDateData()
        {
            this.Cursor = Cursors.WaitCursor;
            var location     = (JewishCalendar.Location) this.cmbLocation.SelectedItem;
            var zmanim       = new Zmanim(this._currentJewishDate, location);
            var dy           = DafYomi.GetDafYomi(this._currentJewishDate);
            var holidays     = Zmanim.GetHolidays(this._currentJewishDate, location.IsInIsrael);
            var holidayList  = holidays.Cast <SpecialDay>();
            var netzshkia    = zmanim.GetNetzShkia();
            var netz         = netzshkia != null ? netzshkia[0] : new HourMinute();
            var shkia        = netzshkia != null ? netzshkia[1] : netz;
            var chatzos      = zmanim.GetChatzos();
            var shaaZmanis   = zmanim.GetShaaZmanis();
            var shaaZmanis90 = zmanim.GetShaaZmanis(90);
            var bold         = new Font(this.richTextBox1.Font, FontStyle.Bold | FontStyle.Underline);

            this.SetlblDiff();
            this.richTextBox1.Clear();
            this.richTextBox1.SelectionColor = Color.DarkBlue;
            this.richTextBox1.SelectionFont  = bold;
            this.richTextBox1.SelectedText   = this._currentJewishDate.DayOfWeek.ToString() +
                                               " - " + this._currentJewishDate.ToShortDateString() + Environment.NewLine;
            if (holidayList.Count() > 0)
            {
                this.richTextBox1.SelectedText = Environment.NewLine + Zmanim.GetHolidaysText(holidays, " - ", false) + Environment.NewLine;
                if (holidayList.Any(h => h.DayType.HasFlag(SpecialDayTypes.HasCandleLighting)))
                {
                    this.AddLine("Candle Lighting", (shkia - location.CandleLighting).ToString());
                }
            }
            this.richTextBox1.SelectionColor = Color.Black;
            this.richTextBox1.SelectedText   = Environment.NewLine;
            this.AddLine("Weekly Sedra",
                         string.Join(" ", Sedra.GetSedra(this._currentJewishDate, location.IsInIsrael).Select(i => i.nameEng)));
            this.AddLine("Secular Date", this._currentDate.ToString("D", System.Threading.Thread.CurrentThread.CurrentCulture));
            if (dy != null)
            {
                this.AddLine("Daf Yomi", dy.ToString());
            }
            this.richTextBox1.SelectionFont = this.richTextBox1.Font;
            this.richTextBox1.SelectedText  = string.Format("{0}---------------------------------------------{0}" +
                                                            "Zmanim for {1}{0}---------------------------------------------{0}",
                                                            Environment.NewLine, location.Name);
            this.AddLine("Alos Hashachar - 90", (netz - 90).ToString());
            this.AddLine("Alos Hashachar - 72", (netz - 72).ToString());
            this.AddLine("Netz Hachama", netz.ToString());
            this.AddLine("Krias Shma - MG\"A", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 3D)).ToString());
            this.AddLine("Krias Shma - GR\"A", (netz + (int)Math.Floor(shaaZmanis * 3D)).ToString());
            this.AddLine("Zeman Tefillah - MG\"A", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 4D)).ToString());
            this.AddLine("Zeman Tefillah - GR\"A", (netz + (int)Math.Floor(shaaZmanis * 4D)).ToString());
            this.AddLine("Chatzos - Day & Night", chatzos.ToString());
            this.AddLine("Mincha Gedolah", (chatzos + (int)(shaaZmanis * 0.5)).ToString());
            this.AddLine("Shkias Hachama", shkia.ToString());
            this.AddLine("Nightfall 45", (shkia + 45).ToString());
            this.AddLine("Rabbeinu Tam", (shkia + 72).ToString());
            this.Cursor = Cursors.Default;
        }
        internal void ShowDateData()
        {
            this.Cursor = Cursors.WaitCursor;
            var showSeconds     = Properties.Settings.Default.ShowSeconds;
            var dy              = DafYomi.GetDafYomi(this._displayingJewishDate);
            var netzshkia       = this._dailyZmanim.NetzShkiaAtElevation;
            var netzshkiaMishor = this._dailyZmanim.NetzShkiaMishor;
            var netz            = this._dailyZmanim.NetzAtElevation;
            var shkia           = this._dailyZmanim.ShkiaAtElevation;
            var netzMishor      = this._dailyZmanim.NetzMishor;
            var shkiaMishor     = this._dailyZmanim.ShkiaMishor;
            var chatzos         = this._dailyZmanim.Chatzos;
            var shaaZmanis      = this._dailyZmanim.ShaaZmanis;
            var shaaZmanis90    = this._dailyZmanim.ShaaZmanisMga;
            var html            = new StringBuilder();

            html.AppendFormat("<div class=\"padWidth royalBlue bold\">{0}</div>",
                              this._displayingJewishDate.ToLongDateStringHeb());
            html.AppendFormat("<div class=\"padWidth lightSteelBlue\">{0}</div>",
                              this._displayingSecularDate.ToString("D", Program.HebrewCultureInfo));

            //If the secular day is a day behind as day being displayed is todays date and it is after sunset,
            //the user may get confused as the secular date for today and tomorrow will be the same.
            //So we esplain'in it to them...
            if (this._secularDateAtMidnight.Date != this._displayingSecularDate.Date)
            {
                html.Append("<div class=\"padWidth rosyBrown seven italic\">שים לב: תאריך הלועזי מתחיל בשעה 0:00</div>");
            }

            this.DisplayDateDiff(html);

            html.Append("<br />");
            if (this._holidays.Count() > 0)
            {
                foreach (var h in this._holidays)
                {
                    html.AppendFormat("<div class=\"padWidth\">{0}", h.NameHebrew);
                    if (h.NameEnglish == "Shabbos Mevarchim")
                    {
                        var nextMonth = this._displayingJewishDate + 12;
                        html.AppendFormat(" - חודש {0}", Utils.GetProperMonthNameHeb(nextMonth.Year, nextMonth.Month));

                        var molad = Molad.GetMolad(nextMonth.Month, nextMonth.Year);
                        var dim   = JewishDateCalculations.DaysInJewishMonth(this._displayingJewishDate.Year, this._displayingJewishDate.Month);
                        var dow   = dim - this._displayingJewishDate.Day;
                        if (dim == 30)
                        {
                            dow--;
                        }
                        html.AppendFormat("<div>המולד: {0}</div>", molad.ToStringHeb(this._dailyZmanim.ShkiaAtElevation));
                        html.AppendFormat("<div>ראש חודש: {0}{1}</div>",
                                          Utils.JewishDOWNames[dow], (dim == 30 ? ", " + Utils.JewishDOWNames[(dow + 1) % 7] : ""));
                    }
                    html.Append("</div>");
                    if (h.NameEnglish.Contains("Sefiras Ha'omer"))
                    {
                        var dayOfOmer = this._displayingJewishDate.GetDayOfOmer();
                        html.AppendFormat("<div><a onclick=\"javacript:window.external.showSefirah({0}, true);return false;\" class=\"nine bluoid pointer\">{1}</a></div>",
                                          dayOfOmer, Utils.GetOmerNusach(dayOfOmer, Properties.Settings.Default.Nusach));
                    }

                    if (h.DayType.IsSpecialDayType(SpecialDayTypes.EruvTavshilin))
                    {
                        html.Append("<div class=\"padWidth crimson bold\">עירוב תבשילין</div>");
                    }
                }
            }

            html.Append("<table>");

            if (shkia != TimeOfDay.NoValue &&
                this._holidays.Any(h => h.DayType.IsSpecialDayType(SpecialDayTypes.HasCandleLighting)))
            {
                this.AddLine(html, "הדלקת נרות", (shkia - this._dailyZmanim.Location.CandleLighting).ToString24H(showSeconds),
                             wideDescription: false);
                html.Append("<tr><td class=\"nobg\" colspan=\"3\">&nbsp;</td></tr>");
            }

            this.AddLine(html, "פרשת השבוע",
                         string.Join(" ", Sedra.GetSedra(this._displayingJewishDate, this._dailyZmanim.Location.IsInIsrael).Select(i => i.nameHebrew)),
                         wideDescription: false);
            if (dy != null)
            {
                this.AddLine(html, "דף יומי", dy.ToStringHeb(), wideDescription: false);
            }

            html.Append("</table><br />");
            html.AppendFormat("<div class=\"padBoth lightSteelBlueBG ghostWhite nine bold clear\">זמני היום ב{0}</div>",
                              this._dailyZmanim.Location.NameHebrew);
            html.Append("<table>");

            if (netz == TimeOfDay.NoValue)
            {
                this.AddLine(html, "הנץ החמה", "השמש אינו עולה", bold: true, emphasizeValue: true);
            }
            else
            {
                if (this._displayingJewishDate.Month == 1 && this._displayingJewishDate.Day == 14)
                {
                    this.AddLine(html, "סו\"ז אכילת חמץ", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 4D)).ToString24H(showSeconds),
                                 bold: true);
                    this.AddLine(html, "סו\"ז שריפת חמץ", ((netz - 90) + (int)Math.Floor(shaaZmanis90 * 5D)).ToString24H(showSeconds),
                                 bold: true);
                    html.Append("<br />");
                }

                this.AddLine(html, "עלות השחר - 90", (netzMishor - 90).ToString24H(showSeconds));
                this.AddLine(html, "עלות השחר - 72", (netzMishor - 72).ToString24H(showSeconds));

                if (netz == netzMishor)
                {
                    this.AddLine(html, "הנץ החמה", netz.ToString24H(showSeconds), bold: true, emphasizeValue: true);
                }
                else
                {
                    this.AddLine(html, "הנה\"ח <span class=\"reg lightSteelBlue\">...מ " + this._dailyZmanim.Location.Elevation.ToString() + " מטר</span>",
                                 netz.ToString24H(showSeconds));
                    this.AddLine(html, "הנה\"ח <span class=\"reg lightSteelBlue\">...גובה פני הים</span>",
                                 netzMishor.ToString24H(showSeconds), bold: true, emphasizeValue: true);
                }
                this.AddLine(html, "סוזק\"ש - מג\"א", this._dailyZmanim.GetZman(ZmanType.KShmMga).ToString24H(showSeconds));
                this.AddLine(html, "סוזק\"ש - הגר\"א", this._dailyZmanim.GetZman(ZmanType.KshmGra).ToString24H(showSeconds));
                this.AddLine(html, "סוז\"ת - מג\"א", this._dailyZmanim.GetZman(ZmanType.TflMga).ToString24H(showSeconds));
                this.AddLine(html, "סוז\"ת - הגר\"א", this._dailyZmanim.GetZman(ZmanType.TflGra).ToString24H(showSeconds));
            }
            if (netz != TimeOfDay.NoValue && shkia != TimeOfDay.NoValue)
            {
                this.AddLine(html, "חצות היום והלילה", chatzos.ToString24H(showSeconds));
                this.AddLine(html, "מנחה גדולה", this._dailyZmanim.GetZman(ZmanType.MinchaG).ToString24H(showSeconds));
                this.AddLine(html, "מנחה קטנה", this._dailyZmanim.GetZman(ZmanType.MinchaK).ToString24H(showSeconds));
                this.AddLine(html, "פלג המנחה", this._dailyZmanim.GetZman(ZmanType.MinchaPlg).ToString24H(showSeconds));
            }
            if (shkia == TimeOfDay.NoValue)
            {
                this.AddLine(html, "שקיעת החמה", "השמש אינו שוקע", bold: true, emphasizeValue: true);
            }
            else
            {
                if (shkia == shkiaMishor)
                {
                    this.AddLine(html, "שקיעת החמה", shkia.ToString24H(showSeconds), bold: true, emphasizeValue: true);
                }
                else
                {
                    this.AddLine(html, "שקה\"ח <span class=\"reg lightSteelBlue\">...גובה פני הים</span>", shkiaMishor.ToString24H(showSeconds));
                    this.AddLine(html, "שקה\"ח <span class=\"reg lightSteelBlue\">...מ " + this._dailyZmanim.Location.Elevation.ToString() + " מטר</span>",
                                 shkia.ToString24H(showSeconds), bold: true, emphasizeValue: true);
                }

                this.AddLine(html, "צאת הכוכבים 45", (shkia + 45).ToString24H(showSeconds));
                this.AddLine(html, "רבינו תם", (shkia + 72).ToString24H(showSeconds));
                this.AddLine(html, "72 דקות זמניות", (shkia + (int)(shaaZmanis * 1.2)).ToString24H(showSeconds));
                this.AddLine(html, "72 דקות זמניות לחומרה", (shkia + (int)(shaaZmanis90 * 1.2)).ToString24H(showSeconds));
            }
            html.Append("</table>");
            this.webBrowser1.DocumentText = Properties.Resources.InfoHTMLHeb
                                            .Replace("{{BODY}}", html.ToString());

            this.tableLayoutPanel1.Controls.Clear();
            foreach (UserOccasion occ in this._occasions)
            {
                this.AddOccasion(occ);
            }

            var bg = (from o in this._occasions
                      where o.BackColor != Color.Empty
                      select o.BackColor).FirstOrDefault();

            this.tableLayoutPanel1.BackColor = (bg != Color.Empty ? bg.Color : Color.GhostWhite);

            this.Cursor = Cursors.Default;
        }
        private void DisplayZmanim(StringBuilder html)
        {
            var showSeconds  = Properties.Settings.Default.ShowSeconds;
            var dy           = DafYomi.GetDafYomi(this._displayingJewishDate);
            var netz         = this._dailyZmanim.NetzAtElevation;
            var shkia        = this._dailyZmanim.ShkiaAtElevation;
            var netzMishor   = this._dailyZmanim.NetzMishor;
            var shkiaMishor  = this._dailyZmanim.ShkiaMishor;
            var chatzos      = this._dailyZmanim.Chatzos;
            var shaaZmanis   = this._dailyZmanim.ShaaZmanis;
            var shaaZmanis90 = this._dailyZmanim.ShaaZmanisMga;
            var feet         = "...at " + (this._dailyZmanim.Location.Elevation * 3.28084).ToString("N0") +
                               " ft.";

            this.AddLine(html, "Weekly Sedra",
                         string.Join(" ", Sedra.GetSedra(this._displayingJewishDate, this._dailyZmanim.Location.IsInIsrael).Select(i => i.nameEng)),
                         wideDescription: false);
            if (dy != null)
            {
                this.AddLine(html, "Daf Yomi", dy.ToString(), wideDescription: false);
            }

            html.Append("</table><br />");
            html.AppendFormat("<div class=\"padBoth lightSteelBlueBG ghostWhite nine bold clear\">Zmanim for {0}</div>",
                              this._dailyZmanim.Location.Name);
            html.Append("<table>");

            if (netz == TimeOfDay.NoValue)
            {
                this.AddLine(html, "Netz Hachama", "The does not rise", bold: true, emphasizeValue: true);
            }
            else
            {
                if (this._displayingJewishDate.Month == 1 && this._displayingJewishDate.Day == 14)
                {
                    this.AddLine(html, "Stop eating Chometz", ((netz - 90d) + (shaaZmanis90 * 4d)).ToString24H(showSeconds),
                                 bold: true);
                    this.AddLine(html, "Burn Chometz before", ((netz - 90d) + (shaaZmanis90 * 5d)).ToString24H(showSeconds),
                                 bold: true);
                    html.Append("<br />");
                }

                this.AddLine(html, "Alos Hashachar - 90", (netzMishor - 90d).ToString(showSeconds));
                this.AddLine(html, "Alos Hashachar - 72", (netzMishor - 72d).ToString(showSeconds));
                if (netz != netzMishor)
                {
                    this.AddLine(html, "Sunrise <em class=\"reg lightSteelBlue\">" + feet + "</em>", netz.ToString(showSeconds));
                }
                this.AddLine(html, "Netz Hachama", netzMishor.ToString(showSeconds), bold: true, emphasizeValue: true);

                this.AddLine(html, "Krias Shma - MG\"A", this._dailyZmanim.GetZman(ZmanType.KShmMga).ToString(showSeconds));
                this.AddLine(html, "Krias Shma - GR\"A", this._dailyZmanim.GetZman(ZmanType.KshmGra).ToString(showSeconds));
                this.AddLine(html, "Zeman Tefillah - MG\"A", this._dailyZmanim.GetZman(ZmanType.TflMga).ToString(showSeconds));
                this.AddLine(html, "Zeman Tefillah - GR\"A", this._dailyZmanim.GetZman(ZmanType.TflGra).ToString(showSeconds));
            }

            if (netz != TimeOfDay.NoValue && shkia != TimeOfDay.NoValue)
            {
                this.AddLine(html, "Chatzos - Day & Night", chatzos.ToString(showSeconds));
                this.AddLine(html, "Mincha Gedolah", this._dailyZmanim.GetZman(ZmanType.MinchaG).ToString(showSeconds));
                this.AddLine(html, "Mincha Ktanah", this._dailyZmanim.GetZman(ZmanType.MinchaK).ToString(showSeconds));
                this.AddLine(html, "Plag Hamincha", this._dailyZmanim.GetZman(ZmanType.MinchaPlg).ToString(showSeconds));
            }

            if (shkia == TimeOfDay.NoValue)
            {
                this.AddLine(html, "Shkias Hachama", "The sun does not set", bold: true, emphasizeValue: true);
            }
            else
            {
                if (shkia == shkiaMishor)
                {
                    this.AddLine(html, "Shkias Hachama", shkia.ToString(showSeconds), bold: true, emphasizeValue: true);
                }
                else
                {
                    this.AddLine(html, "Sunset <em class=\"reg lightSteelBlue\">...at Sea Level</em>", shkiaMishor.ToString(showSeconds));
                    this.AddLine(html, "Shkiah <em class=\"reg lightSteelBlue\"> " + feet + "</em>",
                                 shkia.ToString(showSeconds), bold: true, emphasizeValue: true);
                }
                this.AddLine(html, "Nightfall 45", (shkia + 45d).ToString(showSeconds));
                this.AddLine(html, "Rabbeinu Tam", (shkia + 72d).ToString(showSeconds));
                this.AddLine(html, "72 \"Zmaniot\"", (shkia + (shaaZmanis * 1.2)).ToString(showSeconds));
                this.AddLine(html, "72 \"Zmaniot MA\"", (shkia + (shaaZmanis90 * 1.2)).ToString(showSeconds));
            }
            html.Append("</table>");
        }
Exemplo n.º 5
0
        private string GetHtml()
        {
            Location            location      = (Location)this.cmbLocations.SelectedItem;
            int                 month         = this.GetSelectedMonth();
            int                 year          = this.GetSelectedYear();
            StringBuilder       sbHeaderCells = new StringBuilder();
            StringBuilder       sbRows        = new StringBuilder();
            bool                showMonth     = this.choiceSwitcherDateType.ChoiceOneSelected;
            JewishDate          jd            = showMonth ? new JewishDate(year, month, 1) : this.jdpFrom.Value;
            DailyZmanim         dz            = new DailyZmanim(jd.GregorianDate, location);
            string              startSMonth   = dz.SecularDate.ToString("MM yyyy");
            SelectedZmanColumns columns       = this.GetSelectedColumns();
            bool                showSeconds   = this.choiceSeconds.ChoiceOneSelected;

            //Once "Generate" is clicked, we save the columns selected.
            Properties.Settings.Default.SelectedZmanColumns = columns;
            Properties.Settings.Default.ArmyTime            = this.choiceArmy.ChoiceOneSelected;
            Properties.Settings.Default.AmPm            = this.choiceAmPm.ChoiceOneSelected;
            Properties.Settings.Default.Width100        = (bool)this.choiceWidth100.SelectedValue;
            Properties.Settings.Default.DirectionRight  = (bool)this.choiceDirection.SelectedValue;
            Properties.Settings.Default.DateChooseMonth = this.choiceSwitcherDateType.ChoiceOneSelected;
            Properties.Settings.Default.ShowSeconds     = this.choiceSeconds.ChoiceOneSelected;
            Properties.Settings.Default.ShowDayDetails  = this.choiceDayDetails.ChoiceOneSelected;
            this.SaveDayOfWeek();

            var columnsSorted = from c in columns orderby c.ZmanIndex, c.Offset select c;

            foreach (var zmanColumn in columnsSorted)
            {
                sbHeaderCells.AppendFormat("<th>{0}</th>", zmanColumn.Header);
            }
            while (true)
            {
                sbRows.AppendFormat("<tr{0}>",
                                    (jd.DayOfWeek == DayOfWeek.Saturday ||
                                     SpecialDay.IsMajorYomTov(jd, location) ? " class='special'" :
                                     SpecialDay.IsMinorYomTovOrFast(jd, location) ? " class='special2'" : ""));

                if (Properties.Settings.Default.DOWFormat != DayOfWeekFormat.None)
                {
                    sbRows.AppendFormat("<td class=\"dow {0}\">{1}</td>",
                                        this.rbDOWEnglish.Checked ? "left" : "right",
                                        this.GetDayOfWeekString(jd, location));
                }

                sbRows.AppendFormat(
                    "<td style=\"direction:rtl;\">{0}</td><td>{1}</td>",
                    Utils.ToNumberHeb(jd.Day),
                    dz.SecularDate.Day);


                foreach (var zmanColumn in columnsSorted)
                {
                    string    zmanTime = null;
                    TimeOfDay zman     = TimeOfDay.NoValue;
                    if (zmanColumn.ZmanIndex == 17)
                    {
                        zmanTime = DafYomi.GetDafYomi(jd).ToStringHeb();
                    }
                    else if (zmanColumn.DaysOfWeek == null /* All days */ ||
                             zmanColumn.DaysOfWeek.Contains(jd.DayInWeek) ||
                             zmanColumn.AlternateOffset != 0)
                    {
                        zman = zmanColumn.GetZman(dz);
                        //For netz, if we are not showing seconds, we show the end of the minute
                        if (!showSeconds && zmanColumn.ZmanIndex.In(2, 3) && zman.Seconds > 0)
                        {
                            zman += 1;
                        }
                        zmanTime = zman.ToString(
                            Properties.Settings.Default.ArmyTime,
                            Properties.Settings.Default.AmPm);
                    }
                    if (!string.IsNullOrEmpty(zmanTime))
                    {
                        if (zmanColumn.Bold)
                        {
                            zmanTime = "<strong>" + zmanTime + "</strong>";
                        }
                        if (zman != TimeOfDay.NoValue && Properties.Settings.Default.ShowSeconds)
                        {
                            zmanTime += "<sub>:" +
                                        (zman.Seconds < 10 ? "0" : "") +
                                        zman.Seconds.ToString() + "</sub>";
                        }
                    }
                    sbRows.AppendFormat("<td>{0}</td>", zmanTime);
                }

                jd = jd + 1;
                if (showMonth ? jd.Month == month : jd <= this.jdpTo.Value)
                {
                    dz.SecularDate = jd.GregorianDate;
                }
                else
                {
                    sbRows.Append("</tr>");
                    break;
                }
            }
            string endSMonth   = dz.SecularDate.ToString("MM yyyy");
            string monthHeader = showMonth ?
                                 Utils.JewishMonthNamesHebrew[month] + " " + Utils.ToNumberHeb(year % 1000) :
                                 this.getFromToHeaderText();
            int inBuiltColsCount = Properties.Settings.Default.DOWFormat == DayOfWeekFormat.None ? 2 : 3;

            return(Properties.Resources.template
                   .Replace("#--DIRECTION--#", (Properties.Settings.Default.DirectionRight ? "direction:rtl;" : ""))
                   .Replace("#--TOTAL_CELLS--#", (columns.Count + inBuiltColsCount).ToString())
                   .Replace("#--LOCATION--#", location.NameHebrew)
                   .Replace("#--TABLE_WIDTH--#", Properties.Settings.Default.Width100 ? "width: 100%;" : "")
                   .Replace("#--MONTH--#", "<strong>" + monthHeader + "</strong> (" +
                            startSMonth +
                            (startSMonth != endSMonth ? " - " + endSMonth : "") + ")")
                   .Replace("#--HEADER_CELLS--#", sbHeaderCells.ToString())
                   .Replace("#--LOCATION_COL_SPAN--#", inBuiltColsCount.ToString())
                   .Replace("#--VALUE_ROWS--#", sbRows.ToString()));
        }