示例#1
0
        //public bool GetTithiTimeRange(GCEarthData earth, out GregorianDateTime from, out GregorianDateTime to)
        //{
        //    GregorianDateTime start = new GregorianDateTime();

        //    start.Set(date);
        //    start.shour = astrodata.sunRise.TotalDays;

        //    GCTithi.GetNextTithiStart(earth, start, out to);
        //    GCTithi.GetPrevTithiStart(earth, start, out from);

        //    return true;

        //}

        //public bool GetNaksatraTimeRange(GCEarthData earth, out GregorianDateTime from, out GregorianDateTime to)
        //{
        //    GregorianDateTime start = new GregorianDateTime();

        //    start.Set(date);
        //    start.shour = astrodata.sunRise.TotalDays;

        //    GCNaksatra.GetNextNaksatra(earth, start, out to);
        //    GCNaksatra.GetPrevNaksatra(earth, start, out from);

        //    return true;
        //}

        public string GetTextEP()
        {
            string            str = string.Empty;
            GregorianDateTime e1, e2;

            e1 = GetGregorianDateTime(eparana_time1);

            if (eparana_time2 != null)
            {
                e2 = GetGregorianDateTime(eparana_time2);

                if (GCDisplaySettings.Current.getValue(50) == 1)
                {
                    str = string.Format("{0} {1} ({2}) - {3} ({4}) {5}", GCStrings.getString(60),
                                        e1.ShortTimeString(), GCEkadasi.GetParanaReasonText(eparana_time1.nType),
                                        e2.ShortTimeString(), GCEkadasi.GetParanaReasonText(eparana_time2.nType),
                                        GCStrings.GetDSTSignature(BiasMinutes));
                }
                else
                {
                    str = string.Format("{0} {1} - {2} ({3})", GCStrings.getString(60),
                                        e1.ShortTimeString(), e2.ShortTimeString(), GCStrings.GetDSTSignature(BiasMinutes));
                }
            }
            else if (eparana_time1 != null)
            {
                if (GCDisplaySettings.Current.getValue(50) == 1)
                {
                    str = string.Format("{0} {1} ({2}) {3}", GCStrings.getString(61),
                                        e1.ShortTimeString(), GCEkadasi.GetParanaReasonText(eparana_time1.nType), GCStrings.GetDSTSignature(BiasMinutes));
                }
                else
                {
                    str = string.Format("{0} {1} ({2})", GCStrings.getString(61),
                                        e1.ShortTimeString(), GCStrings.GetDSTSignature(BiasMinutes));
                }
            }
            else
            {
                str = GCStrings.getString(62);
            }
            return(str);
        }
