Ejemplo n.º 1
0
        public void AddFestivalCopy(GPEvent pEvx)
        {
            GPCalendarDay.Festival fest = null;
            if (pEvx.hasFasting())
            {
                fest = new GPCalendarDay.Festival(((pEvx.nClass >= 0) ? pEvx.nClass * 5 + 30 : 200), GPDisplays.Keys.FestivalClass(pEvx.nClass), pEvx.getText(), pEvx.getFastType(), pEvx.getFastSubject());
            }
            else
            {
                fest = new GPCalendarDay.Festival(((pEvx.nClass >= 0) ? pEvx.nClass * 5 + 30 : 200), GPDisplays.Keys.FestivalClass(pEvx.nClass), pEvx.getText());
            }
            Festivals.Add(fest);

            if (GPDisplays.Calendar.AnniversaryType() != 2 && pEvx.nStartYear > -7000)
            {
                int years = astrodata.nGaurabdaYear - (pEvx.nStartYear - 1496);
                fest.Text += " ";
                if (GPDisplays.Calendar.AnniversaryType() == 0)
                {
                    fest.Text += string.Format(GPStrings.getString(962), years);
                }
                else
                {
                    fest.Text += string.Format(GPStrings.getString(963), years);
                }
            }

            if (pEvx.hasChildrenItems())
            {
                foreach (GPEvent ev in pEvx.childrenItems)
                {
                    if (ev is GPEventRelative)
                    {
                        GPEventRelative relev = ev as GPEventRelative;
                        GPCalendarDay   vd    = GetDayWithOffset(relev.nOffset);
                        if (vd != null)
                        {
                            vd.AddFestivalCopy(relev);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void InsertEvent(XmlElement elem)
        {
            string  evType = elem.GetAttribute("type");
            GPEvent e      = null;

            if (evType.Equals("TITHI"))
            {
                GPEventTithi et = new GPEventTithi();
                et.nTithi = GetSubelementIntValue(elem, "tithi", 0);
                et.nMasa  = GetSubelementIntValue(elem, "masa", 0);
                e         = et;
            }
            else if (evType.Equals("REL"))
            {
                GPEventRelative er = new GPEventRelative();
                er.nSpecRef = GetSubelementIntValue(elem, "specref", 0);
                e           = er;
            }
            else if (evType.Equals("SAN"))
            {
                GPEventSankranti es = new GPEventSankranti();
                es.nSankranti = GetSubelementIntValue(elem, "sankranti", 0);
                e             = es;
            }
            else if (evType.Equals("NAK"))
            {
                GPEventNaksatra en = new GPEventNaksatra();
                en.nNaksatra = GetSubelementIntValue(elem, "naksatra", 0);
                e            = en;
            }
            else if (evType.Equals("YOG"))
            {
                GPEventYoga en = new GPEventYoga();
                en.nYoga = GetSubelementIntValue(elem, "naksatra", 0);
                e        = en;
            }
            else if (evType.Equals("ASTRO"))
            {
                GPEventAstro ea = new GPEventAstro();
                ea.nAstroType = GetSubelementIntValue(elem, "astrotype", 1);
                ea.nData      = GetSubelementIntValue(elem, "data", 0);
                e             = ea;
            }

            e.nClass   = GetAttributeIntValue(elem, "class", 6);
            e.nVisible = GetAttributeIntValue(elem, "visible", 1);
            e.nUsed    = GetAttributeIntValue(elem, "used", 0);

            e.nStartYear = GetSubelementIntValue(elem, "startyear", -10000);
            e.nSpec      = GetSubelementIntValue(elem, "specid", -1);
            e.nOffset    = GetSubelementIntValue(elem, "offset", 0);
            e.nDeleted   = GetSubelementIntValue(elem, "deleted", 0);
            e.setRawFastType(GetSubelementIntValue(elem, "fasttype", 0));
            e.setRawFastSubject(GetSubelementValue(elem, "fastsubject", "").Trim());
            e.setRawText(GetSubelementValue(elem, "text", "").Trim());
            e.textStringId        = GetSubelementIntValue(elem, "textstringid", -1);
            e.fastSubjectStringId = GetSubelementIntValue(elem, "fastsubjectstringid", -1);
            e.eventId             = GetSubelementIntValue(elem, "eventid", 0);

            /*if (e.nClass < 6)
             * {
             *  if (e.strText.Length > 0 && e.textStringId < 0)
             *  {
             *      sidSb.AppendFormat("{0}\t{1}\n", currSid, e.strText);
             *      e.textStringId = currSid;
             *      currSid++;
             *  }
             *
             *  if (e.strFastSubject.Length > 0 && e.fastSubjectStringId < 0)
             *  {
             *      sidSb.AppendFormat("{0}\t{1}\n", currSid, e.strFastSubject);
             *      e.fastSubjectStringId = currSid;
             *      currSid++;
             *  }
             * }*/

            add(e);
        }