示例#1
0
        /// <summary>
        /// 获取增加指定的数值后的干支实例
        /// </summary>
        /// <param name="i">增加的数值</param>
        /// <returns>干支</returns>
        public GanZhi Inc(int i)
        {
            TianGan t = _tg.Inc(i);
            DiZhi   d = _dz.Inc(i);

            return(new GanZhi(t, d));
        }
示例#2
0
文件: HFDate.cs 项目: Loong-Lee/VSDT
        private GanZhi GetLunarTime()
        {
            GanZhi lunarDay = this.LunarDay;
            DiZhi  adz      = this.HourToDiZhi(this.Value.Hour);

            return(new GanZhi(this.GetTimeGan(lunarDay.Gan.ID, adz.ID), adz));
        }
示例#3
0
        /// <summary>
        /// 日柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarDay()
        {
            TianGan rg = GetDayGan(Value);
            DiZhi   rz = GetDayZhi(Value);

            return(new GanZhi(rg, rz));
        }
示例#4
0
        /// <summary>
        /// 取时柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarTime()
        {
            GanZhi  rz = LunarDay;
            DiZhi   sz = HourToDiZhi(Value.Hour);
            TianGan sg = GetTimeGan(rz.Gan.ID, sz.ID);

            return(new GanZhi(sg, sz));
        }
示例#5
0
        /// <summary>
        /// 取某天的日支
        /// </summary>
        /// <param name="dt">日期</param>
        /// <returns></returns>
        private DiZhi GetDayZhi(System.DateTime dt)
        {
            System.DateTime dt1 = new System.DateTime(2000, 2, 5, 12, 0, 0, 0);////以2000.2.5为基准
            System.DateTime dt2 = new System.DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0);
            int             n   = (dt2 - dt1).Days;
            DiZhi           dz  = new DiZhi(DiZhiTypes.Si);

            return(dz.Inc(n));
        }
示例#6
0
        /// <summary>
        /// 取本日期的月柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarMonth()
        {
            int     m  = LunarCalendarMonth;
            GanZhi  nz = LunarYear;
            TianGan tg = GetMonthGanByYear(nz.Gan.ID, m);
            DiZhi   dz = MonthToDiZhi(m);

            return(new GanZhi(tg, dz));
        }
示例#7
0
文件: HFDate.cs 项目: Loong-Lee/VSDT
        private DiZhi GetDayZhi(DateTime dt)
        {
            DateTime time  = new DateTime(0x7d0, 2, 5, 12, 0, 0, 0);
            DateTime time2 = new DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0);
            TimeSpan span  = (TimeSpan)(time2 - time);
            int      days  = span.Days;
            DiZhi    zhi   = new DiZhi(DiZhiTypes.Si);

            return(zhi.Inc(days));
        }
示例#8
0
文件: HFDate.cs 项目: Loong-Lee/VSDT
        private DiZhi GetYearDiZhi(int y)
        {
            int   i   = y - 0x7d0;
            DiZhi zhi = new DiZhi(DiZhiTypes.Chen);

            if (i == 0)
            {
                return(zhi);
            }
            return(zhi.Inc(i));
        }
示例#9
0
        /// <summary>
        /// 取指定公历年的地支
        /// </summary>
        /// <param name="y">年份</param>
        /// <returns>地支</returns>
        private DiZhi GetYearDiZhi(int y)
        {
            int   i  = y - 2000;//以2000年为基准
            DiZhi dz = new DiZhi(DiZhiTypes.Chen);

            if (i == 0)
            {
                return(dz);
            }
            else
            {
                return(dz.Inc(i));
            }
        }
示例#10
0
        /// <summary>
        /// 获取本日期的年柱
        /// </summary>
        /// <returns></returns>
        private GanZhi GetLunarYear()
        {
            int      y  = Value.Year;
            DateTime d1 = GetSpringFestival(Value.Year);//获取该年的正月初一的公历日期
            DateTime d2 = new DateTime(Value.Year, Value.Month, Value.Day, 0, 0, 0, 0);

            if (d2 < d1)
            {
                y--;
            }
            TianGan tg = GetYearTianGan(y);
            DiZhi   dz = GetYearDiZhi(y);

            return(new GanZhi(tg, dz));
        }
示例#11
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="atg">天干枚举</param>
 /// <param name="adz">地支枚举</param>
 public GanZhi(TianGanTypes atg, DiZhiTypes adz)
 {
     _tg = new TianGan(atg);
     _dz = new DiZhi(adz);
 }
示例#12
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public GanZhi()
 {
     _tg = new TianGan(TianGanTypes.Jia);
     _dz = new DiZhi(DiZhiTypes.Zi);
 }
示例#13
0
文件: HFDate.cs 项目: sunpander/VSDT
 private DiZhi GetYearDiZhi(int y)
 {
     int i = y - 0x7d0;
     DiZhi zhi = new DiZhi(DiZhiTypes.Chen);
     if (i == 0)
     {
         return zhi;
     }
     return zhi.Inc(i);
 }
示例#14
0
文件: HFDate.cs 项目: sunpander/VSDT
 private DiZhi GetDayZhi(DateTime dt)
 {
     DateTime time = new DateTime(0x7d0, 2, 5, 12, 0, 0, 0);
     DateTime time2 = new DateTime(dt.Year, dt.Month, dt.Day, 12, 0, 0, 0);
     TimeSpan span = (TimeSpan) (time2 - time);
     int days = span.Days;
     DiZhi zhi = new DiZhi(DiZhiTypes.Si);
     return zhi.Inc(days);
 }
示例#15
0
文件: GanZhi.cs 项目: sunpander/VSDT
 public GanZhi(TianGanTypes atg, DiZhiTypes adz)
 {
     this._tg = new TianGan(atg);
     this._dz = new DiZhi(adz);
 }
示例#16
0
文件: GanZhi.cs 项目: sunpander/VSDT
 public GanZhi(TianGan atg, DiZhi adz)
 {
     this._tg = atg;
     this._dz = adz;
 }
示例#17
0
文件: GanZhi.cs 项目: Loong-Lee/VSDT
 public GanZhi()
 {
     this._tg = new TianGan(TianGanTypes.Jia);
     this._dz = new DiZhi(DiZhiTypes.Zi);
 }
示例#18
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="atg">天干</param>
 /// <param name="adz">地支</param>
 public GanZhi(TianGan atg, DiZhi adz)
 {
     _tg = atg;
     _dz = adz;
 }
示例#19
0
文件: GanZhi.cs 项目: Loong-Lee/VSDT
 public GanZhi(TianGan atg, DiZhi adz)
 {
     this._tg = atg;
     this._dz = adz;
 }
示例#20
0
文件: GanZhi.cs 项目: sunpander/VSDT
 public GanZhi()
 {
     this._tg = new TianGan(TianGanTypes.Jia);
     this._dz = new DiZhi(DiZhiTypes.Zi);
 }