示例#2
0
        public void ResolveFestivalsFasting(int nIndex)
        {
            VAISNAVADAY s = m_pData[nIndex - 1];
            VAISNAVADAY t = m_pData[nIndex];
            VAISNAVADAY u = m_pData[nIndex + 1];

            String        str;
            String        subject      = string.Empty;
            int           fastForDay   = 0;
            int           fastForEvent = 0;
            string        ch;
            VAISNAVAEVENT md;

            if (t.nMahadvadasiID != MahadvadasiType.EV_NULL)
            {
                str = string.Format(GCStrings.Localized("Fasting for {0}"), t.ekadasi_vrata_name);
                t.AddEvent(DisplayPriorities.PRIO_EKADASI, GCDS.CAL_EKADASI_PARANA, str);
            }

            ch = GCEkadasi.GetMahadvadasiName((int)t.nMahadvadasiID);
            if (ch != null)
            {
                t.AddEvent(DisplayPriorities.PRIO_MAHADVADASI, GCDS.CAL_EKADASI_PARANA, ch);
            }

            if (t.ekadasi_parana)
            {
                str = t.GetTextEP();
                t.AddEvent(DisplayPriorities.PRIO_EKADASI_PARANA, GCDS.CAL_EKADASI_PARANA, str);
            }

            for (int h = 0; h < t.dayEvents.Count(); h++)
            {
                md           = t.dayEvents[h];
                fastForEvent = FastType.FAST_NULL;
                if (md.fasttype != FastType.FAST_NULL)
                {
                    fastForEvent = md.fasttype;
                    subject      = md.fastsubject;
                }

                if (fastForEvent != FastType.FAST_NULL)
                {
                    if (s.nFastID == FastType.FAST_EKADASI)
                    {
                        if (GCDisplaySettings.Current.getValue(42) == 0)
                        {
                            str = string.Format(GCStrings.Localized("(Fast today for {0})"), subject);
                            s.AddEvent(DisplayPriorities.PRIO_FASTING, GCDS.DISP_ALWAYS, str);
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fasting is done yesterday)"));
                            //"(Fasting is done yesterday)"
                        }
                        else
                        {
                            str = string.Format(GCStrings.Localized("(Fast till noon for {0}, with feast tomorrow)"), subject);
                            s.AddEvent(DisplayPriorities.PRIO_FASTING, GCDS.DISP_ALWAYS, str);
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fasting is done yesterday, today is feast)"));
                            //"(Fasting is done yesterday, today is feast)";
                        }
                    }
                    else if (t.nFastID == FastType.FAST_EKADASI)
                    {
                        if (GCDisplaySettings.Current.getValue(42) != 0)
                        {
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fasting till noon, with feast tomorrow)"));
                        }
                        //"(Fasting till noon, with feast tomorrow)";
                        else
                        {
                            t.AddEvent(md.prio + 1, md.dispItem, GCStrings.Localized("(Fast today)"));
                        }
                        //"(Fast today)"
                    }
                    else
                    {
                        /* OLD STYLE FASTING
                         * if (GCDisplaySettings.Current.getValue(42) == 0)
                         * {
                         *  if (nftype > 1)
                         *      nftype = 7;
                         *  else nftype = 0;
                         * }*/
                        if (fastForEvent != FastType.FAST_NULL)
                        {
                            t.AddEvent(md.prio + 1, md.dispItem,
                                       GCStrings.GetFastingName(fastForEvent));
                        }
                    }
                }
                if (fastForDay < fastForEvent)
                {
                    fastForDay = fastForEvent;
                }
            }

            if (fastForDay != FastType.FAST_NULL)
            {
                if (s.nFastID == FastType.FAST_EKADASI)
                {
                    t.nFeasting = FeastType.FEAST_TODAY_FAST_YESTERDAY;
                    s.nFeasting = FeastType.FEAST_TOMMOROW_FAST_TODAY;
                }
                else if (t.nFastID == FastType.FAST_EKADASI)
                {
                    u.nFeasting = FeastType.FEAST_TODAY_FAST_YESTERDAY;
                    t.nFeasting = FeastType.FEAST_TOMMOROW_FAST_TODAY;
                }
                else
                {
                    t.nFastID = fastForDay;
                }
            }
        }
示例#3
0
        public int MahadvadasiCalc(GCEarthData earth)
        {
            VAISNAVADAY t = this;

            if (t.Previous == null || t.Next == null)
            {
                return(0);
            }

            int nMahaType = MahadvadasiType.EV_NULL;
            //int nMhdDay = -1;

            VAISNAVADAY s       = t.Previous;
            VAISNAVADAY u       = t.Next;
            VAISNAVADAY mahaDay = null;

            // if yesterday is dvadasi
            // then we skip this day
            if (GCTithi.TITHI_DVADASI(s.astrodata.sunRise.Tithi))
            {
                return(1);
            }

            if (TithiId.TITHI_GAURA_DVADASI == t.astrodata.sunRise.Tithi && TithiId.TITHI_GAURA_DVADASI == t.astrodata.sunSet.Tithi && t.IsMhd58(out nMahaType))
            {
                t.nMahadvadasiID = nMahaType;
                mahaDay          = t;
            }
            else if (GCTithi.TITHI_DVADASI(t.astrodata.sunRise.Tithi))
            {
                if (GCTithi.TITHI_DVADASI(u.astrodata.sunRise.Tithi) && GCTithi.TITHI_EKADASI(s.astrodata.sunRise.Tithi) && GCTithi.TITHI_EKADASI(s.astrodata.sunArunodaya.Tithi))
                {
                    t.nMahadvadasiID = MahadvadasiType.EV_VYANJULI;
                    mahaDay          = t;
                }
                else if (t.NextNewFullIsVriddhi(earth))
                {
                    t.nMahadvadasiID = MahadvadasiType.EV_PAKSAVARDHINI;
                    mahaDay          = t;
                }
                else if (GCTithi.TITHI_LESS_EKADASI(s.astrodata.sunArunodaya.Tithi))
                {
                    t.nMahadvadasiID = MahadvadasiType.EV_SUDDHA;
                    mahaDay          = t;
                }
            }

            if (mahaDay != null && mahaDay.Next != null)
            {
                // fasting day
                mahaDay.nFastID            = FastType.FAST_EKADASI;
                mahaDay.ekadasi_vrata_name = GCEkadasi.GetEkadasiName(t.astrodata.Masa, t.astrodata.sunRise.Paksa);
                mahaDay.ekadasi_parana     = false;
                mahaDay.eparana_time1      = null;
                mahaDay.eparana_time2      = null;

                // parana day
                mahaDay.Next.nFastID        = FastType.FAST_NULL;
                mahaDay.Next.ekadasi_parana = true;
                mahaDay.Next.eparana_time1  = null;
                mahaDay.Next.eparana_time2  = null;
            }

            return(1);
        }
