/// <summary> /// 用十天干作为排序方法,排出出每一天的喜神方位 /// </summary> /// <param name="天干地支"></param> /// <returns></returns> public static FangXiangType 获取喜神方位(TianGanDiZhiModel 天干地支) { if (天干地支 == null || 天干地支.TianGanDay == null) { throw new ArgumentNullException("天干地支不能为空"); } return(获取喜神方位(天干地支.TianGanDay)); }
/// <summary> /// 用天干与地支组合的六十甲子作为排序方法,排出出每一天的生门方位 /// </summary> /// <param name="天干"></param> /// <returns></returns> public static FangXiangType 获取生门方位(TianGanDiZhiModel 天干) { if (天干 == null) { throw new ArgumentNullException("天干不能为空"); } var key = string.Concat(天干.TianGanDay.Name.ToString(), 天干.DiZhiDay.Name.ToString()).To60甲子(); if (!生门方位.ContainsKey(key)) { throw new ArgumentNullException("生门方位中没有定义该天干信息"); } return(生门方位[key]); }
/// <summary> /// /// </summary> /// <param name="公历时间"></param> /// <returns></returns> public static TianGanDiZhiModel 获取天干地支(DateTime 公历时间) { var 纪月 = ChineseCalendar.计算纪月(公历时间); var 纪时 = ChineseCalendar.计算纪时(公历时间); var result = new TianGanDiZhiModel() { TianGanYear = new TianGanModel() { Name = ChineseCalendar.计算纪年天干(公历时间) }, TianGanMonth = new TianGanModel() { Name = 纪月.ToString().Substring(0, 1).To天干() }, TianGanDay = new TianGanModel() { Name = ChineseCalendar.计算纪日天干(公历时间) }, TianGanHour = new TianGanModel() { Name = 纪时.ToString().Substring(0, 1).To天干() }, DiZhiYear = new DiZhiModel() { Name = ChineseCalendar.计算纪年地支(公历时间) }, DiZhiMonth = new DiZhiModel() { Name = 纪月.ToString().Substring(1, 1).To地支() }, DiZhiDay = new DiZhiModel() { Name = ChineseCalendar.计算纪日地支(公历时间) }, DiZhiHour = new DiZhiModel() { Name = 纪时.ToString().Substring(1, 1).To地支() }, }; return(result); }