/// <summary> /// 日柱 /// </summary> /// <returns></returns> private GanZhi GetLunarDay() { TianGan rg = GetDayGan(Value); DiZhi rz = GetDayZhi(Value); return(new GanZhi(rg, rz)); }
private TianGan GetTimeGan(TianGanTypes rg, DiZhiTypes sc) { TianGanTypes jia; int i = ((int)sc) - 1; if ((rg == TianGanTypes.Jia) || (rg == TianGanTypes.Ji)) { jia = TianGanTypes.Jia; } else if ((rg == TianGanTypes.Yi) || (rg == TianGanTypes.Geng)) { jia = TianGanTypes.Bing; } else if ((rg == TianGanTypes.Bing) || (rg == TianGanTypes.Xin)) { jia = TianGanTypes.Wu; } else if ((rg == TianGanTypes.Ding) || (rg == TianGanTypes.Ren)) { jia = TianGanTypes.Geng; } else { jia = TianGanTypes.Ren; } TianGan gan = new TianGan(jia); return(gan.Inc(i)); }
private TianGan GetMonthGanByYear(TianGanTypes ng, int m1) { TianGanTypes bing; int num = Math.Abs(m1); if ((ng == TianGanTypes.Jia) || (ng == TianGanTypes.Ji)) { bing = TianGanTypes.Bing; } else if ((ng == TianGanTypes.Yi) || (ng == TianGanTypes.Geng)) { bing = TianGanTypes.Wu; } else if ((ng == TianGanTypes.Bing) || (ng == TianGanTypes.Xin)) { bing = TianGanTypes.Geng; } else if ((ng == TianGanTypes.Ding) || (ng == TianGanTypes.Ren)) { bing = TianGanTypes.Ren; } else { bing = TianGanTypes.Jia; } TianGan gan = new TianGan(bing); return(gan.Inc(num - 1)); }
/// <summary> /// 日上起时干 /// </summary> /// <param name="rg">日干</param> /// <param name="sc">时辰</param> /// <returns>时干</returns> private TianGan GetTimeGan(TianGanTypes rg, DiZhiTypes sc) { int sc1 = ((int)sc) - 1; TianGanTypes tg; if ((rg == TianGanTypes.Jia) || (rg == TianGanTypes.Ji)) { tg = TianGanTypes.Jia; } else if ((rg == TianGanTypes.Yi) || (rg == TianGanTypes.Geng)) { tg = TianGanTypes.Bing; } else if ((rg == TianGanTypes.Bing) || (rg == TianGanTypes.Xin)) { tg = TianGanTypes.Wu; } else if ((rg == TianGanTypes.Ding) || (rg == TianGanTypes.Ren)) { tg = TianGanTypes.Geng; } else { tg = TianGanTypes.Ren; } TianGan t = new TianGan(tg); return(t.Inc(sc1)); }
/// <summary> /// 年上取月干 /// </summary> /// <param name="ng">年干</param> /// <param name="m1">农历月份</param> /// <returns>月干</returns> private TianGan GetMonthGanByYear(TianGanTypes ng, int m1) //年上取月干 { int m = Math.Abs(m1); TianGanTypes tg; if ((ng == TianGanTypes.Jia) || (ng == TianGanTypes.Ji)) { tg = TianGanTypes.Bing; } else if ((ng == TianGanTypes.Yi) || (ng == TianGanTypes.Geng)) { tg = TianGanTypes.Wu; } else if ((ng == TianGanTypes.Bing) || (ng == TianGanTypes.Xin)) { tg = TianGanTypes.Geng; } else if ((ng == TianGanTypes.Ding) || (ng == TianGanTypes.Ren)) { tg = TianGanTypes.Ren; } else { tg = TianGanTypes.Jia; } TianGan t = new TianGan(tg); return(t.Inc(m - 1)); }
/// <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)); }
/// <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)); }
private GanZhi GetLunarMonth() { int lunarCalendarMonth = this.LunarCalendarMonth; GanZhi lunarYear = this.LunarYear; TianGan monthGanByYear = this.GetMonthGanByYear(lunarYear.Gan.ID, lunarCalendarMonth); return(new GanZhi(monthGanByYear, this.MonthToDiZhi(lunarCalendarMonth))); }
/// <summary> /// 取某天的日干 /// </summary> /// <param name="dt">日期</param> /// <returns>日干</returns> private TianGan GetDayGan(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; TianGan tg = new TianGan(TianGanTypes.Gui); return(tg.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 TianGan GetDayGan(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; TianGan gan = new TianGan(TianGanTypes.Gui); return(gan.Inc(days)); }
private TianGan GetYearTianGan(int y) { int i = y - 0x7d0; TianGan gan = new TianGan(TianGanTypes.Geng); if (i == 0) { return(gan); } return(gan.Inc(i)); }
private GanZhi GetLunarYear() { int year = this.Value.Year; DateTime springFestival = GetSpringFestival(this.Value.Year); DateTime time2 = new DateTime(this.Value.Year, this.Value.Month, this.Value.Day, 0, 0, 0, 0); if (time2 < springFestival) { year--; } TianGan yearTianGan = this.GetYearTianGan(year); return(new GanZhi(yearTianGan, this.GetYearDiZhi(year))); }
/// <summary> /// 取指定公历年的天干 /// </summary> /// <param name="y">年份</param> /// <returns>天干</returns> private TianGan GetYearTianGan(int y) { int i = y - 2000;//以2000年为基准 TianGan tg = new TianGan(TianGanTypes.Geng); if (i == 0) { return(tg); } else { return(tg.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)); }
private TianGan GetMonthGanByYear(TianGanTypes ng, int m1) { TianGanTypes bing; int num = Math.Abs(m1); if ((ng == TianGanTypes.Jia) || (ng == TianGanTypes.Ji)) { bing = TianGanTypes.Bing; } else if ((ng == TianGanTypes.Yi) || (ng == TianGanTypes.Geng)) { bing = TianGanTypes.Wu; } else if ((ng == TianGanTypes.Bing) || (ng == TianGanTypes.Xin)) { bing = TianGanTypes.Geng; } else if ((ng == TianGanTypes.Ding) || (ng == TianGanTypes.Ren)) { bing = TianGanTypes.Ren; } else { bing = TianGanTypes.Jia; } TianGan gan = new TianGan(bing); return gan.Inc(num - 1); }
private TianGan GetDayGan(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; TianGan gan = new TianGan(TianGanTypes.Gui); return gan.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; }
/// <summary> /// 构造函数 /// </summary> /// <param name="atg">天干</param> /// <param name="adz">地支</param> public GanZhi(TianGan atg, DiZhi adz) { _tg = atg; _dz = adz; }
/// <summary> /// 构造函数 /// </summary> public GanZhi() { _tg = new TianGan(TianGanTypes.Jia); _dz = new DiZhi(DiZhiTypes.Zi); }
public GanZhi() { this._tg = new TianGan(TianGanTypes.Jia); this._dz = new DiZhi(DiZhiTypes.Zi); }
private TianGan GetTimeGan(TianGanTypes rg, DiZhiTypes sc) { TianGanTypes jia; int i = ((int) sc) - 1; if ((rg == TianGanTypes.Jia) || (rg == TianGanTypes.Ji)) { jia = TianGanTypes.Jia; } else if ((rg == TianGanTypes.Yi) || (rg == TianGanTypes.Geng)) { jia = TianGanTypes.Bing; } else if ((rg == TianGanTypes.Bing) || (rg == TianGanTypes.Xin)) { jia = TianGanTypes.Wu; } else if ((rg == TianGanTypes.Ding) || (rg == TianGanTypes.Ren)) { jia = TianGanTypes.Geng; } else { jia = TianGanTypes.Ren; } TianGan gan = new TianGan(jia); return gan.Inc(i); }
private TianGan GetYearTianGan(int y) { int i = y - 0x7d0; TianGan gan = new TianGan(TianGanTypes.Geng); if (i == 0) { return gan; } return gan.Inc(i); }
/// <summary> /// 构造函数 /// </summary> /// <param name="atg">天干枚举</param> /// <param name="adz">地支枚举</param> public GanZhi(TianGanTypes atg, DiZhiTypes adz) { _tg = new TianGan(atg); _dz = new DiZhi(adz); }
public GanZhi Inc(int i) { TianGan atg = this._tg.Inc(i); return(new GanZhi(atg, this._dz.Inc(i))); }
private GanZhi GetLunarDay() { TianGan dayGan = this.GetDayGan(this.Value); return(new GanZhi(dayGan, this.GetDayZhi(this.Value))); }