示例#4
0
        public int EkadasiCalc(GCEarthData earth)
        {
            VAISNAVADAY t = this;

            if (t.Previous == null || t.Next == null)
            {
                return(0);
            }

            VAISNAVADAY s = t.Previous;
            VAISNAVADAY u = t.Next;

            if (GCTithi.TITHI_EKADASI(t.astrodata.sunRise.Tithi))
            {
                // if TAT < 11 then NOT_EKADASI
                if (GCTithi.TITHI_LESS_EKADASI(t.astrodata.sunArunodaya.Tithi))
                {
                    t.nMahadvadasiID     = MahadvadasiType.EV_NULL;
                    t.ekadasi_vrata_name = "";
                    t.nFastID            = FastType.FAST_NULL;
                }
                else
                {
                    // else ak MD13 then MHD1 and/or 3
                    if (GCTithi.TITHI_EKADASI(s.astrodata.sunRise.Tithi) && GCTithi.TITHI_EKADASI(s.astrodata.sunArunodaya.Tithi))
                    {
                        if (GCTithi.TITHI_TRAYODASI(u.astrodata.sunRise.Tithi))
                        {
                            t.nMahadvadasiID     = MahadvadasiType.EV_UNMILANI_TRISPRSA;
                            t.ekadasi_vrata_name = GCEkadasi.GetEkadasiName(t.astrodata.Masa, t.astrodata.sunRise.Paksa);
                            t.nFastID            = FastType.FAST_EKADASI;
                        }
                        else
                        {
                            t.nMahadvadasiID     = MahadvadasiType.EV_UNMILANI;
                            t.ekadasi_vrata_name = GCEkadasi.GetEkadasiName(t.astrodata.Masa, t.astrodata.sunRise.Paksa);
                            t.nFastID            = FastType.FAST_EKADASI;
                        }
                    }
                    else
                    {
                        if (GCTithi.TITHI_TRAYODASI(u.astrodata.sunRise.Tithi))
                        {
                            t.nMahadvadasiID     = MahadvadasiType.EV_TRISPRSA;
                            t.ekadasi_vrata_name = GCEkadasi.GetEkadasiName(t.astrodata.Masa, t.astrodata.sunRise.Paksa);
                            t.nFastID            = FastType.FAST_EKADASI;
                        }
                        else
                        {
                            // else ak U je MAHADVADASI then NOT_EKADASI
                            if (GCTithi.TITHI_EKADASI(u.astrodata.sunRise.Tithi) || (u.nMahadvadasiID >= MahadvadasiType.EV_SUDDHA))
                            {
                                t.nMahadvadasiID     = MahadvadasiType.EV_NULL;
                                t.ekadasi_vrata_name = "";
                                t.nFastID            = FastType.FAST_NULL;
                            }
                            else if (u.nMahadvadasiID == MahadvadasiType.EV_NULL)
                            {
                                // else suddha ekadasi
                                t.nMahadvadasiID     = MahadvadasiType.EV_SUDDHA;
                                t.ekadasi_vrata_name = GCEkadasi.GetEkadasiName(t.astrodata.Masa, t.astrodata.sunRise.Paksa);
                                t.nFastID            = FastType.FAST_EKADASI;
                            }
                        }
                    }
                }
            }
            // test for break fast


            return(1);
        }