/// <summary> /// 用于赋予datatable后初始化页面,其中本命盘显示本命盘,合盘则显示比较盘 /// </summary> public void InitialChart() { if (_input == null || _input.CharType == null) { return; } _m_bazi = new BaZiMod(); #region 设置实体各种参数 string[] tmplatlng = _input.FirstPoi.ToString().Split(new char[] { '|' }); m_bazi.BirthTime = new DateEntity(_realtime ? PublicDeal.GetInstance().RealTime(DateTime.Parse(_input.FirstBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], _input.FirstPoiName)) : DateTime.Parse(_input.FirstBirth.ToString())); m_bazi.AreaName = _input.FirstPoiName.ToString(); m_bazi.Longitude = tmplatlng[0]; m_bazi.Gender = (AppEnum.Gender)_input.FirstGender; SetBenMing(); if (_input.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { tmplatlng = _input.SecondPoi.ToString().Split(new char[] { '|' }); m_bazi.BirthTime = new DateEntity(_realtime ? PublicDeal.GetInstance().RealTime(DateTime.Parse(_input.SecondBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], _input.SecondPoiName)) : DateTime.Parse(_input.SecondBirth.ToString())); m_bazi.AreaName = _input.SecondPoiName.ToString(); m_bazi.Longitude = tmplatlng[0]; m_bazi.Gender = (AppEnum.Gender)_input.SecondGender; SetHePan(); } #endregion }
public ReturnValue<BaZiMod> TimeToBaZi() { BaZiMod input = new BaZiMod(); //int nReadCount = 0; //MemoryStream ms = new MemoryStream(); //byte[] buffer = new byte[1024]; //while ((nReadCount = openPageData.Read(buffer, 0, 1024)) > 0) //{ // ms.Write(buffer, 0, nReadCount); //} //byte[] byteJson = ms.ToArray(); //string textJson = System.Text.Encoding.Default.GetString(byteJson); //input = (BaZiMod)XMS.Core.Json.JsonSerializer.Deserialize(textJson, typeof(BaZiMod)); //if (input == null) //{ input.BirthTime = new PPLive.DateEntity(DateTime.Now); input.Gender = AppEnum.Gender.male; input.RealTime = false; //} BaZiBiz.GetInstance().TimeToBaZi(ref input); return ReturnValue<BaZiMod>.Get200OK(input); }
private void SetNaYin(ref BaZiMod bazi) { bazi.NaYin[0] = (PublicValue.Nayin)(10000 + (int)bazi.YearTG * 100 + (int)bazi.YearDZ); bazi.NaYin[1] = (PublicValue.Nayin)(10000 + (int)bazi.MonthTG * 100 + (int)bazi.MonthDZ); bazi.NaYin[2] = (PublicValue.Nayin)(10000 + (int)bazi.DayTG * 100 + (int)bazi.DayDZ); bazi.NaYin[3] = (PublicValue.Nayin)(10000 + (int)bazi.HourTG * 100 + (int)bazi.HourDZ); }
private void SetWangShuai(ref BaZiMod bazi) { bazi.WangShuai[0] = GetWangShuai(bazi.YearDZ, bazi.DayTG); bazi.WangShuai[1] = GetWangShuai(bazi.MonthDZ, bazi.DayTG); bazi.WangShuai[2] = GetWangShuai(bazi.DayDZ, bazi.DayTG); bazi.WangShuai[3] = GetWangShuai(bazi.HourDZ, bazi.DayTG); }
private void SetCangGan(ref BaZiMod bazi) { string[] cang = { "9", "975", "024", "1", "149", "624", "35", "153", "468", "7", "734", "08", }; int tmp = cang[(int)bazi.YearDZ].Length; for (int j = 0; j < tmp; j++) { bazi.CangGan[0, j] = (PublicValue.TianGan)Enum.Parse(typeof(PublicValue.TianGan), cang[(int)bazi.YearDZ].Substring(j, 1)); } tmp = cang[(int)bazi.MonthDZ].Length; for (int j = 0; j < tmp; j++) { bazi.CangGan[1, j] = (PublicValue.TianGan)Enum.Parse(typeof(PublicValue.TianGan), cang[(int)bazi.MonthDZ].Substring(j, 1)); } tmp = cang[(int)bazi.DayDZ].Length; for (int j = 0; j < tmp; j++) { bazi.CangGan[2, j] = (PublicValue.TianGan)Enum.Parse(typeof(PublicValue.TianGan), cang[(int)bazi.DayDZ].Substring(j, 1)); } tmp = cang[(int)bazi.HourDZ].Length; for (int j = 0; j < tmp; j++) { bazi.CangGan[3, j] = (PublicValue.TianGan)Enum.Parse(typeof(PublicValue.TianGan), cang[(int)bazi.HourDZ].Substring(j, 1)); } }
/// <summary> /// 设置旬空 /// </summary> /// <param name="year"></param> /// <param name="mon"></param> /// <param name="day"></param> /// <param name="BaZi"></param> private void XunKongDay(ref BaZiMod bazi) { int temp = 0; temp = (9 - (int)bazi.DayTG + (int)bazi.DayDZ + 1) % 12; bazi.XunKong0 = (PublicValue.DiZhi)Enum.Parse(typeof(PublicValue.DiZhi), temp.ToString()); bazi.XunKong1 = (PublicValue.DiZhi)Enum.Parse(typeof(PublicValue.DiZhi), (temp + 1).ToString()); }
/// <summary> /// 年干阴阳 /// </summary> /// <param name="bazi"></param> private void SetYinYang(ref BaZiMod bazi) { if ((int)bazi.YearTG % 2 == 0) { bazi.YinYang = PublicValue.ShuXing.yang; } else { bazi.YinYang = PublicValue.ShuXing.yin; } }
public string BaziToHTML(BaZiMod mod) { string ret = ""; ret += mod.BirthTime.Date.ToString("yyyy-MM-dd HH:mm") + " (" + AppEnum.GetGender(mod.Gender) + ")<br />"; ret += PublicValue.GetTianGan(mod.YearTG) + PublicValue.GetDiZhi(mod.YearDZ) + " " + PublicValue.GetTianGan(mod.MonthTG) + PublicValue.GetDiZhi(mod.MonthDZ) + " " + PublicValue.GetTianGan(mod.DayTG) + PublicValue.GetDiZhi(mod.DayDZ) + " " + PublicValue.GetTianGan(mod.HourTG) + PublicValue.GetDiZhi(mod.HourDZ) + " " + PublicValue.GetTianGan(BaZiBiz.GetInstance().MinuteTG(mod.HourTG, mod.BirthTime.Date.Minute + (mod.BirthTime.Date.Hour + 1) % 2 * 60)) + PublicValue.GetDiZhi(BaZiBiz.GetInstance().MinuteDZ(mod.BirthTime.Date.Minute + (mod.BirthTime.Date.Hour + 1) % 2 * 60)) + " " + "(" + PublicValue.GetDiZhi(mod.XunKong0) + PublicValue.GetDiZhi(mod.XunKong1) + "空)<br /><br />"; ret += "大运:"; for (int i = 0; i < dayun; i++) { ret += PublicValue.GetTianGan(mod.Dayun[i].YearTG) + PublicValue.GetDiZhi(mod.Dayun[i].YearDZ) + " " + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(mod.Dayun[i].YearTG, mod.YearTG)).ShiShen) + "|"; } ret += "<br />"; ret += "始于:"; for (int i = 0; i < dayun; i++) { ret += mod.Dayun[i].Begin.ToString() + " |"; } ret += "<br />"; ret += "流年:"; for (int i = 0; i < 10; i++) { if (i != 0) { ret += " "; } for (int j = 0; j < dayun; j++) { ret += PublicValue.GetTianGan(BaZiBiz.GetInstance().YearTG(mod.Dayun[j].Begin + i)) + PublicValue.GetDiZhi(BaZiBiz.GetInstance().YearDZ(mod.Dayun[j].Begin + i)) + " " + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(BaZiBiz.GetInstance().YearTG(mod.Dayun[j].Begin + i), mod.DayTG)).ShiShen) + "|"; } ret += "<br />"; } return ret; }
protected void SetLtr() { BaZiMod m_bazi = new BaZiMod(); #region 设置实体各种参数 Control m_PlaceHolder = PreviousPage.Master.FindControl("ContentPlaceHolder1"); if (((CheckBox)m_PlaceHolder.FindControl("chkRealTime")).Checked) { m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(((WebForMain.ControlLibrary.DatePicker)m_PlaceHolder.FindControl("DatePicker1")).SelectedTime, new LatLng(SYS_DistrictBll.GetInstance().GetModel(((WebForMain.ControlLibrary.DistrictPicker)m_PlaceHolder.FindControl("District1")).Area3SysNo)))); //m_bazi.AreaSysNo = ((WebForMain.ControlLibrary.DistrictPicker)m_PlaceHolder.FindControl("District1")).Area3SysNo; m_bazi.AreaName = ((WebForMain.ControlLibrary.DistrictPicker)m_PlaceHolder.FindControl("District1")).Area1Name + "-"+ ((WebForMain.ControlLibrary.DistrictPicker)m_PlaceHolder.FindControl("District1")).Area2Name + "-" + ((WebForMain.ControlLibrary.DistrictPicker)m_PlaceHolder.FindControl("District1")).Area3Name; m_bazi.Longitude = ((WebForMain.ControlLibrary.DistrictPicker)m_PlaceHolder.FindControl("District1")).lng; } else { m_bazi.BirthTime = new DateEntity(((WebForMain.ControlLibrary.DatePicker)m_PlaceHolder.FindControl("DatePicker1")).SelectedTime); } m_bazi.Gender = (AppEnum.Gender)int.Parse(((RadioButtonList)m_PlaceHolder.FindControl("drpGender")).SelectedValue); m_bazi.RealTime = ((CheckBox)m_PlaceHolder.FindControl("chkRealTime")).Checked; #endregion if (((RadioButtonList)m_PlaceHolder.FindControl("rblType")).SelectedValue != "") { switch (((RadioButtonList)m_PlaceHolder.FindControl("rblType")).SelectedValue) { case "1": BaZi1.m_bazi = m_bazi; BaZi1.total = true; break; case "2": BaZi1.m_bazi = m_bazi; BaZi1.total = false; break; } } }
private void SetDayun(ref BaZiMod bazi) { for (int i = 0; i < bazi.Dayun.Length; i++) { bazi.Dayun[i] = new BaZiDaYun(); if ((bazi.YinYang == PublicValue.ShuXing.yang && bazi.Gender == AppCmn.AppEnum.Gender.male) || (bazi.YinYang == PublicValue.ShuXing.yin && bazi.Gender == AppCmn.AppEnum.Gender.female))//顺 { bazi.Dayun[i].YearTG = (PublicValue.TianGan)(((int)bazi.MonthTG + 1 + i) % 10); bazi.Dayun[i].YearDZ = (PublicValue.DiZhi)(((int)bazi.MonthDZ + 1 + i) % 12); } else//逆 { bazi.Dayun[i].YearTG = (PublicValue.TianGan)(((int)bazi.MonthTG - 1 - i + 20) % 10); bazi.Dayun[i].YearDZ = (PublicValue.DiZhi)(((int)bazi.MonthDZ - 1 - i + 24) % 12); } bazi.Dayun[i].Begin = bazi.JiaoYun.Year + 10 * i; bazi.Dayun[i].End = bazi.Dayun[i].Begin + 9; bazi.Dayun[i].NaYin = (PublicValue.Nayin)(10000 + (int)bazi.Dayun[i].YearTG * 100 + bazi.Dayun[i].YearDZ); bazi.Dayun[i].WangShuai = GetWangShuai(bazi.Dayun[i].YearDZ, bazi.DayTG); bazi.Dayun[i].ShiShen = PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.Dayun[i].YearTG, bazi.DayTG)).ShiShen; } }
/// <summary> /// 按时间排八字 /// </summary> /// <param name="year"></param> /// <param name="mon"></param> /// <param name="day"></param> /// <param name="hour"></param> /// <param name="BaZi"></param> public void TimeToBaZi(ref BaZiMod ret) { DateTime date = ret.BirthTime.Date; int year = date.Year; int mon = date.Month; int day = date.Day; int hour = date.Hour; int daytemp = day; if (hour == 23) { daytemp++; } ret.DayTG = DayTG(year, mon, daytemp); ret.DayDZ = DayDZ(year, mon, daytemp); ret.HourTG = HourTG(ret.DayTG, hour); ret.HourDZ = HourDZ(hour); int montemp = CheckMon(ret.BirthTime); int yeartemp = CheckYear(ret.BirthTime); ret.MonthTG = MonthTG(yeartemp, montemp); ret.MonthDZ = MonthDZ(montemp); ret.YearTG = YearTG(yeartemp); ret.YearDZ = YearDZ(yeartemp); XunKongDay(ref ret); SetYinYang(ref ret); SetNaYin(ref ret); SetCangGan(ref ret); SetWangShuai(ref ret); SetQiYun(ref ret); SetDayun(ref ret); }
private void Xiaoyun(ref BaZiMod bazi) { }
private void SetDayun(ref BaZiMod bazi) { for (int i = 0; i < bazi.Dayun.Length; i++) { bazi.Dayun[i] = new BaZiDaYun(); if ((bazi.YinYang == PublicValue.ShuXing.yang && bazi.Gender == AppCmn.AppEnum.Gender.male) || (bazi.YinYang == PublicValue.ShuXing.yin && bazi.Gender == AppCmn.AppEnum.Gender.female))//顺 { bazi.Dayun[i].YearTG = (PublicValue.TianGan)(((int)bazi.MonthTG + 1 + i) % 10); bazi.Dayun[i].YearDZ = (PublicValue.DiZhi)(((int)bazi.MonthDZ + 1 + i) % 12); } else//逆 { bazi.Dayun[i].YearTG = (PublicValue.TianGan)(((int)bazi.MonthTG - 1 - i + 20) % 10); bazi.Dayun[i].YearDZ = (PublicValue.DiZhi)(((int)bazi.MonthDZ - 1 - i + 24) % 12); } bazi.Dayun[i].Begin = bazi.JiaoYun.Year + 10 * i; bazi.Dayun[i].End = bazi.Dayun[i].Begin + 9; bazi.Dayun[i].NaYin = (PublicValue.Nayin)(10000+(int)bazi.Dayun[i].YearTG * 100 + bazi.Dayun[i].YearDZ); bazi.Dayun[i].WangShuai = GetWangShuai(bazi.Dayun[i].YearDZ, bazi.DayTG); bazi.Dayun[i].ShiShen = PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.Dayun[i].YearTG,bazi.DayTG)).ShiShen; } }
public ReturnValue<BaZiMod> TimeToBaZi(Stream openPageData) { BaZiMod input = new BaZiMod(); int nReadCount = 0; MemoryStream ms = new MemoryStream(); byte[] buffer = new byte[1024]; while ((nReadCount = openPageData.Read(buffer, 0, 1024)) > 0) { ms.Write(buffer, 0, nReadCount); } byte[] byteJson = ms.ToArray(); string textJson = System.Text.Encoding.Default.GetString(byteJson); input = (BaZiMod)XMS.Core.Json.JsonSerializer.Deserialize(textJson, typeof(BaZiMod)); if (input == null) { input = new BaZiMod(); input.BirthTime = new PPLive.DateEntity(DateTime.Now); input.Gender = AppEnum.Gender.male; input.RealTime = false; } else { if (input.IsDayLight) { input.BirthTime = new DateEntity(input.BirthTime.Date.AddHours(-1)); } if (input.RealTime) { input.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(input.BirthTime.Date, new LatLng("30.00",input.Longitude,input.AreaName))); } else { input.BirthTime = new PPLive.DateEntity(input.BirthTime.Date); } } BaZiBiz.GetInstance().TimeToBaZi(ref input); return ReturnValue<BaZiMod>.Get200OK(input); }
public ReturnValue<QA_QuestionShow<BaZiMod>> GetQuestionForBaZi(int sysno) { QA_QuestionMod tmp = QA_QuestionBll.GetInstance().GetModel(sysno); QA_QuestionShow<BaZiMod> ret = new QA_QuestionShow<BaZiMod>(); tmp.MemberwiseCopy(ret); USR_CustomerShow tmpu = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(ret.CustomerSysNo).MemberwiseCopy(tmpu); ret.Customer = tmpu; #region 设置命盘 FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(ret.SysNo); if (m_chart != null) { BaZiMod m_bazi = new BaZiMod(); string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName))); m_bazi.AreaName = m_chart.FirstPoiName.ToString(); m_bazi.Longitude = tmplatlng[0]; m_bazi.Gender = (AppEnum.Gender)m_chart.FirstGender; BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi); ret.Chart.Add(m_bazi); if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { BaZiMod m_bazi1 = new BaZiMod(); tmplatlng = m_chart.SecondPoi.ToString().Split(new char[] { '|' }); m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName))); m_bazi1.AreaName = m_chart.SecondPoiName.ToString(); m_bazi1.Longitude = tmplatlng[0]; m_bazi1.Gender = (AppEnum.Gender)m_chart.SecondGender; BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1); ret.Chart.Add(m_bazi1); } } #endregion return ReturnValue<QA_QuestionShow<BaZiMod>>.Get200OK(ret); }
public string ZiWeiLiuToHTML(ZiWeiMod mod) { StringBuilder sb = new StringBuilder(); string[, ,] tmpgong = new string[12, 9, 10];//12宫,每宫9行,每行10个字 string[] middle = new string[19]; bool starflag = false; string tmphtmla = ""; string tmphtmlb = "</font>"; #region 星体与庙旺四化 for (int i = 0; i < mod.Xing.Length; i++) { if (i == 58 || i == 59 || i == 62 || i == 63 || i == 66 || i == 64 || i == 67) { continue; } if (i <= 13) { tmphtmla = "<font color=#ff2a01>";//主星颜色 } else if (i <= 21) { tmphtmla = "<font color=#fe30d9>";//辅星颜色 } else if (i <= 27) { tmphtmla = "<font color=#6f25e6>";//凶星颜色 } else { tmphtmla = "<font color=#cb8430>";//小星颜色 } starflag = false; //每个宫内打印10列 for (int j = 9; j >= 0; j--) { if (tmpgong[mod.Xing[i].Gong, 0, j] == null || tmpgong[mod.Xing[i].Gong, 0, j] == "") { tmpgong[mod.Xing[i].Gong, 0, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(0, 1) + tmphtmlb; tmpgong[mod.Xing[i].Gong, 1, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(1, 1) + tmphtmlb; if ((int)mod.Xing[i].Wang != 0) { tmpgong[mod.Xing[i].Gong, 2, j] = PublicValue.GetZiWeiMiaowang(mod.Xing[i].Wang); } if ((int)mod.Xing[i].Hua != 0) { tmpgong[mod.Xing[i].Gong, 3, j] = "<font color=#FFFFFF><span style='background-color: #ff2a01'>" + PublicValue.GetZiWeiSihua(mod.Xing[i].Hua) + "</span></font>"; } if ((int)mod.Xing[i].YunHua != 0) { tmpgong[mod.Xing[i].Gong, 4, j] = "<font color=#FFFFFF><span style='background-color: #149e11'>" + PublicValue.GetZiWeiSihua(mod.Xing[i].YunHua) + "</span></font>"; } if ((int)mod.Xing[i].LiuHua != 0) { tmpgong[mod.Xing[i].Gong, 5, j] = "<font color=#FFFFFF><span style='background-color: #005995'>" + PublicValue.GetZiWeiSihua(mod.Xing[i].LiuHua) + "</span></font>"; } starflag = true; break; } } if (starflag) { continue; } for (int j = 0; j <= 4; j++)//第一行放不下的小星 { if (tmpgong[mod.Xing[i].Gong, 2, j] == null || tmpgong[mod.Xing[i].Gong, 2, j] == "") { tmpgong[mod.Xing[i].Gong, 2, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(0, 1) + tmphtmlb; tmpgong[mod.Xing[i].Gong, 3, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(1, 1) + tmphtmlb; starflag = true; break; } } } for (int i = 0; i < 7; i++)//流耀 { string tmp = "昌曲魁钺羊陀禄"; for (int j = 0; j < 4; j++) { if (tmpgong[mod.YunYao[i], 4, j] == null || tmpgong[mod.YunYao[i], 4, j] == "") { tmpgong[mod.YunYao[i], 4, j] = "<font color=#149e11>运</font>"; tmpgong[mod.YunYao[i], 5, j] = "<font color=#149e11>" + tmp.Substring(i, 1) + "</font>"; break; } } for (int j = 0; j < 4; j++) { if (tmpgong[mod.LiuYao[i], 4, j] == null || tmpgong[mod.LiuYao[i], 4, j] == "") { tmpgong[mod.LiuYao[i], 4, j] = "<font color=#005995>流</font>"; tmpgong[mod.LiuYao[i], 5, j] = "<font color=#005995>" + tmp.Substring(i, 1) + "</font>"; break; } } } #endregion #region 十二神与宫名 for (int i = 0; i < 12; i++) { string boshicolor = "#005995"; string taisuicolor = "#018e98"; string jiangqiancolor = "#1a85c2"; string changshengcolor = "#149e11"; tmpgong[i, 7, 0] = "<font color=" + boshicolor + ">" + PublicValue.GetZiWeiBoShi(mod.Gong[i].BoShi).Substring(0, 1) + "</font>"; tmpgong[i, 8, 0] = "<font color=" + boshicolor + ">" + PublicValue.GetZiWeiBoShi(mod.Gong[i].BoShi).Substring(1, 1) + "</font>"; tmpgong[i, 7, 1] = "<font color=" + taisuicolor + ">" + PublicValue.GetZiWeiTaiSui(mod.Gong[i].TaiSui).Substring(0, 1) + "</font>"; tmpgong[i, 8, 1] = "<font color=" + taisuicolor + ">" + PublicValue.GetZiWeiTaiSui(mod.Gong[i].TaiSui).Substring(1, 1) + "</font>"; tmpgong[i, 7, 2] = "<font color=" + jiangqiancolor + ">" + PublicValue.GetZiWeiJiangQian(mod.Gong[i].JiangQian).Substring(0, 1) + "</font>"; tmpgong[i, 8, 2] = "<font color=" + jiangqiancolor + ">" + PublicValue.GetZiWeiJiangQian(mod.Gong[i].JiangQian).Substring(1, 1) + "</font>"; //本命宫位 tmpgong[i, 6, 4] = "<font id='gong" + i + "' onMouseOver='liusansi(" + i + ");' color=#ff2a01>" + PublicValue.GetZiWeiGong(mod.Gong[i].GongName).Substring(0, 1); if (mod.Shen == i) { tmpgong[i, 6, 5] = "★"; tmpgong[i, 6, 6] = "身" + "</font>"; if (mod.Ming == i) { tmpgong[i, 6, 4] = "<font id='gong" + i + "' onMouseOver='liusansi(" + i + ");' color=#ff2a01>命"; } } else { tmpgong[i, 6, 5] = PublicValue.GetZiWeiGong(mod.Gong[i].GongName).Substring(1, 1); tmpgong[i, 6, 6] = PublicValue.GetZiWeiGong(mod.Gong[i].GongName).Substring(2, 1) + "</font>"; } //大运宫位 tmpgong[i, 7, 4] = "<font id='yun" + i + "' onMouseOver='liusansi(" + i + ");' color=#149e11>运"; tmpgong[i, 7, 5] = PublicValue.GetZiWeiGong(mod.Gong[i].YunGongName).Substring(0, 1); tmpgong[i, 7, 6] = PublicValue.GetZiWeiGong(mod.Gong[i].YunGongName).Substring(1, 1) + "</font>"; //流年宫位 tmpgong[i, 8, 4] = "<font id='liu" + i + "' onMouseOver='liusansi(" + i + ");' color=#005995>流"; tmpgong[i, 8, 5] = PublicValue.GetZiWeiGong(mod.Gong[i].LiuGongName).Substring(0, 1); tmpgong[i, 8, 6] = PublicValue.GetZiWeiGong(mod.Gong[i].LiuGongName).Substring(1, 1) + "</font>"; tmpgong[i, 7, 8] = "<font color=" + changshengcolor + ">" + PublicValue.GetZiWeiChangSheng(mod.Gong[i].ChangSheng).Substring(0, 1) + "</font>"; tmpgong[i, 8, 8] = "<font color=" + changshengcolor + ">" + PublicValue.GetZiWeiChangSheng(mod.Gong[i].ChangSheng).Substring(1, 1) + "</font>"; tmpgong[i, 7, 9] = PublicValue.GetTianGan(mod.Gong[i].TG); tmpgong[i, 8, 9] = PublicValue.GetDiZhi(mod.Gong[i].DZ); //流年月日显示 if (transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB) != " ") { tmpgong[i, 5, 4] = transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB).Substring(0, 2); tmpgong[i, 5, 5] = transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB).Substring(2, 1); tmpgong[i, 5, 6] = transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB).Substring(3, 2); } string monthname = PublicValue.GetNongliMonth((PublicValue.NongliMonth)((i - mod.LiuYueGong + 12) % 12+1)); tmpgong[i, 6, 0] = monthname.Substring(0, 1); if (monthname.Length == 2) { tmpgong[i, 6, 1] = monthname.Substring(1, 1); tmpgong[i, 6, 2] = "月"; } else { tmpgong[i, 6, 1] = "月"; } int firstdaygong = mod.LiuYueGong + (int)mod.TransitTime.NongliMonth % 100 - 1; int xun = (int)mod.TransitTime.NongliDay / 12; int thisday = (i - firstdaygong + 12) % 12 + 1 + xun * 12; if (thisday <= 0) { thisday += 12; } if (thisday > mod.TransitTime.NongliMonthDays) { thisday -= 12; } tmpgong[i, 6, 8] = PublicValue.GetNongliDay(thisday).Substring(0, 1); tmpgong[i, 6, 9] = PublicValue.GetNongliDay(thisday).Substring(1, 1); } #endregion #region 设置中部内容 string red = "#ff2a01"; string blue1 = "#005995"; string green = "#149e11"; string blue2 = "#1a85c2"; for (int i = 0; i < 19; i++) { middle[i] = " "; } middle[0] = "盘类:流限盘 " + PublicValue.GetZiWeiMingJu(mod.MingJu) + " " + PublicValue.GetShuXing(mod.ShuXing) + AppCmn.AppEnum.GetGender(mod.Gender) + " 子年斗君:" + PublicValue.GetDiZhi(mod.ZiDou); middle[1] = "公历:<font color=" + red + ">" + mod.BirthTime.Date.Year.ToString("0000") + "</font>年<font color=" + red + ">" + mod.BirthTime.Date.Month.ToString("00") + "</font>月<font color=" + red + ">" + mod.BirthTime.Date.Day.ToString("00") + "</font>日<font color=" + red + ">" + mod.BirthTime.Date.Hour.ToString("00") + "</font>时" + "生 <font color=" + blue1 + ">命主:" + PublicValue.GetZiWeiStar(mod.MingZhu) + "</font>"; middle[2] = "农历:<font color=" + red + ">" + PublicValue.GetTianGan(mod.BirthTime.NongliTG) + PublicValue.GetDiZhi(mod.BirthTime.NongliDZ) + "</font>年<font color=" + red + ">" + PublicValue.GetNongliMonth(mod.BirthTime.NongliMonth) + "</font>月<font color=" + red + ">" + PublicValue.GetNongliDay(mod.BirthTime.NongliDay) + PublicValue.GetDiZhi(mod.BirthTime.NongliHour) + "</font>时生"; int tmpcol = 4 - PublicValue.GetNongliMonth(mod.BirthTime.NongliMonth).Length; for (int i = 0; i < tmpcol; i++) { middle[2] += " "; } middle[2] += "<font color=" + blue1 + ">身主:" + PublicValue.GetZiWeiStar(mod.ShenZhu) + "</font>"; middle[3] = "推运:<font color=" + red + ">" + mod.TransitTime.Date.Year.ToString("0000") + "</font>年<font color=" + red + ">" + mod.TransitTime.Date.Month.ToString("00") + "</font>月<font color=" + red + ">" + mod.TransitTime.Date.Day.ToString("00") + "</font>日" + " 小限在" + PublicValue.GetDiZhi(mod.XiaoXian) + " "; if (mod.Age.ToString().Length == 1) { middle[3] += " 虚岁:" + mod.Age + " "; } else if (mod.Age.ToString().Length == 2) { middle[3] += " 虚岁:" + mod.Age; } else if (mod.Age.ToString().Length == 3) { middle[3] += " 虚岁:" + mod.Age; } BaZi.BaZiMod m_bazi = new BaZi.BaZiMod(); m_bazi.BirthTime = mod.BirthTime; m_bazi.Gender = mod.Gender; BaZi.BaZiBiz bazibiz = BaZi.BaZiBiz.GetInstance(); bazibiz.TimeToBaZi(ref m_bazi); middle[4] = "流年<font color=" + blue1 + ">" + PublicValue.GetTianGan(mod.TransitTime.NongliTG) + PublicValue.GetDiZhi(mod.TransitTime.NongliDZ) + "</font> 流月<font color=" + blue1 + ">" + PublicValue.GetNongliMonth(mod.TransitTime.NongliMonth) + "月 " + PublicValue.GetTianGan((2 * ((int)mod.TransitTime.NongliTG - 1) + mod.TmpLiuMonth + 1) % 10) + PublicValue.GetDiZhi((mod.TmpLiuMonth + 1) % 12) + "</font>" + " 流日<font color=" + blue1 + ">" + PublicValue.GetNongliDay(mod.TransitTime.NongliDay) + " " + PublicValue.GetTianGan(m_bazi.DayTG) + PublicValue.GetDiZhi(m_bazi.DayDZ) + "</font>"; tmpcol = 3 - PublicValue.GetNongliMonth(mod.TransitTime.NongliMonth).Length; for (int i = 0; i < tmpcol; i++) { middle[4] += " "; } middle[6] = " <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.YearTG) * 100 + m_bazi.YearDZ) + "</font> <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.MonthTG) * 100 + m_bazi.MonthDZ) + "</font> <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.DayTG) * 100 + m_bazi.DayDZ) + "</font> <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.HourTG) * 100 + m_bazi.HourDZ) + "</font> "; middle[7] = " <font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.YearTG, m_bazi.DayTG)).ShiShen) + "</font> <font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.MonthTG, m_bazi.DayTG)).ShiShen) + "</font> <font color=" + blue2 + ">日主</font> <font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.DayTG, m_bazi.DayTG)).ShiShen) + "</font> "; if (mod.Gender == AppCmn.AppEnum.Gender.male) { middle[8] = "乾:"; } else { middle[8] = "坤:"; } middle[8] += "<font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.YearTG) + PublicValue.GetDiZhi(m_bazi.YearDZ) + "</font> <font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.MonthTG) + PublicValue.GetDiZhi(m_bazi.MonthDZ) + "</font> <font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.DayTG) + PublicValue.GetDiZhi(m_bazi.DayDZ) + "</font> <font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.HourTG) + PublicValue.GetDiZhi(m_bazi.HourDZ) + "</font>(<font color=" + red + ">" + PublicValue.GetDiZhi(m_bazi.XunKong0) + PublicValue.GetDiZhi(m_bazi.XunKong1) + "</font>空)"; for (int j = 0; j < 3; j++) { middle[j + 9] = " "; for (int i = 0; i < 4; i++) { if (!(j != 0 && (int)m_bazi.CangGan[i, j] == 0)) middle[j + 9] += PublicValue.GetTianGan(m_bazi.CangGan[i, j]) + "<font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.CangGan[i, j], m_bazi.DayTG)).ShiShen) + "</font> "; else middle[j + 9] += " "; } middle[j + 9] += " "; } middle[13] = " 大运[<font color=" + red + ">" + m_bazi.JiaoYun.Month + "</font>月换运]"; if (m_bazi.JiaoYun.Month < 10) { middle[13] += " "; } middle[13] += " "; middle[14] = " "; middle[15] = " "; middle[16] = " "; for (int i = 0; i < 8; i++) { middle[14] += "<font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.Dayun[i].YearTG) + PublicValue.GetDiZhi(m_bazi.Dayun[i].YearDZ) + "</font> "; middle[15] += "<font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.Dayun[i].YearTG, m_bazi.DayTG)).ShiShen) + "</font> "; middle[16] += m_bazi.Dayun[i].Begin.ToString("0000") + " "; } #endregion sb.Append("┌───────────────────────────────────────────┐").Append("<br />"); sb.Append("│ 上上签神秘学社区紫微斗数在线排盘系统 <a href='" + AppCmn.AppConfig.HomeUrl() + "'>" + AppCmn.AppConfig.HomeUrl() + "</a> │").Append("<br />"); sb.Append("├──────────┬──────────┬──────────┬──────────┤").Append("<br />"); //3,4,5,6宫 for (int i = 0; i < 9; i++) { sb.Append("│"); for (int j = 3; j < 7; j++) { sb.Append(gongstartohtml(tmpgong, j, i)).Append("│"); } sb.Append("<br />"); } sb.Append("├──────────┼──────────┴──────────┼──────────┤").Append("<br />"); //2,7宫 for (int i = 0; i < 9; i++) { sb.Append("│").Append(gongstartohtml(tmpgong, 2, i)).Append("│").Append(middle[i]).Append("│").Append(gongstartohtml(tmpgong, 7, i)).Append("│").Append("<br />"); } sb.Append("├──────────┤").Append(middle[9]).Append("├──────────┤").Append("<br />"); //1,8宫 for (int i = 0; i < 9; i++) { sb.Append("│").Append(gongstartohtml(tmpgong, 1, i)).Append("│").Append(middle[i + 10]).Append("│").Append(gongstartohtml(tmpgong, 8, i)).Append("│").Append("<br />"); } sb.Append("├──────────┼──────────┬──────────┼──────────┤").Append("<br />"); //0,11,10,9宫 for (int i = 0; i < 9; i++) { sb.Append("│"); for (int j = 12; j > 8; j--) { sb.Append(gongstartohtml(tmpgong, j % 12, i)).Append("│"); } sb.Append("<br />"); } sb.Append("└──────────┴──────────┴──────────┴──────────┘"); return sb.ToString(); }
/// <summary> /// 设置旬空 /// </summary> /// <param name="year"></param> /// <param name="mon"></param> /// <param name="day"></param> /// <param name="BaZi"></param> private void XunKongDay(ref BaZiMod bazi) { int temp = 0; temp = (9 - (int)bazi.DayTG + (int)bazi.DayDZ+1) % 12; bazi.XunKong0 = (PublicValue.DiZhi)Enum.Parse(typeof(PublicValue.DiZhi), temp.ToString()); bazi.XunKong1 = (PublicValue.DiZhi)Enum.Parse(typeof(PublicValue.DiZhi), (temp+1).ToString()); }
private void SetQiYun(ref BaZiMod bazi) { DateTime[] jieqi = new DateTime[2]; PublicValue.JieQi[] jieqiname = new PublicValue.JieQi[2]; if (bazi.BirthTime.Date < bazi.BirthTime.BeginMonth[0]) { DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(-3)); jieqi[0] = tmpdate.BeginMonth[11]; jieqi[1] = bazi.BirthTime.BeginMonth[0]; jieqiname[0] = (PublicValue.JieQi)(11); jieqiname[1] = (PublicValue.JieQi)(0); } else if (bazi.BirthTime.Date > bazi.BirthTime.BeginMonth[11]) { DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(+3)); jieqi[1] = tmpdate.BeginMonth[0]; jieqi[0] = bazi.BirthTime.BeginMonth[11]; jieqiname[0] = (PublicValue.JieQi)(11); jieqiname[1] = (PublicValue.JieQi)(0); } else { for (int i = 0; i <= 10; i++) { if (bazi.BirthTime.Date >= bazi.BirthTime.BeginMonth[i] && bazi.BirthTime.Date <= bazi.BirthTime.BeginMonth[i + 1]) { jieqi[0] = bazi.BirthTime.BeginMonth[i]; jieqi[1] = bazi.BirthTime.BeginMonth[i + 1]; jieqiname[0] = (PublicValue.JieQi)(i); jieqiname[1] = (PublicValue.JieQi)(i + 1); break; } } } //DateTime[] zhongqi = new DateTime[2]; //PublicValue.ZhongQi[] zhongqiname = new PublicValue.ZhongQi[2]; //if (bazi.BirthTime.Date < bazi.BirthTime.BeginZodiac[0]) //{ // DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(-3)); // zhongqi[0] = tmpdate.BeginZodiac[11]; // zhongqi[1] = bazi.BirthTime.BeginZodiac[0]; // zhongqiname[0] = (PublicValue.ZhongQi)(11); // zhongqiname[1] = (PublicValue.ZhongQi)(0); //} //else if (bazi.BirthTime.Date > bazi.BirthTime.BeginZodiac[11]) //{ // DateEntity tmpdate = new DateEntity(bazi.BirthTime.Date.AddMonths(+3)); // zhongqi[1] = tmpdate.BeginZodiac[0]; // zhongqi[0] = bazi.BirthTime.BeginZodiac[11]; // zhongqiname[0] = (PublicValue.ZhongQi)(11); // zhongqiname[1] = (PublicValue.ZhongQi)(0); //} //else //{ // for (int i = 0; i < 10; i++) // { // if (bazi.BirthTime.Date >= bazi.BirthTime.BeginZodiac[i] && bazi.BirthTime.Date <= bazi.BirthTime.BeginZodiac[i + 1]) // { // zhongqi[0] = bazi.BirthTime.BeginZodiac[i]; // zhongqi[1] = bazi.BirthTime.BeginZodiac[i + 1]; // zhongqiname[0] = (PublicValue.ZhongQi)(i); // zhongqiname[1] = (PublicValue.ZhongQi)(i + 1); // break; // } // } //} bazi.JieQi[0] = jieqi[0]; bazi.JieQiName[0] = (PublicValue.AllJieQi)((int)jieqiname[0] * 2); bazi.JieQi[1] = jieqi[1]; bazi.JieQiName[1] = (PublicValue.AllJieQi)((int)jieqiname[1] * 2); //if (jieqi[0] > zhongqi[0]) //{ // bazi.JieQi[0] = jieqi[0]; // bazi.JieQiName[0] = (PublicValue.AllJieQi)((int)jieqiname[0] * 2); //} //else //{ // bazi.JieQi[0] = zhongqi[0]; // bazi.JieQiName[0] = (PublicValue.AllJieQi)((int)zhongqiname[0] * 2+1); //} //if (jieqi[1] < zhongqi[1]) //{ // bazi.JieQi[1] = jieqi[1]; // bazi.JieQiName[1] = (PublicValue.AllJieQi)((int)jieqiname[1] * 2); //} //else //{ // bazi.JieQi[1] = zhongqi[1]; // bazi.JieQiName[1] = (PublicValue.AllJieQi)((int)zhongqiname[1] * 2 + 1); //} //TimeSpan tmp = bazi.JieQi[1] - bazi.JieQi[0];//两节气差 if ((bazi.YinYang == PublicValue.ShuXing.yang && bazi.Gender == AppCmn.AppEnum.Gender.male) || (bazi.YinYang == PublicValue.ShuXing.yin && bazi.Gender == AppCmn.AppEnum.Gender.female)) { TimeSpan tmp1 = new TimeSpan(); tmp1 = bazi.JieQi[1] - bazi.BirthTime.Date; bazi.QiYun = new TimeSpan(Convert.ToInt64(tmp1.Ticks / 3 * 365.25636)); } else { TimeSpan tmp1 = new TimeSpan(); tmp1 = bazi.BirthTime.Date - bazi.JieQi[0]; bazi.QiYun = new TimeSpan(Convert.ToInt64(tmp1.Ticks / 3 * 365.25636)); } bazi.JiaoYun = bazi.BirthTime.Date.Add(bazi.QiYun); }
private void SetNaYin(ref BaZiMod bazi) { bazi.NaYin[0] = (PublicValue.Nayin)(10000+(int)bazi.YearTG*100+(int)bazi.YearDZ); bazi.NaYin[1] = (PublicValue.Nayin)(10000 + (int)bazi.MonthTG * 100 + (int)bazi.MonthDZ); bazi.NaYin[2] = (PublicValue.Nayin)(10000 + (int)bazi.DayTG * 100 + (int)bazi.DayDZ); bazi.NaYin[3] = (PublicValue.Nayin)(10000 + (int)bazi.HourTG * 100 + (int)bazi.HourDZ); }
protected void Unnamed1_Click(object sender, EventArgs e) { ltrResult.Text = ""; if (txtDate.Text == "" || txtDate1.Text == "") { ltrNotice.Text = "请选择日期"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true); this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true); return; } DateEntity m_date = new DateEntity(new DateTime(int.Parse(txtDate.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate.Text.Split(new char[] { '-' })[2]), 0, 0, 0)); DateEntity m_date1 = new DateEntity(new DateTime(int.Parse(txtDate1.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate1.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate1.Text.Split(new char[] { '-' })[2]), 0, 0, 0)); if (m_date.Date >= m_date1.Date) { ltrNotice.Text = "开始日期必须在结束日期前"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true); this.ClientScript.RegisterStartupScript(this.GetType(), "", "plus(1);", true); return; } while (m_date.Date < m_date1.Date) { BaZiMod male_bazi = new BaZiMod(); male_bazi.BirthTime = m_date; male_bazi.Gender = AppEnum.Gender.male; BaZiBiz.GetInstance().TimeToBaZi(ref male_bazi); if ((((int)male_bazi.YearTG) * 100 + male_bazi.YearDZ).ToString() == drpYear.SelectedValue) { if ((((int)male_bazi.MonthTG) * 100 + male_bazi.MonthDZ).ToString() == drpMonth.SelectedValue) { if ((((int)male_bazi.DayTG) * 100 + male_bazi.DayDZ).ToString() == drpDay.SelectedValue) { if ((((int)male_bazi.HourTG) * 100 + male_bazi.HourDZ).ToString() == drpHour.SelectedValue) { ltrResult.Text += m_date.Date.ToString("yyyy年MM月dd日HH时") + "<br />"; m_date = new DateEntity(m_date.Date.AddHours(2)); continue; } else { m_date = new DateEntity(new DateTime(m_date.Date.AddHours(2).Year, m_date.Date.AddHours(2).Month, m_date.Date.AddHours(2).Day, m_date.Date.AddHours(2).Hour,0,0)); continue; } } else { m_date = new DateEntity(new DateTime(m_date.Date.AddDays(1).Year,m_date.Date.AddDays(1).Month,m_date.Date.AddDays(1).Day)); continue; } } else { m_date = new DateEntity(male_bazi.JieQi[1].AddSeconds(1)); continue; } } else { if (m_date.Date >= m_date.BeginMonth[1]) { m_date = new DateEntity(new DateEntity(m_date.Date.AddYears(1)).BeginMonth[1]); } else { m_date = new DateEntity(m_date.BeginMonth[1]); } continue; } } }
public string BaziToHTML(BaZiMod bazi, bool all) { string ret = ""; int dayun = 8; ret += b("姓名:") + bazi.Name + " " + b("排盘类型:"); if (bazi.RealTime) { ret += "真太阳时"; } else { ret += "普通排盘"; } ret += "<br />"; if (bazi.RealTime) { ret += b("出生地:") + bazi.AreaName + " " + b("经度:") + bazi.Longitude + "<br />"; } ret += "上上签神秘学社区四柱八字排盘系统 <a href='" + AppCmn.AppConfig.HomeUrl() + "'>" + AppCmn.AppConfig.HomeUrl() + "</a><br /><br />"; ret += b("公历:") + fa(bazi.BirthTime.Date.Year.ToString("0000")) + "年" + fa(bazi.BirthTime.Date.Month.ToString("00")) + "月" + fa(bazi.BirthTime.Date.Day.ToString("00")) + "日" + fa(bazi.BirthTime.Date.Hour.ToString("00")) + "时" + fa(bazi.BirthTime.Date.Minute.ToString("00")) + "分" + "<br />"; ret += b("阴历:") + PublicValue.GetTianGan(bazi.BirthTime.NongliTG) + PublicValue.GetDiZhi(bazi.BirthTime.NongliDZ) + "年[" + PublicValue.GetNayin(10000 + (int)bazi.BirthTime.NongliTG * 100 + (int)bazi.BirthTime.NongliDZ) + "]" + PublicValue.GetNongliMonth(bazi.BirthTime.NongliMonth) + "月" + PublicValue.GetNongliDay(bazi.BirthTime.NongliDay) + PublicValue.GetDiZhi(bazi.BirthTime.NongliHour) + "时<br /><br />"; ret += PublicValue.GetAllJieQi(bazi.JieQiName[0]) + ":" + fa(bazi.JieQi[0].Year.ToString("0000")) + "年" + fa(bazi.JieQi[0].Month.ToString("00")) + "月" + fa(bazi.JieQi[0].Day.ToString("00")) + "日" + fa(bazi.JieQi[0].Hour.ToString("00")) + "时" + fa(bazi.JieQi[0].Minute.ToString("00")) + "分" + fa(bazi.JieQi[0].Second.ToString("00")) + "秒" + " (高精度天文算法)<br />"; ret += PublicValue.GetAllJieQi(bazi.JieQiName[1]) + ":" + fa(bazi.JieQi[1].Year.ToString("0000")) + "年" + fa(bazi.JieQi[1].Month.ToString("00")) + "月" + fa(bazi.JieQi[1].Day.ToString("00")) + "日" + fa(bazi.JieQi[1].Hour.ToString("00")) + "时" + fa(bazi.JieQi[1].Minute.ToString("00")) + "分" + fa(bazi.JieQi[1].Second.ToString("00")) + "秒" + "<br /><br />"; ret += b("起运:") + "于出生后" + fa(bazi.QiYun.Days.ToString()) + "天" + fa(bazi.QiYun.Hours.ToString()) + "小时" + fa(bazi.QiYun.Minutes.ToString()) + "分钟起运<br />"; ret += b("交运:") + "于公历" + fa(bazi.JiaoYun.Year.ToString()) + "年" + fa(bazi.JiaoYun.Month.ToString()) + "月" + fa(bazi.JiaoYun.Day.ToString()) + "日" + fa(bazi.JiaoYun.Hour.ToString()) + "时" + fa(bazi.JiaoYun.Hour.ToString()) + "分交运<br /><br />"; ret += " " + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.YearTG, bazi.DayTG)).ShiShen)) + " " + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.MonthTG, bazi.DayTG)).ShiShen)) + " " + fc("日主") + " " + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.HourTG, bazi.DayTG)).ShiShen)) + "<br />"; if (bazi.Gender == AppCmn.AppEnum.Gender.male) { ret += b("乾造:") + " "; } else { ret += b("坤造:") + " "; } ret += fa(PublicValue.GetTianGan(bazi.YearTG)) + " " + fa(PublicValue.GetTianGan(bazi.MonthTG)) + " " + fa(PublicValue.GetTianGan(bazi.DayTG)) + " " + fa(PublicValue.GetTianGan(bazi.HourTG)) + " (" + fd(PublicValue.GetDiZhi(bazi.XunKong0)) + fd(PublicValue.GetDiZhi(bazi.XunKong1)) + "空)<br />"; ret += b(" ") + " " + fa(PublicValue.GetDiZhi(bazi.YearDZ)) + " " + fa(PublicValue.GetDiZhi(bazi.MonthDZ)) + " " + fa(PublicValue.GetDiZhi(bazi.DayDZ)) + " " + fa(PublicValue.GetDiZhi(bazi.HourDZ)) + "<br /><br />"; for (int j = 0; j < 3; j++) { ret += b(" ") + " "; for (int i = 0; i < 4; i++) { if (!(j != 0 && (int)bazi.CangGan[i, j] == 0)) { ret += PublicValue.GetTianGan(bazi.CangGan[i, j]) + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.CangGan[i, j], bazi.DayTG)).ShiShen)) + " "; } } ret += "<br />"; } ret += b("旺衰:") + " "; for (int i = 0; i < 4; i++) { ret += PublicValue.GetZiWeiChangSheng(bazi.WangShuai[i]).Replace(" ", ""); for (int j = 0; j < 4 - PublicValue.GetZiWeiChangSheng(bazi.WangShuai[i]).Replace(" ", "").Length; j++) { ret += " "; } } ret += "<br />"; ret += b("纳音:") + " "; for (int i = 0; i < 4; i++) { ret += fb(PublicValue.GetNayin(bazi.NaYin[i])) + " "; } ret += "<br /><br />"; //大运 ret += b("纳音:"); for (int i = 0; i < dayun; i++) { ret += fb(PublicValue.GetNayin(bazi.Dayun[i].NaYin)) + " "; } ret += "<br />"; ret += b("旺衰:"); for (int i = 0; i < dayun; i++) { ret += PublicValue.GetZiWeiChangSheng(bazi.Dayun[i].WangShuai).Replace(" ", ""); for (int j = 0; j < 4 - PublicValue.GetZiWeiChangSheng(bazi.Dayun[i].WangShuai).Replace(" ", "").Length; j++) { ret += " "; } } ret += "<br />"; ret += b("十神:"); for (int i = 0; i < dayun; i++) { ret += fc(PublicValue.GetShiShen(bazi.Dayun[i].ShiShen)) + " "; } ret += "<br />"; ret += b("大运:"); for (int i = 0; i < dayun; i++) { ret += fa(PublicValue.GetTianGan(bazi.Dayun[i].YearTG) + PublicValue.GetDiZhi(bazi.Dayun[i].YearDZ)) + " "; } ret += "<br />"; ret += b(" "); for (int i = 0; i < dayun; i++) { ret += bazi.Dayun[i].Begin - bazi.BirthTime.Date.Year + "岁 "; } ret += "<br />"; //流年 if (all) { ret += b("始于:"); for (int i = 0; i < dayun; i++) { ret += fc(bazi.Dayun[i].Begin.ToString("")) + " "; } ret += "<br />"; ret += b("流年:"); for (int i = 0; i < 10; i++) { if (i != 0) { ret += b(" "); } for (int j = 0; j < dayun; j++) { ret += PublicValue.GetTianGan(BaZiBiz.GetInstance().YearTG(bazi.Dayun[j].Begin + i)) + PublicValue.GetDiZhi(BaZiBiz.GetInstance().YearDZ(bazi.Dayun[j].Begin + i)).Replace(PublicValue.GetDiZhi(bazi.XunKong0), fd(PublicValue.GetDiZhi(bazi.XunKong0))).Replace(PublicValue.GetDiZhi(bazi.XunKong1), fd(PublicValue.GetDiZhi(bazi.XunKong1))) + " "; } ret += "<br />"; } ret += b("止于:"); for (int i = 0; i < dayun; i++) { ret += fc(bazi.Dayun[i].End.ToString()) + " "; } ret += "<br />"; } return(ret); }
public string BaziToHTML(BaZiMod bazi,bool all) { string ret = ""; int dayun = 8; ret += b("姓名:") + bazi.Name + " "+b("排盘类型:"); if (bazi.RealTime) { ret += "真太阳时"; } else { ret += "普通排盘"; } ret += "<br />"; if (bazi.RealTime) { ret += b("出生地:") + bazi.AreaName + " " + b("经度:")+bazi.Longitude+"<br />"; } ret += "上上签神秘学社区四柱八字排盘系统 <a href='" + AppCmn.AppConfig.HomeUrl() + "'>" + AppCmn.AppConfig.HomeUrl() + "</a><br /><br />"; ret += b("公历:") + fa(bazi.BirthTime.Date.Year.ToString("0000")) + "年" + fa(bazi.BirthTime.Date.Month.ToString("00")) + "月" + fa(bazi.BirthTime.Date.Day.ToString("00")) + "日" + fa(bazi.BirthTime.Date.Hour.ToString("00")) + "时" + fa(bazi.BirthTime.Date.Minute.ToString("00")) + "分" + "<br />"; ret += b("阴历:") + PublicValue.GetTianGan(bazi.BirthTime.NongliTG) + PublicValue.GetDiZhi(bazi.BirthTime.NongliDZ) + "年[" + PublicValue.GetNayin(10000+(int)bazi.BirthTime.NongliTG * 100 + (int)bazi.BirthTime.NongliDZ) + "]" + PublicValue.GetNongliMonth(bazi.BirthTime.NongliMonth) +"月"+ PublicValue.GetNongliDay(bazi.BirthTime.NongliDay) + PublicValue.GetDiZhi(bazi.BirthTime.NongliHour) + "时<br /><br />"; ret += PublicValue.GetAllJieQi(bazi.JieQiName[0]) + ":" +fa(bazi.JieQi[0].Year.ToString("0000")) + "年" + fa(bazi.JieQi[0].Month.ToString("00")) + "月" +fa(bazi.JieQi[0].Day.ToString("00")) + "日" + fa(bazi.JieQi[0].Hour.ToString("00")) + "时" + fa(bazi.JieQi[0].Minute.ToString("00")) + "分" + fa(bazi.JieQi[0].Second.ToString("00")) + "秒" + " (高精度天文算法)<br />"; ret += PublicValue.GetAllJieQi(bazi.JieQiName[1]) + ":" + fa(bazi.JieQi[1].Year.ToString("0000")) + "年" + fa(bazi.JieQi[1].Month.ToString("00")) + "月" + fa(bazi.JieQi[1].Day.ToString("00")) + "日" + fa(bazi.JieQi[1].Hour.ToString("00")) + "时" + fa(bazi.JieQi[1].Minute.ToString("00")) + "分" + fa(bazi.JieQi[1].Second.ToString("00")) + "秒" + "<br /><br />"; ret += b("起运:") + "于出生后" + fa(bazi.QiYun.Days.ToString()) + "天" + fa(bazi.QiYun.Hours.ToString()) + "小时" + fa(bazi.QiYun.Minutes.ToString()) + "分钟起运<br />"; ret += b("交运:") + "于公历" + fa(bazi.JiaoYun.Year.ToString()) + "年" + fa(bazi.JiaoYun.Month.ToString()) + "月" + fa(bazi.JiaoYun.Day.ToString()) + "日" + fa(bazi.JiaoYun.Hour.ToString()) + "时" + fa(bazi.JiaoYun.Hour.ToString()) + "分交运<br /><br />"; ret += " " + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.YearTG, bazi.DayTG)).ShiShen)) + " " + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.MonthTG, bazi.DayTG)).ShiShen)) + " "+fc("日主")+" " + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.HourTG, bazi.DayTG)).ShiShen)) +"<br />"; if(bazi.Gender == AppCmn.AppEnum.Gender.male) { ret += b("乾造:")+" "; } else { ret += b("坤造:")+" "; } ret += fa(PublicValue.GetTianGan(bazi.YearTG)) + " " + fa(PublicValue.GetTianGan(bazi.MonthTG)) + " " + fa(PublicValue.GetTianGan(bazi.DayTG)) + " " + fa(PublicValue.GetTianGan(bazi.HourTG)) + " (" + fd(PublicValue.GetDiZhi(bazi.XunKong0)) + fd(PublicValue.GetDiZhi(bazi.XunKong1)) + "空)<br />"; ret += b(" ")+" " + fa(PublicValue.GetDiZhi(bazi.YearDZ)) + " " + fa(PublicValue.GetDiZhi(bazi.MonthDZ)) + " " + fa(PublicValue.GetDiZhi(bazi.DayDZ)) + " " + fa(PublicValue.GetDiZhi(bazi.HourDZ)) + "<br /><br />"; for (int j = 0; j < 3; j++) { ret += b(" ")+" "; for (int i = 0; i < 4; i++) { if (!(j != 0 && (int)bazi.CangGan[i, j] == 0)) ret += PublicValue.GetTianGan(bazi.CangGan[i, j]) + fc(PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(bazi.CangGan[i, j], bazi.DayTG)).ShiShen)) + " "; } ret += "<br />"; } ret += b("旺衰:")+" "; for (int i = 0; i < 4; i++) { ret += PublicValue.GetZiWeiChangSheng(bazi.WangShuai[i]).Replace(" ", ""); for (int j = 0; j < 4 - PublicValue.GetZiWeiChangSheng(bazi.WangShuai[i]).Replace(" ", "").Length; j++) { ret += " "; } } ret += "<br />"; ret += b("纳音:")+" "; for (int i = 0; i < 4; i++) { ret += fb(PublicValue.GetNayin(bazi.NaYin[i])) + " "; } ret += "<br /><br />"; //大运 ret += b("纳音:"); for (int i = 0; i < dayun; i++) { ret += fb(PublicValue.GetNayin(bazi.Dayun[i].NaYin)) + " "; } ret += "<br />"; ret += b("旺衰:"); for (int i = 0; i < dayun; i++) { ret += PublicValue.GetZiWeiChangSheng(bazi.Dayun[i].WangShuai).Replace(" ", ""); for (int j = 0; j < 4 - PublicValue.GetZiWeiChangSheng(bazi.Dayun[i].WangShuai).Replace(" ", "").Length; j++) { ret += " "; } } ret += "<br />"; ret += b("十神:"); for (int i = 0; i < dayun; i++) { ret += fc(PublicValue.GetShiShen(bazi.Dayun[i].ShiShen)) + " "; } ret += "<br />"; ret += b("大运:"); for (int i = 0; i < dayun; i++) { ret += fa(PublicValue.GetTianGan(bazi.Dayun[i].YearTG) +PublicValue.GetDiZhi(bazi.Dayun[i].YearDZ))+ " "; } ret += "<br />"; ret += b(" "); for (int i = 0; i < dayun; i++) { ret += bazi.Dayun[i].Begin-bazi.BirthTime.Date.Year + "岁 "; } ret += "<br />"; //流年 if (all) { ret += b("始于:"); for (int i = 0; i < dayun; i++) { ret += fc(bazi.Dayun[i].Begin.ToString("")) + " "; } ret += "<br />"; ret += b("流年:"); for (int i = 0; i < 10; i++) { if (i != 0) { ret += b(" "); } for (int j = 0; j < dayun; j++) { ret += PublicValue.GetTianGan(BaZiBiz.GetInstance().YearTG(bazi.Dayun[j].Begin + i)) + PublicValue.GetDiZhi(BaZiBiz.GetInstance().YearDZ(bazi.Dayun[j].Begin + i)).Replace(PublicValue.GetDiZhi(bazi.XunKong0), fd(PublicValue.GetDiZhi(bazi.XunKong0))).Replace(PublicValue.GetDiZhi(bazi.XunKong1), fd(PublicValue.GetDiZhi(bazi.XunKong1))) + " "; } ret += "<br />"; } ret += b("止于:"); for (int i = 0; i < dayun; i++) { ret += fc(bazi.Dayun[i].End.ToString()) + " "; } ret += "<br />"; } return ret; }
public string ZiWeiToHTML(ZiWeiMod mod) { StringBuilder sb = new StringBuilder(); string[,,] tmpgong = new string[12,7,10];//12宫,每宫7行,每行10个字 string[] middle = new string[15]; bool starflag = false; string tmphtmla = ""; string tmphtmlb = "</font>"; #region 星体与庙旺四化 for (int i = 0; i < mod.Xing.Length; i++) { if (i == 58 || i == 59 || i == 62 || i == 63 || i == 66 || i == 64 || i == 67) { continue; } if (i <= 13) { tmphtmla = "<font color=#ff2a01>";//主星颜色 } else if (i <= 21) { tmphtmla = "<font color=#fe30d9>";//辅星颜色 } else if(i<=27) { tmphtmla = "<font color=#6f25e6>";//凶星颜色 } else { tmphtmla = "<font color=#cb8430>";//小星颜色 } starflag = false; //每个宫内打印10列 for (int j = 9; j >=0; j--) { if (tmpgong[mod.Xing[i].Gong, 0, j] == null || tmpgong[mod.Xing[i].Gong, 0, j] == "") { tmpgong[mod.Xing[i].Gong, 0, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(0, 1) + tmphtmlb; tmpgong[mod.Xing[i].Gong, 1, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(1, 1) + tmphtmlb; if ((int)mod.Xing[i].Wang != 0) { tmpgong[mod.Xing[i].Gong, 2, j] = PublicValue.GetZiWeiMiaowang(mod.Xing[i].Wang); } if ((int)mod.Xing[i].Hua != 0) { tmpgong[mod.Xing[i].Gong, 3, j] = "<font color=#EEEEEE><span style='background-color: #ff2a01'>" + PublicValue.GetZiWeiSihua(mod.Xing[i].Hua) + "</span></font>"; } starflag = true; break; } } if (starflag) { continue; } for (int j = 0; j <=4; j++) { if (tmpgong[mod.Xing[i].Gong, 2, j] == null || tmpgong[mod.Xing[i].Gong, 2, j] == "") { tmpgong[mod.Xing[i].Gong, 2, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(0, 1) + tmphtmlb; tmpgong[mod.Xing[i].Gong, 3, j] = tmphtmla + PublicValue.GetZiWeiStar(mod.Xing[i].StarName).Substring(1, 1) + tmphtmlb; starflag = true; break; } } } #endregion #region 十二神与宫名 for (int i = 0; i < 12; i++) { string boshicolor = "#005995"; string taisuicolor = "#018e98"; string jiangqiancolor = "#1a85c2"; string changshengcolor = "#149e11"; tmpgong[i, 5, 0] = "<font color=" + boshicolor + ">" + PublicValue.GetZiWeiBoShi(mod.Gong[i].BoShi).Substring(0, 1) + "</font>"; tmpgong[i, 6, 0] = "<font color=" + boshicolor + ">" + PublicValue.GetZiWeiBoShi(mod.Gong[i].BoShi).Substring(1, 1) + "</font>"; tmpgong[i, 5, 1] = "<font color=" + taisuicolor + ">" + PublicValue.GetZiWeiTaiSui(mod.Gong[i].TaiSui).Substring(0, 1) + "</font>"; tmpgong[i, 6, 1] = "<font color=" + taisuicolor + ">" + PublicValue.GetZiWeiTaiSui(mod.Gong[i].TaiSui).Substring(1, 1) + "</font>"; tmpgong[i, 5, 2] = "<font color=" + jiangqiancolor + ">" + PublicValue.GetZiWeiJiangQian(mod.Gong[i].JiangQian).Substring(0, 1) + "</font>"; tmpgong[i, 6, 2] = "<font color=" + jiangqiancolor + ">" + PublicValue.GetZiWeiJiangQian(mod.Gong[i].JiangQian).Substring(1, 1) + "</font>"; //tmpgong[i, 5, 3] = " "; //tmpgong[i, 6, 3] = " "; if (transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB) != " ") { if (mod.DaYunGong == i) { tmpgong[i, 5, 4] = "<u>"; tmpgong[i, 5, 6] = "</u>"; tmpgong[i, 5, 7] = " "; } else { tmpgong[i, 5, 4] = ""; tmpgong[i, 5, 6] = ""; } tmpgong[i, 5, 4] += transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB).Substring(0, 2); tmpgong[i, 5, 5] = transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB).Substring(2, 1); tmpgong[i, 5, 6] = transittohtml(mod.Gong[i].TransitA, mod.Gong[i].TransitB).Substring(3, 2) + tmpgong[i, 5, 6]; } tmpgong[i, 6, 4] = "<font id='gong" + i + "' onMouseOver='sansi(this);' color=#ff2a01>" + PublicValue.GetZiWeiGong(mod.Gong[i].GongName).Substring(0, 1); if (mod.Shen == i) { tmpgong[i, 6, 5] = "★"; tmpgong[i, 6, 6] = "身" + "</font>"; if (mod.Ming == i) { tmpgong[i, 6, 4] = "<font id='gong" + i + "' onMouseOver='sansi(this);' color=#ff2a01>命"; } } else { tmpgong[i, 6, 5] = PublicValue.GetZiWeiGong(mod.Gong[i].GongName).Substring(1, 1); tmpgong[i, 6, 6] = PublicValue.GetZiWeiGong(mod.Gong[i].GongName).Substring(2, 1) + "</font>"; } tmpgong[i, 5, 8] = "<font color=" + changshengcolor + ">" + PublicValue.GetZiWeiChangSheng(mod.Gong[i].ChangSheng).Substring(0, 1) + "</font>"; tmpgong[i, 6, 8] = "<font color=" + changshengcolor + ">" + PublicValue.GetZiWeiChangSheng(mod.Gong[i].ChangSheng).Substring(1, 1) + "</font>"; tmpgong[i, 5, 9] = PublicValue.GetTianGan(mod.Gong[i].TG); tmpgong[i, 6, 9] = PublicValue.GetDiZhi(mod.Gong[i].DZ); } #endregion #region 设置中部内容 string red = "#ff2a01"; string blue1 = "#005995"; string green = "#149e11"; string blue2 = "#1a85c2"; for (int i = 0; i < 15; i++) { middle[i] = " "; } middle[0] = "盘类:天盘 " + PublicValue.GetZiWeiMingJu(mod.MingJu) + " " + PublicValue.GetShuXing(mod.ShuXing) + AppCmn.AppEnum.GetGender(mod.Gender) + " 子年斗君:" + PublicValue.GetDiZhi(mod.ZiDou); middle[1] = "公历:<font color=" + red + ">"+mod.BirthTime.Date.Year.ToString("0000")+ "</font>年<font color=" + red + ">"+ mod.BirthTime.Date.Month.ToString("00")+ "</font>月<font color=" + red + ">"+mod.BirthTime.Date.Day.ToString("00")+ "</font>日<font color=" + red + ">"+ mod.BirthTime.Date.Hour.ToString("00")+"</font>时" + "生 <font color=" + blue1 + ">命主:" + PublicValue.GetZiWeiStar(mod.MingZhu) + "</font>"; middle[2] = "农历:<font color=" + red + ">" + PublicValue.GetTianGan(mod.BirthTime.NongliTG) + PublicValue.GetDiZhi(mod.BirthTime.NongliDZ) + "</font>年<font color=" + red + ">" + PublicValue.GetNongliMonth(mod.BirthTime.NongliMonth) + "</font>月<font color=" + red + ">" + PublicValue.GetNongliDay(mod.BirthTime.NongliDay) + PublicValue.GetDiZhi(mod.BirthTime.NongliHour) + "</font>时生"; int tmpcol = 4 - PublicValue.GetNongliMonth(mod.BirthTime.NongliMonth).Length; for (int i = 0; i <tmpcol ; i++) { middle[2] += " "; } middle[2] += "<font color=" + blue1 + ">身主:" + PublicValue.GetZiWeiStar(mod.ShenZhu) + "</font>"; BaZi.BaZiMod m_bazi = new BaZi.BaZiMod(); m_bazi.BirthTime = mod.BirthTime; m_bazi.Gender = mod.Gender; BaZi.BaZiBiz bazibiz = BaZi.BaZiBiz.GetInstance(); bazibiz.TimeToBaZi(ref m_bazi); middle[4] = " <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.YearTG) * 100 + m_bazi.YearDZ) + "</font> <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.MonthTG) * 100 + m_bazi.MonthDZ) + "</font> <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.DayTG) * 100 + m_bazi.DayDZ) + "</font> <font color=" + green + ">" + PublicValue.GetNayin(10000 + ((int)m_bazi.HourTG) * 100 + m_bazi.HourDZ) + "</font> "; middle[5] = " <font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.YearTG, m_bazi.DayTG)).ShiShen) + "</font> <font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.MonthTG, m_bazi.DayTG)).ShiShen) + "</font> <font color=" + blue2 + ">日主</font> <font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.DayTG, m_bazi.DayTG)).ShiShen) + "</font> "; if (mod.Gender == AppCmn.AppEnum.Gender.male) { middle[6] = "乾:"; } else { middle[6] = "坤:"; } middle[6] += "<font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.YearTG) + PublicValue.GetDiZhi(m_bazi.YearDZ) + "</font> <font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.MonthTG) + PublicValue.GetDiZhi(m_bazi.MonthDZ) + "</font> <font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.DayTG) + PublicValue.GetDiZhi(m_bazi.DayDZ) + "</font> <font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.HourTG) + PublicValue.GetDiZhi(m_bazi.HourDZ) + "</font>(<font color=" + red + ">" + PublicValue.GetDiZhi(m_bazi.XunKong0) + PublicValue.GetDiZhi(m_bazi.XunKong1) + "</font>空)"; for (int j = 0; j < 3; j++) { middle[j + 7] = " "; for (int i = 0; i < 4; i++) { if (!(j != 0 && (int)m_bazi.CangGan[i, j] == 0)) middle[j + 7] += PublicValue.GetTianGan(m_bazi.CangGan[i, j]) + "<font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.CangGan[i, j], m_bazi.DayTG)).ShiShen) + "</font> "; else middle[j + 7] += " "; } middle[j + 7] += " "; } middle[11] = " 大运[<font color=" + red + ">" + m_bazi.JiaoYun.Month + "</font>月换运]"; if (m_bazi.JiaoYun.Month < 10) { middle[11] += " "; } middle[11] += " "; middle[12] = " "; middle[13] = " "; middle[14] = " "; for (int i = 0; i < 8; i++) { middle[12] += "<font color=" + red + ">" + PublicValue.GetTianGan(m_bazi.Dayun[i].YearTG) + PublicValue.GetDiZhi(m_bazi.Dayun[i].YearDZ) + "</font> "; middle[13] += "<font color=" + blue2 + ">" + PublicValue.GetShiShen(PublicDeal.GetInstance().GZWuXing(new WuXingRelation(m_bazi.Dayun[i].YearTG, m_bazi.DayTG)).ShiShen) + "</font> "; middle[14] += m_bazi.Dayun[i].Begin.ToString("0000") + " "; } #endregion sb.Append("┌───────────────────────────────────────────┐").Append("<br />"); sb.Append("│ 上上签神秘学社区紫微斗数在线排盘系统 <a href='" + AppCmn.AppConfig.HomeUrl() + "'>" + AppCmn.AppConfig.HomeUrl() + "</a> │").Append("<br />"); sb.Append("├──────────┬──────────┬──────────┬──────────┤").Append("<br />"); //3,4,5,6宫 for (int i = 0; i < 7; i++) { sb.Append("│"); for (int j = 3; j < 7; j++) { sb.Append(gongstartohtml(tmpgong, j, i)).Append("│"); } sb.Append("<br />"); } sb.Append("├──────────┼──────────┴──────────┼──────────┤").Append("<br />"); //2,7宫 for (int i = 0; i < 7; i++) { sb.Append("│").Append(gongstartohtml(tmpgong, 2, i)).Append("│").Append(middle[i]).Append("│").Append(gongstartohtml(tmpgong, 7, i)).Append("│").Append("<br />"); } sb.Append("├──────────┤").Append(middle[7]).Append("├──────────┤").Append("<br />"); //1,8宫 for (int i = 0; i < 7; i++) { sb.Append("│").Append(gongstartohtml(tmpgong, 1, i)).Append("│").Append(middle[i+8]).Append("│").Append(gongstartohtml(tmpgong, 8, i)).Append("│").Append("<br />"); } sb.Append("├──────────┼──────────┬──────────┼──────────┤").Append("<br />"); //0,11,10,9宫 for (int i = 0; i < 7; i++) { sb.Append("│"); for (int j = 12; j >8; j--) { sb.Append(gongstartohtml(tmpgong, j%12, i)).Append("│"); } sb.Append("<br />"); } sb.Append("└──────────┴──────────┴──────────┴──────────┘"); return sb.ToString(); }
public QA_QuestionShowMini<BaZiMod> MapQA_QuestionShowMiniForBaZi(DataRow input) { QA_QuestionShowMini<BaZiMod> ret = new QA_QuestionShowMini<BaZiMod>(); if (input["Award"].ToString() != "") { ret.Award = int.Parse(input["Award"].ToString()); } if (input["CateSysNo"].ToString() != "") { ret.CateSysNo = int.Parse(input["CateSysNo"].ToString()); } #region 设置命盘 FATE_ChartMod m_chart = QA_QuestionBll.GetInstance().GetChartByQuest(int.Parse(input["SysNo"].ToString())); if (m_chart != null) { BaZiMod m_bazi = new BaZiMod(); string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); m_bazi.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.FirstBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName))); m_bazi.AreaName = m_chart.FirstPoiName.ToString(); m_bazi.Longitude = tmplatlng[0]; m_bazi.Gender = (AppEnum.Gender)m_chart.FirstGender; BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi); ret.Chart.Add(m_bazi); if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { BaZiMod m_bazi1 = new BaZiMod(); tmplatlng = m_chart.SecondPoi.ToString().Split(new char[] { '|' }); m_bazi1.BirthTime = new DateEntity(PublicDeal.GetInstance().RealTime(DateTime.Parse(m_chart.SecondBirth.ToString()), new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName))); m_bazi1.AreaName = m_chart.SecondPoiName.ToString(); m_bazi1.Longitude = tmplatlng[0]; m_bazi1.Gender = (AppEnum.Gender)m_chart.SecondGender; BaZiBiz.GetInstance().TimeToBaZi(ref m_bazi1); ret.Chart.Add(m_bazi1); } } #endregion ret.Context = input["Context"].ToString(); if (input["NickName"] == null) { USR_CustomerMod m_customer = USR_CustomerBll.GetInstance().GetModel(int.Parse(input["CustomerSysNo"].ToString())); ret.CustomerNickName = m_customer.NickName; ret.CustomerPhoto = m_customer.Photo; } else { ret.CustomerNickName = input["NickName"].ToString(); ret.CustomerPhoto = input["Photo"].ToString(); } if (input["CustomerSysNo"].ToString() != "") { ret.CustomerSysNo = int.Parse(input["CustomerSysNo"].ToString()); } ret.DR = int.Parse(input["DR"].ToString()); if (input["EndTime"].ToString() != "") { ret.EndTime = DateTime.Parse(input["EndTime"].ToString()); } if (input["IsSecret"].ToString() != "") { ret.IsSecret = int.Parse(input["IsSecret"].ToString()); } if (input["LastReplyTime"].ToString() != "") { ret.LastReplyTime = DateTime.Parse(input["LastReplyTime"].ToString()); } if (input["LastReplyUser"].ToString() != "") { ret.LastReplyUser = int.Parse(input["LastReplyUser"].ToString()); } if (input["ReadCount"].ToString() != "") { ret.ReadCount = int.Parse(input["ReadCount"].ToString()); } if (input["ReplyCount"].ToString() != "") { ret.ReplyCount = int.Parse(input["ReplyCount"].ToString()); } if (input["SysNo"].ToString() != "") { ret.SysNo = int.Parse(input["SysNo"].ToString()); } ret.Title = input["Title"].ToString(); if (input["TS"].ToString() != "") { ret.TS = DateTime.Parse(input["TS"].ToString()); } return ret; }
protected void Unnamed1_Click(object sender, EventArgs e) { if (txtDate.Text == "") { ltrNotice.Text = "请选择日期"; this.ClientScript.RegisterStartupScript(this.GetType(), "", "document.getElementById('noticediv').style.display='';closeforseconds();", true); return; } DateEntity m_date = new DateEntity(new DateTime(int.Parse(txtDate.Text.Split(new char[] { '-' })[0]), int.Parse(txtDate.Text.Split(new char[] { '-' })[1]), int.Parse(txtDate.Text.Split(new char[] { '-' })[2]), int.Parse(drpHour.SelectedValue), int.Parse(drpMinute.SelectedValue), 0)); BaZiMod male_bazi = new BaZiMod(); male_bazi.BirthTime = m_date; male_bazi.Gender = AppEnum.Gender.male; BaZiBiz.GetInstance().TimeToBaZi(ref male_bazi); BaZiMod female_baze = new BaZiMod(); female_baze.BirthTime = m_date; female_baze.Gender = AppEnum.Gender.female; BaZiBiz.GetInstance().TimeToBaZi(ref female_baze); if (drpDaYun.SelectedValue == "1") { SetDayun(ref male_bazi, male_bazi.DayTG, male_bazi.DayDZ); SetDayun(ref female_baze, female_baze.DayTG, female_baze.DayDZ); } else if (drpDaYun.SelectedValue == "2") { SetDayun(ref male_bazi, male_bazi.HourTG, male_bazi.HourDZ); SetDayun(ref female_baze, female_baze.HourTG, female_baze.HourDZ); } else if (drpDaYun.SelectedValue == "3") { SetDayun(ref male_bazi, BaZiBiz.GetInstance().MinuteTG(male_bazi.HourTG, male_bazi.BirthTime.Date.Minute + (male_bazi.BirthTime.Date.Hour + 1) % 2 * 60), BaZiBiz.GetInstance().MinuteDZ(male_bazi.BirthTime.Date.Minute + (male_bazi.BirthTime.Date.Hour + 1) % 2 * 60)); SetDayun(ref female_baze, BaZiBiz.GetInstance().MinuteTG(female_baze.HourTG, female_baze.BirthTime.Date.Minute + (female_baze.BirthTime.Date.Hour + 1) % 2 * 60), BaZiBiz.GetInstance().MinuteDZ(female_baze.BirthTime.Date.Minute + (female_baze.BirthTime.Date.Hour + 1) % 2 * 60)); } ltrResult.Text = BaziToHTML(male_bazi); ltrResult.Text += "<br /><br />" + BaziToHTML(female_baze); }