/// <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)); }
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)); }
/// <summary> /// 日柱 /// </summary> /// <returns></returns> private GanZhi GetLunarDay() { TianGan rg = GetDayGan(Value); DiZhi rz = GetDayZhi(Value); return(new GanZhi(rg, rz)); }
/// <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)); }
/// <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)); }
/// <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)); }
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)); }
private DiZhi GetYearDiZhi(int y) { int i = y - 0x7d0; DiZhi zhi = new DiZhi(DiZhiTypes.Chen); if (i == 0) { return(zhi); } return(zhi.Inc(i)); }
/// <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)); } }
/// <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)); }
/// <summary> /// 构造函数 /// </summary> /// <param name="atg">天干枚举</param> /// <param name="adz">地支枚举</param> public GanZhi(TianGanTypes atg, DiZhiTypes adz) { _tg = new TianGan(atg); _dz = new DiZhi(adz); }
/// <summary> /// 构造函数 /// </summary> public GanZhi() { _tg = new TianGan(TianGanTypes.Jia); _dz = new DiZhi(DiZhiTypes.Zi); }
private DiZhi GetYearDiZhi(int y) { int i = y - 0x7d0; DiZhi zhi = new DiZhi(DiZhiTypes.Chen); if (i == 0) { return zhi; } return zhi.Inc(i); }
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); }
public GanZhi(TianGanTypes atg, DiZhiTypes adz) { this._tg = new TianGan(atg); this._dz = new DiZhi(adz); }
public GanZhi(TianGan atg, DiZhi adz) { this._tg = atg; this._dz = adz; }
public GanZhi() { this._tg = new TianGan(TianGanTypes.Jia); this._dz = new DiZhi(DiZhiTypes.Zi); }
/// <summary> /// 构造函数 /// </summary> /// <param name="atg">天干</param> /// <param name="adz">地支</param> public GanZhi(TianGan atg, DiZhi adz) { _tg = atg; _dz = adz; }