Exemplo n.º 1
0
        private IEnumerable <ShiYun> 起大运(HHTime birthday)
        {
            DateTime?     dayunTime = birthday.Type == HHTime.TimeType.时间 ? LnBase.起运时间(birthday.DateTime, this.方向) : (DateTime?)null;
            List <ShiYun> dayuns    = new List <ShiYun>();

            ShiYun dyVor = new ShiYun(this.四柱.月.Add(0), ShiYun.YunType.大运, this.time.Bazi);

            dyVor.Start = birthday.Type == HHTime.TimeType.时间 ? birthday.DateTime : (DateTime?)null;
            dyVor.End   = dayunTime;
            dyVor.起小运  += this.起小运;
            dyVor.起流年  += this.起流年;
            dayuns.Add(dyVor);

            int f = this.方向 == 方向.顺行 ? 1 : -1;

            for (int i = 1; i <= 10; i++)
            {
                ShiYun dy = new ShiYun(this.四柱.月.Add(f * i), ShiYun.YunType.大运, this.time.Bazi);
                if (dayunTime != null)
                {
                    dy.Start = ((DateTime)dayunTime).AddYears(10 * (i - 1));
                    dy.End   = ((DateTime)dayunTime).AddYears(10 * i);
                    dy.起小运  += this.起小运;
                    dy.起流年  += this.起流年;
                }

                dayuns.Add(dy);
            }

            return(dayuns);
        }
Exemplo n.º 2
0
        private IEnumerable <ShiYun> 起小运(DateTime start, DateTime end)
        {
            List <ShiYun> res = new List <ShiYun>();

            for (int year = start.Year; year <= end.Year; year++)
            {
                int diff = year - this.time.DateTime.Year + 1;
                int f    = this.方向 == 方向.顺行 ? 1 : -1;

                GanZhi gz      = this.time.时.Add(f * diff);
                ShiYun xiaoyun = new ShiYun(gz, ShiYun.YunType.小运, this.time.Bazi);
                xiaoyun.Start = new DateTime(year, this.time.DateTime.Month, this.time.DateTime.Day);
                xiaoyun.End   = new DateTime(year + 1, this.time.DateTime.Month, this.time.DateTime.Day);
                res.Add(xiaoyun);
            }

            return(res);
        }
Exemplo n.º 3
0
        private IEnumerable <ShiYun> 起流年(DateTime start, DateTime end)
        {
            List <ShiYun> res = new List <ShiYun>();

            for (int i = 0; i <= 10; i++)
            {
                LnDate d  = new LnDate(start.AddYears(i));
                ShiYun ln = new ShiYun(new GanZhi(d.YearGZ), ShiYun.YunType.流年, this.time.Bazi);

                LnDate 立春 = LnBase.查找节气(start.AddYears(i).Year, 2);
                ln.Start = 立春.datetime + 立春.JieQiTime;
                ln.End   = ((DateTime)ln.Start).AddYears(1);

                res.Add(ln);

                // 超过时限,退出。主要是为起运前的流年考虑的。其它都是十年期。
                if (((DateTime)ln.End).Year > end.Year)
                {
                    break;
                }
            }

            return(res);
        }