public DataSet GetSameFamous(AstroMod m_astro) { DataSet m_ds = new DataSet(); using (SQLData data = new SQLData()) { string sql = "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[0].Degree + " and Constellation=" + (int)m_astro.Stars[0].Constellation + " and star=" + (int)PublicValue.AstroStar.Sun + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[1].Degree + " and Constellation=" + (int)m_astro.Stars[1].Constellation + " and star=" + (int)PublicValue.AstroStar.Moo + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[2].Degree + " and Constellation=" + (int)m_astro.Stars[2].Constellation + " and star=" + (int)PublicValue.AstroStar.Mer + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[3].Degree + " and Constellation=" + (int)m_astro.Stars[3].Constellation + " and star=" + (int)PublicValue.AstroStar.Ven + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[4].Degree + " and Constellation=" + (int)m_astro.Stars[4].Constellation + " and star=" + (int)PublicValue.AstroStar.Mar + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[0].Gong + " and star=" + (int)PublicValue.AstroStar.Sun + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[1].Gong + " and star=" + (int)PublicValue.AstroStar.Moo + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[2].Gong + " and star=" + (int)PublicValue.AstroStar.Mer + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[3].Gong + " and star=" + (int)PublicValue.AstroStar.Ven + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[4].Gong + " and star=" + (int)PublicValue.AstroStar.Mar + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[5].Gong + " and star=" + (int)PublicValue.AstroStar.Jup + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[6].Gong + " and star=" + (int)PublicValue.AstroStar.Sat + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[7].Gong + " and star=" + (int)PublicValue.AstroStar.Ura + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[8].Gong + " and star=" + (int)PublicValue.AstroStar.Nep + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[9].Gong + " and star=" + (int)PublicValue.AstroStar.Plu + " and IsTop=1;"; try { m_ds = data.CmdtoDataSet(sql); } catch (Exception exception) { //throw exception; } return(m_ds); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["ID"] != null && Request.QueryString["ID"] != "") { try { //生成图片 AstroMod mod = new AstroMod(); mod.graphicID = Request.QueryString["ID"]; if (Request.QueryString["fa"] != "") { mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + Request.QueryString["fa"]; } if (Request.QueryString["fb"] != "") { mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + Request.QueryString["fb"]; } AstroBiz.GetInstance().GetGraphic(mod); //输出 CreateImageOnPage(AstroBiz.GetInstance().GetGraphicPath(mod.graphicID), HttpContext.Current); } catch(Exception ex) { LogManagement.getInstance().WriteException(ex, "星盘显示", Request.UserHostAddress); } } }
/// <summary> /// 根据ID生成临时图片 /// </summary> /// <param name="GraphicID"></param> public void GetGraphic(AstroMod mod) { if (mod.graphicID == "") { return; } string argument = mod.graphicID.Replace("_", " ").Replace(";", ":"); FATE_AstroMod m_astro = FATE_AstroBll.GetInstance().GetModel(mod.graphicID); if (m_astro != null && m_astro.DR == (int)AppEnum.State.normal) { m_astro.LastTime = DateTime.Now; FATE_AstroBll.GetInstance().Update(m_astro); return; } string tmpname = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + CommonTools.GetRandomString(5); argument += " -Xbb -Xo " + tmpname;//输出 argument += " -o0 " + AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"TextInfo\C" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonTools.GetRandomString(4); argument = argument.Replace("file1", mod.composeFile1); argument = argument.Replace("file2", mod.composeFile2); //try //{ string[] args = argument.Split(new char[] { '$' }); for (int i = 0; i < args.Length; i++) { RunAstrolog(args[i]); } //星盘信息加入数据库 FATE_AstroMod new_astro = new FATE_AstroMod(); new_astro.ID = mod.graphicID; new_astro.LastTime = DateTime.Now; FATE_AstroBll.GetInstance().Add(new_astro); //while (!File.Exists(tmpname) || IsUsed(tmpname)) //{ } //处理临时文件 SetGraphicColor(mod.graphicID, tmpname); //删除排盘临时文件 if (mod.composeFile1 != "") { File.Delete(mod.composeFile1); } if (mod.composeFile2 != "") { File.Delete(mod.composeFile2); } //} //catch (Exception ex) //{ // LogManagement.getInstance().WriteException(ex, "PPLive.Astro", ""); // return; //} }
public ReturnValue<AstroMod> TimeToAstro() { AstroMod input = null; if (input == null) { input = new AstroMod(); input.birth = DateTime.Now; input.position = new LatLng(SYS_DistrictBll.GetInstance().GetModel(37)); input.IsDayLight = AppEnum.BOOL.False; input.zone = -8; input.birth1 = DateTime.Now.AddDays(-300); input.position1 = new LatLng(SYS_DistrictBll.GetInstance().GetModel(37)); input.IsDayLight1 = AppEnum.BOOL.False; input.zone1 = -8; input.type = PublicValue.AstroType.hepan; input.compose = PublicValue.AstroZuhe.bijiao; input.startsShow.Clear(); for (int i = 1; i <= 30; i++) { input.startsShow.Add(i, PublicValue.GetAstroStar((PublicValue.AstroStar)i)); } input.aspectsShow.Clear(); input.aspectsShow.Add(1, 0); input.aspectsShow.Add(2, 180); input.aspectsShow.Add(4, 120); input.aspectsShow.Add(3, 90); input.aspectsShow.Add(5, 60); } //input.graphicID = AstroBiz.GetInstance().SetGraphicID(input); AstroBiz.GetInstance().GetParamters(ref input); if ((input.type == PublicValue.AstroType.hepan && input.compose == PublicValue.AstroZuhe.bijiao) || (input.type == PublicValue.AstroType.tuiyun && input.transit == PublicValue.AstroTuiyun.xingyun)) { AstroMod tmpinput = new AstroMod(); tmpinput.aspectsShow = input.aspectsShow; tmpinput.startsShow = input.startsShow; tmpinput.birth = input.birth; tmpinput.position = input.position; tmpinput.IsDayLight = input.IsDayLight; tmpinput.zone = input.zone; AstroBiz.GetInstance().GetParamters(ref tmpinput); input.Stars1 = tmpinput.Stars; } else { input.Stars1 = null; } return ReturnValue<AstroMod>.Get200OK(input); }
// Methods protected void Button1_Click(object sender, EventArgs e) { AstroMod mod = new AstroMod { type = PublicValue.AstroType.benming, birth = new DateTime(int.Parse(this.hfYear.Value), int.Parse(this.hfMonth.Value), int.Parse(this.hfDay.Value), int.Parse(this.hfHour.Value), 0, 0), position = new LatLng(SYS_DistrictBll.GetInstance().GetModel(0x856)), IsDayLight = AppEnum.BOOL.False, zone = -8 }; for (int i = 1; i < 0x15; i++) { mod.startsShow.Add(i, ""); } mod.aspectsShow.Clear(); for (int j = 1; j < 6; j++) { mod.aspectsShow.Add(j, 5M); } AstroBiz.GetInstance().GetParamters(ref mod); VenusLoveMod model = new VenusLoveMod { BirthTime = mod.birth, Source = 1, TS = DateTime.Now, UserSysNo = QQWeiBoUserBll.GetInstance().GetRecordByName(this.wb_name).SysNo }; VenusLoveBll.GetInstance().Add(model); int constellation = 0; foreach (Star star in mod.Stars) { if (star.StarName == PublicValue.AstroStar.Ven) { constellation = (int)star.Constellation; break; } } if (constellation != 0) { this.ltrTitle.Text = this.titles[constellation - 1]; this.ltrContext.Text = this.contexts[constellation - 1]; } this.MultiView1.ActiveViewIndex = 1; this.ViewState["ele"] = constellation; }
/// <summary> /// 根据ID获取星盘参数 /// </summary> /// <param name="GraphicID"></param> public void GetParamters(ref AstroMod mod) { mod.graphicID = SetGraphicID(mod); if (mod.graphicID == "") { return; } string argument = mod.graphicID.Replace("_", " ").Replace(";", ":"); string tmpname = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + CommonTools.GetRandomString(5); argument += " -o0 " + tmpname;//输出 argument = argument.Replace("file1", mod.composeFile1); argument = argument.Replace("file2", mod.composeFile2); //try //{ string[] args = argument.Split(new char[] { '$' }); for (int i = 0; i < args.Length; i++) { RunAstrolog(args[i]); } //生成临时参数文件 SetParas(ref mod, tmpname); //删除排盘临时文件 if (mod.composeFile1 != "") { File.Delete(mod.composeFile1); } if (mod.composeFile2 != "") { File.Delete(mod.composeFile2); } //} //catch (Exception ex) //{ // LogManagement.getInstance().WriteException(ex, "PPLive.Astro", ""); // return; //} }
protected void Page_Load(object sender, EventArgs e) { if (this.Visible == true) { if (!IsPostBack) { #region 本命盘下拉绑定 SortedList<int, string> aspect = new SortedList<int, string>(); for (int i = 1; i < 11; i++) { aspect.Add(i, i.ToString("0.00")); } aspect.Add(-1, "隐藏"); drpAspect0.DataSource = aspect; drpAspect0.DataTextField = "value"; drpAspect0.DataValueField = "key"; drpAspect0.DataBind(); drpAspect0.SelectedIndex = 6; drpAspect180.DataSource = aspect; drpAspect180.DataTextField = "value"; drpAspect180.DataValueField = "key"; drpAspect180.DataBind(); drpAspect180.SelectedIndex = 5; drpAspect120.DataSource = aspect; drpAspect120.DataTextField = "value"; drpAspect120.DataValueField = "key"; drpAspect120.DataBind(); drpAspect120.SelectedIndex = 5; drpAspect90.DataSource = aspect; drpAspect90.DataTextField = "value"; drpAspect90.DataValueField = "key"; drpAspect90.DataBind(); drpAspect90.SelectedIndex = 5; drpAspect60.DataSource = aspect; drpAspect60.DataTextField = "value"; drpAspect60.DataValueField = "key"; drpAspect60.DataBind(); drpAspect60.SelectedIndex = 3; #endregion #region 推运下拉绑定 SortedList<int, string> timezone = new SortedList<int, string>(); timezone.Add(0, "零时区"); for (int i = 1; i < 13; i++) { timezone.Add(0 - i, "东" + i + "区"); } for (int i = 1; i < 13; i++) { timezone.Add(i, "西" + i + "区"); } drpTimeZone2.DataSource = timezone; drpTimeZone2.DataTextField = "value"; drpTimeZone2.DataValueField = "key"; drpTimeZone2.DataBind(); drpTimeZone2.SelectedIndex = 4; drpProgressType.DataSource = PublicValue.GetAstroTuiyun(); drpProgressType.DataTextField = "value"; drpProgressType.DataValueField = "key"; drpProgressType.DataBind(); #endregion #region 组合下拉绑定 drpCompareType.DataSource = PublicValue.GetAstroZuhe(); drpCompareType.DataTextField = "value"; drpCompareType.DataValueField = "key"; drpCompareType.DataBind(); #endregion if (_input != null) { InitialChart();//用于系统中命盘展示 LinkButton8.Visible = false; } else if (_m_astro != null) { InitialFate();//用于排盘 } else { return; } ViewState["OriginalChart"] = m_astro; ViewState["NowChart"] = m_astro; } ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "SetDocument", "SetDocument();", true); if (!IsPostBack) { if (m_astro.type == PublicValue.AstroType.tuiyun) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "tuiyun", "document.getElementById('" + pnlTuiYun.ClientID + "').click();", true); } else if (m_astro.type == PublicValue.AstroType.hepan) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "hepan", "document.getElementById('" + pnlHePan.ClientID + "').click();", true); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "jiaozhengqian", "document.getElementById('" + pnlJiaoZheng.ClientID + "').click();", true); } } m_astro = (AstroMod)ViewState["NowChart"]; if (m_astro.type == PublicValue.AstroType.hepan) { Literal2.Text = @"出生时间:<br /> " + m_astro.birth1.ToString("yyyy年MM月dd日 HH:mm:ss") + @" <br /> 所属时区: " + (m_astro.zone1 > 0 ? "西" + m_astro.zone1.ToString() : "东" + m_astro.zone1.ToString()) + @"区<br /> 夏令时:" + (((int)m_astro.IsDayLight1) == 1 ? "是" : "否") + @" <br /> 性别: "+ AppEnum.GetGender(m_astro.Gender1)+@" <br /> 出生地: " + m_astro.position1.name + @" <br /> (经度" + m_astro.position1.Lng + @" <br /> 纬度" + m_astro.position1.Lat + @") <br />"; } else { second.Visible = false; } Literal1.Text = @"出生时间:<br /> " + m_astro.birth.ToString("yyyy年MM月dd日 HH:mm:ss") + @" <br /> 所属时区: " + (m_astro.zone > 0 ? "西" + m_astro.zone.ToString() : "东" + m_astro.zone.ToString()) + @"区<br /> 夏令时:" + (((int)m_astro.IsDayLight) == 1 ? "是" : "否") + @" <br /> 性别: " + AppEnum.GetGender(m_astro.Gender) + @" <br /> 出生地: " + m_astro.position.name + @" <br /> (经度" + m_astro.position.Lng + @" <br /> 纬度" + m_astro.position.Lat + @") <br />"; chartpara = m_astro.birth.ToString("yyyy_MM_dd_HH_mm") + "_" + (int)m_astro.IsDayLight + "_" + m_astro.position.Lat + "_" + m_astro.position.Lng + "_" + m_astro.zone; if (Parent.Page.ToString() == "ASP.pplive_astrochart_aspx" && IsPostBack) { //PPLive.AstroChart m_parent = (PPLive.AstroChart)Parent; //m_parent.m_astro = m_astro; //m_parent.SetParaLink(); //m_parent.SetSameFamous(); if (ChangePara != null) { ChangePara(this, EventArgs.Empty); } } } }
protected void LinkButton8_Click(object sender, EventArgs e) { m_astro = (AstroMod)ViewState["NowChart"]; string url = AppConfig.HomeUrl()+"Quest/Ask.aspx?"; url += "chart1=" + m_astro.birth.ToString("yyyy-MM-dd_HH:mm_") + Convert.ToInt16(m_astro.IsDayLight) + "_" + m_astro.position.Area.SysNo + "_" + (int)m_astro.Gender + "&chart2=" + m_astro.birth1.ToString("yyyy-MM-dd_HH:mm_") + Convert.ToInt16(m_astro.IsDayLight1) + "_" + m_astro.position1.Area.SysNo + "_" + (int)m_astro.Gender + "&type=" + (int)m_astro.type; Response.Redirect(url); }
public ReturnValue<AstroMod> TimeToAstro(Stream openPageData) { AstroMod input = null; 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.UTF8.GetString(byteJson); if (!string.IsNullOrEmpty(textJson)) { input = XMS.Core.Json.JsonSerializer.Deserialize<AstroMod>(textJson); } if (input == null) { input = new AstroMod(); input.birth = DateTime.Now; input.position = new LatLng(SYS_DistrictBll.GetInstance().GetModel(37)); input.IsDayLight = AppEnum.BOOL.False; input.zone = -8; input.birth1 = DateTime.Now.AddDays(-300); input.position1 = new LatLng(SYS_DistrictBll.GetInstance().GetModel(37)); input.IsDayLight1 = AppEnum.BOOL.False; input.zone1 = -8; input.type = PublicValue.AstroType.benming; input.compose = PublicValue.AstroZuhe.bijiao; } input.startsShow.Clear(); for (int i = 1; i <= 30; i++) { input.startsShow.Add(i, PublicValue.GetAstroStar((PublicValue.AstroStar)i)); } input.aspectsShow.Clear(); input.aspectsShow.Add(1, 0); input.aspectsShow.Add(2, 180); input.aspectsShow.Add(4, 120); input.aspectsShow.Add(3, 90); input.aspectsShow.Add(5, 60); //input.graphicID = AstroBiz.GetInstance().SetGraphicID(input); if ((input.type == PublicValue.AstroType.hepan && input.compose == PublicValue.AstroZuhe.bijiao) || (input.type == PublicValue.AstroType.tuiyun && input.transit == PublicValue.AstroTuiyun.xingyun)) { AstroMod tmpinput = new AstroMod(); tmpinput.aspectsShow = input.aspectsShow; tmpinput.startsShow = input.startsShow; tmpinput.birth = input.birth; tmpinput.position = input.position; tmpinput.IsDayLight = input.IsDayLight; tmpinput.zone = input.zone; AstroBiz.GetInstance().GetParamters(ref tmpinput); input.Stars = tmpinput.Stars; tmpinput = new AstroMod(); tmpinput.aspectsShow = input.aspectsShow; tmpinput.startsShow = input.startsShow; tmpinput.birth = input.birth1; tmpinput.position = input.position1; tmpinput.IsDayLight = input.IsDayLight1; tmpinput.zone = input.zone1; AstroBiz.GetInstance().GetParamters(ref tmpinput); input.Stars1 = tmpinput.Stars; } else { AstroBiz.GetInstance().GetParamters(ref input); input.Stars1 = null; } return ReturnValue<AstroMod>.Get200OK(input); }
/// <summary> /// 根据ID处理临时参数文件 /// </summary> /// <param name="GraphicID"></param> public void SetParas(ref AstroMod mod, string tmpname) { if (mod.graphicID == "") { return; } string newName = tmpname; #region 分析文件 if (!File.Exists(newName)) { return; } StreamReader smRead = new StreamReader(newName, System.Text.Encoding.Default); string content = ""; string line; while ((line = smRead.ReadLine()) != null) { content += line; } smRead.Dispose(); File.Delete(newName); string[] regstr = new string[5]; string p = @"YF (?<star>[\S]+?):[\s]+?(?<degree>[\S]+?)[\s]+?(?<const>[\S]+?)[\s]+?(?<cent>[\S]+?),[\s]+?[\S]+?[\s]+?[\S]+?,[\s]+?(?<progress>[\S]+?)[\s]+?"; string varstr = "star|degree|const|cent|progress"; string[] var = varstr.Split(new char[] { '|' }); MatchCollection mMCollection = Regex.Matches(content, p, RegexOptions.IgnoreCase); if (mMCollection.Count > 1) { int i = 0; foreach (Match m in mMCollection) { Astro.Star tmp_star = new Star((int)((PublicValue.AstroStar)Enum.Parse(typeof(PublicValue.AstroStar), m.Groups["star"].Value.Replace("12t", "Twelveth").Replace("11t", "Eleventh").Replace("9","Nin") .Replace("8","Eigh").Replace("6","Six").Replace("5","Fif").Replace("3","Thi").Replace("2","Seco")))); tmp_star.Degree = int.Parse(m.Groups["degree"].Value); tmp_star.Constellation = (PublicValue.Constellation)Enum.Parse(typeof(PublicValue.Constellation), m.Groups["const"].Value); tmp_star.Cent = decimal.Parse(m.Groups["cent"].Value); tmp_star.Progress = decimal.Parse(m.Groups["progress"].Value); mod.Stars[(int)tmp_star.StarName-1] = tmp_star; i++; } } for (int i = 0; i < mod.Stars.Length; i++) { if(mod.Stars[i]==null) { continue; } if (mod.Stars[i].StarName == PublicValue.AstroStar.Asc) { break; } decimal tmpdegree = Convert.ToDecimal(mod.Stars[i].Degree) + mod.Stars[i].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[i].Constellation * 100)); bool isgong = false; int asc = 20; for (int j = 0; j < mod.Stars.Length; j++) { try { if (mod.Stars[j]!=null&&mod.Stars[j].StarName == PublicValue.AstroStar.Second) { isgong = true; asc = j - 1; } if (isgong) { if ((tmpdegree <= Convert.ToDecimal(mod.Stars[j].Degree) + mod.Stars[j].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j].Constellation * 100))) && (tmpdegree >= Convert.ToDecimal(mod.Stars[j - 1].Degree) + mod.Stars[j - 1].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j - 1].Constellation * 100)))) { mod.Stars[i].Gong = j - asc; break; } else if (Convert.ToDecimal(mod.Stars[j].Degree) + mod.Stars[j].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j].Constellation * 100)) < Convert.ToDecimal(mod.Stars[j - 1].Degree) + mod.Stars[j - 1].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j - 1].Constellation * 100)) && tmpdegree <= Convert.ToDecimal(mod.Stars[j].Degree) + mod.Stars[j].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j].Constellation * 100))) { mod.Stars[i].Gong = j - asc; break; } else if ((tmpdegree <= Convert.ToDecimal(mod.Stars[20].Degree) + mod.Stars[20].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[20].Constellation * 100))) && (tmpdegree >= Convert.ToDecimal(mod.Stars[31].Degree) + mod.Stars[31].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[31].Constellation * 100)))) { mod.Stars[i].Gong = 12; break; } } } catch { mod.Stars[i].Gong = 12; break; } } } #endregion }
public void ResetPara(object sender, EventArgs e) { m_astro = Astro1.m_astro; ; SetParaLink(); SetSameFamous(); }
public QA_QuestionShowMini<AstroMod> MapQA_QuestionShowMiniForAstro(DataRow input) { QA_QuestionShowMini<AstroMod> ret = new QA_QuestionShowMini<AstroMod>(); 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) { AstroMod tmpastro = new AstroMod(); if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.personal).ToString()) { #region 设置实体各种参数 tmpastro.type = PublicValue.AstroType.benming; tmpastro.birth = DateTime.Parse(m_chart.FirstBirth.ToString()); tmpastro.Gender = (AppEnum.Gender)m_chart.FirstGender; string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); tmpastro.position = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName); if (m_chart.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { tmpastro.IsDayLight = AppEnum.BOOL.True; } else { tmpastro.IsDayLight = AppEnum.BOOL.False; } tmpastro.zone = int.Parse(m_chart.FirstTimeZone.ToString()); #endregion } else if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { #region 设置实体各种参数 tmpastro.type = PublicValue.AstroType.hepan; tmpastro.compose = PublicValue.AstroZuhe.bijiao; tmpastro.Gender = (AppEnum.Gender)m_chart.FirstGender; tmpastro.Gender1 = (AppEnum.Gender)m_chart.SecondGender; tmpastro.birth = DateTime.Parse(m_chart.FirstBirth.ToString()); string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); tmpastro.position = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName); if (m_chart.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { tmpastro.IsDayLight = AppEnum.BOOL.True; } else { tmpastro.IsDayLight = AppEnum.BOOL.False; } tmpastro.zone = int.Parse(m_chart.FirstTimeZone.ToString()); tmpastro.birth1 = DateTime.Parse(m_chart.SecondBirth.ToString()); tmplatlng = m_chart.SecondPoi.ToString().Split(new char[] { '|' }); tmpastro.position1 = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName); if (m_chart.SecondDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { tmpastro.IsDayLight1 = AppEnum.BOOL.True; } else { tmpastro.IsDayLight1 = AppEnum.BOOL.False; } tmpastro.zone1 = int.Parse(m_chart.SecondTimeZone.ToString()); #endregion } tmpastro.startsShow.Clear(); for (int i = 1; i <= 30; i++) { tmpastro.startsShow.Add(i, PublicValue.GetAstroStar((PublicValue.AstroStar)i)); } tmpastro.aspectsShow.Clear(); tmpastro.aspectsShow.Add(1, 0); tmpastro.aspectsShow.Add(2, 180); tmpastro.aspectsShow.Add(4, 120); tmpastro.aspectsShow.Add(3, 90); tmpastro.aspectsShow.Add(5, 60); tmpastro.graphicID = AstroBiz.GetInstance().SetGraphicID(tmpastro); if ((tmpastro.type == PublicValue.AstroType.hepan && tmpastro.compose == PublicValue.AstroZuhe.bijiao) || (tmpastro.type == PublicValue.AstroType.tuiyun && tmpastro.transit == PublicValue.AstroTuiyun.xingyun)) { AstroMod tmpinput = new AstroMod(); tmpinput.aspectsShow = tmpastro.aspectsShow; tmpinput.startsShow = tmpastro.startsShow; tmpinput.birth = tmpastro.birth; tmpinput.position = tmpastro.position; tmpinput.IsDayLight = tmpastro.IsDayLight; tmpinput.zone = tmpastro.zone; AstroBiz.GetInstance().GetParamters(ref tmpinput); tmpastro.Stars = tmpinput.Stars; tmpinput = new AstroMod(); tmpinput.aspectsShow = tmpastro.aspectsShow; tmpinput.startsShow = tmpastro.startsShow; tmpinput.birth = tmpastro.birth1; tmpinput.position = tmpastro.position1; tmpinput.IsDayLight = tmpastro.IsDayLight1; tmpinput.zone = tmpastro.zone1; AstroBiz.GetInstance().GetParamters(ref tmpinput); tmpastro.Stars1 = tmpinput.Stars; } else { AstroBiz.GetInstance().GetParamters(ref tmpastro); tmpastro.Stars1 = null; } ret.Chart.Add(tmpastro); } #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()); } else { ret.EndTime = AppConst.DateTimeNull; } if (input["IsSecret"].ToString() != "") { ret.IsSecret = int.Parse(input["IsSecret"].ToString()); } if (input["LastReplyTime"].ToString() != "") { ret.LastReplyTime = DateTime.Parse(input["LastReplyTime"].ToString()); } else { ret.LastReplyTime = AppConst.DateTimeNull; } 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()); } else { ret.TS = AppConst.DateTimeNull; } return ret; }
/// <summary> /// 根据命盘实体返回Astrolog参数 /// </summary> /// <param name="mod"></param> /// <returns></returns> private string SetAstrologArgument(AstroMod mod) { string argument = ""; if (mod.type == PublicValue.AstroType.benming) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; } else if (mod.type == PublicValue.AstroType.hepan) { mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -o file1"; argument += "$-qb " + mod.birth1.Month + " " + mod.birth1.Day + " " + mod.birth1.Year + " " + mod.birth1.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight1 + " " + mod.zone1 + " " + mod.position1.Lng + " " + mod.position1.Lat; argument += " -o file2"; if (mod.compose == PublicValue.AstroZuhe.bijiao) { argument += "$-r0 file1 file2"; } else if (mod.compose == PublicValue.AstroZuhe.zuhe) { argument += "$-rc file1 file2"; } else if (mod.compose == PublicValue.AstroZuhe.shikong) { argument += "$-rm file1 file2"; } else if (mod.compose == PublicValue.AstroZuhe.hebing) { argument += "$-r file1 file2"; } } else if (mod.type == PublicValue.AstroType.tuiyun) { if (mod.transit == PublicValue.AstroTuiyun.xingyun) { mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -o file1"; argument += "$-qb " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year + " " + mod.transitTime.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.transitPosition.Lng + " " + mod.transitPosition.Lat; argument += " -o file2"; argument += "$-r0 file1 file2"; } else if (mod.transit == PublicValue.AstroTuiyun.cixian) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -pd 365.25636 -p " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } else if (mod.transit == PublicValue.AstroTuiyun.sanxian) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -pd 29.530588 -p " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } else if (mod.transit == PublicValue.AstroTuiyun.sanxian1) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -pd 27.321582 -p " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } else if (mod.transit == PublicValue.AstroTuiyun.rifanzhao) { string file = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\R" + CommonTools.GetRandomString(5); DateTime lastbirth = mod.birth; for (int i = 1; i > 0; i++) { if (lastbirth.AddYears(1) > mod.transitTime) { break; } lastbirth = lastbirth.AddYears(1); } //DateTime tmpbirth = mod.birth.AddHours(-mod.zone); string tmparg = "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " 0 " + mod.position.Lng + " " + mod.position.Lat; tmparg += " -tY " + lastbirth.AddYears(-1).Year + " 3 -R0 sun -RT0 sun > " + file; RunAstrolog(tmparg); #region 分析文件 if (!File.Exists(file)) { return(null); } StreamReader smRead = new StreamReader(file, System.Text.Encoding.Default); string line; while ((line = smRead.ReadLine()) != null) { if (line.Contains("Solar Return")) { TimeSpan tmp = new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2))) - lastbirth; if (tmp.Days < 5 && tmp.Days > -5) { break; } } } smRead.Dispose(); #endregion DateTime returndate = new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2)), int.Parse(line.Substring(11, 2)), int.Parse(line.Substring(14, 2)), 0); if (line.Contains("pm")) { returndate = returndate.AddHours(12); } argument += "-qb " + returndate.Month + " " + returndate.Day + " " + returndate.Year + " " + returndate.ToString("HH:mm:ss") + " 0 " + mod.zone + " " + mod.transitPosition.Lng + " " + mod.transitPosition.Lat; File.Delete(file); } else if (mod.transit == PublicValue.AstroTuiyun.yuefanzhao) { string file = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\R" + CommonTools.GetRandomString(5); DateTime lastbirth = mod.birth; for (int i = 1; i > 0; i++) { if (lastbirth.AddYears(1) > mod.transitTime) { break; } lastbirth = lastbirth.AddYears(1); } string tmparg = "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " 0 " + mod.position.Lng + " " + mod.position.Lat; tmparg += " -tY " + lastbirth.AddYears(-1).Year + " 3 -R0 moon -RT0 moon > " + file; RunAstrolog(tmparg); #region 分析文件 if (!File.Exists(file)) { return(null); } StreamReader smRead = new StreamReader(file, System.Text.Encoding.Default); string line; DateTime returndate = AppConst.DateTimeNull; while ((line = smRead.ReadLine()) != null) { if (line.Contains("Lunar Return")) { if (returndate != AppConst.DateTimeNull && new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2)), int.Parse(line.Substring(11, 2)), int.Parse(line.Substring(14, 2)), 0) > mod.transitTime) { break; } returndate = new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2)), int.Parse(line.Substring(11, 2)), int.Parse(line.Substring(14, 2)), 0); } } smRead.Dispose(); #endregion if (line.Contains("pm")) { returndate = returndate.AddHours(12); } argument += "-qb " + returndate.Month + " " + returndate.Day + " " + returndate.Year + " " + returndate.ToString("HH:mm:ss") + " 0 " + mod.zone + " " + mod.transitPosition.Lng + " " + mod.transitPosition.Lat; File.Delete(file); } else if (mod.transit == PublicValue.AstroTuiyun.taiyanghu) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -p0 " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } } argument += " -c " + mod.houseSystem;//分宫法 #region 容许度 argument += " -YAo 1 5"; foreach (int key in mod.aspectsShow.Keys) { argument += " " + mod.aspectsShow[key].ToString("0"); } #endregion #region 星体显示 argument += " -R0"; foreach (int key in mod.startsShow.Keys) { argument += " " + key; } #endregion //argument += " -Xr";//反白 //argument += " -Xw 400 400";//设置输出尺寸 return(argument); }
/// <summary> /// 根据ID处理临时参数文件 /// </summary> /// <param name="GraphicID"></param> public void SetParas(ref AstroMod mod, string tmpname) { if (mod.graphicID == "") { return; } string newName = tmpname; #region 分析文件 if (!File.Exists(newName)) { return; } StreamReader smRead = new StreamReader(newName, System.Text.Encoding.Default); string content = ""; string line; while ((line = smRead.ReadLine()) != null) { content += line; } smRead.Dispose(); File.Delete(newName); string[] regstr = new string[5]; string p = @"YF (?<star>[\S]+?):[\s]+?(?<degree>[\S]+?)[\s]+?(?<const>[\S]+?)[\s]+?(?<cent>[\S]+?),[\s]+?[\S]+?[\s]+?[\S]+?,[\s]+?(?<progress>[\S]+?)[\s]+?"; string varstr = "star|degree|const|cent|progress"; string[] var = varstr.Split(new char[] { '|' }); MatchCollection mMCollection = Regex.Matches(content, p, RegexOptions.IgnoreCase); if (mMCollection.Count > 1) { int i = 0; foreach (Match m in mMCollection) { Astro.Star tmp_star = new Star((int)((PublicValue.AstroStar)Enum.Parse(typeof(PublicValue.AstroStar), m.Groups["star"].Value.Replace("12t", "Twelveth").Replace("11t", "Eleventh").Replace("9", "Nin") .Replace("8", "Eigh").Replace("6", "Six").Replace("5", "Fif").Replace("3", "Thi").Replace("2", "Seco")))); tmp_star.Degree = int.Parse(m.Groups["degree"].Value); tmp_star.Constellation = (PublicValue.Constellation)Enum.Parse(typeof(PublicValue.Constellation), m.Groups["const"].Value); tmp_star.Cent = decimal.Parse(m.Groups["cent"].Value); tmp_star.Progress = decimal.Parse(m.Groups["progress"].Value); mod.Stars[(int)tmp_star.StarName - 1] = tmp_star; i++; } } for (int i = 0; i < mod.Stars.Length; i++) { if (mod.Stars[i] == null) { continue; } if (mod.Stars[i].StarName == PublicValue.AstroStar.Asc) { break; } decimal tmpdegree = Convert.ToDecimal(mod.Stars[i].Degree) + mod.Stars[i].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[i].Constellation * 100)); bool isgong = false; int asc = 20; for (int j = 0; j < mod.Stars.Length; j++) { try { if (mod.Stars[j] != null && mod.Stars[j].StarName == PublicValue.AstroStar.Second) { isgong = true; asc = j - 1; } if (isgong) { if ((tmpdegree <= Convert.ToDecimal(mod.Stars[j].Degree) + mod.Stars[j].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j].Constellation * 100))) && (tmpdegree >= Convert.ToDecimal(mod.Stars[j - 1].Degree) + mod.Stars[j - 1].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j - 1].Constellation * 100)))) { mod.Stars[i].Gong = j - asc; break; } else if (Convert.ToDecimal(mod.Stars[j].Degree) + mod.Stars[j].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j].Constellation * 100)) < Convert.ToDecimal(mod.Stars[j - 1].Degree) + mod.Stars[j - 1].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j - 1].Constellation * 100)) && tmpdegree <= Convert.ToDecimal(mod.Stars[j].Degree) + mod.Stars[j].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[j].Constellation * 100))) { mod.Stars[i].Gong = j - asc; break; } else if ((tmpdegree <= Convert.ToDecimal(mod.Stars[20].Degree) + mod.Stars[20].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[20].Constellation * 100))) && (tmpdegree >= Convert.ToDecimal(mod.Stars[31].Degree) + mod.Stars[31].Cent / (decimal)100 + Convert.ToDecimal(((int)mod.Stars[31].Constellation * 100)))) { mod.Stars[i].Gong = 12; break; } } } catch { mod.Stars[i].Gong = 12; break; } } } #endregion }
/// <summary> /// 根据命盘实体返回ID /// </summary> /// <param name="mod"></param> /// <returns></returns> public string SetGraphicID(AstroMod mod) { string argument = SetAstrologArgument(mod); return(argument.Replace(" ", "_").Replace(":", ";")); }
/// <summary> /// 用于赋予datatable后初始化页面,其中本命盘显示本命盘,合盘则显示比较盘 /// </summary> public void InitialChart() { if (_input == null || _input.CharType == AppConst.IntNull) { return; } if(_input.CharType.ToString()==((int)AppEnum.ChartType.personal).ToString()) { m_astro = new AstroMod(); #region 设置实体各种参数 m_astro.type = PublicValue.AstroType.benming; m_astro.birth = DateTime.Parse(_input.FirstBirth.ToString()); m_astro.Gender = (AppEnum.Gender)_input.FirstGender; string[] tmplatlng = _input.FirstPoi.ToString().Split(new char[] { '|' }); m_astro.position = new LatLng(tmplatlng[1],tmplatlng[0],_input.FirstPoiName); if (_input.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { m_astro.IsDayLight = AppEnum.BOOL.True; } else { m_astro.IsDayLight = AppEnum.BOOL.False; } m_astro.zone = int.Parse(_input.FirstTimeZone.ToString()); SetPara(); #endregion SetBenMing(); DatePickert3.SelectedTime = m_astro.birth; } else if(_input.CharType.ToString()==((int)AppEnum.ChartType.relation).ToString()) { m_astro = new AstroMod(); #region 设置实体各种参数 m_astro.type = PublicValue.AstroType.hepan; m_astro.compose = PublicValue.AstroZuhe.bijiao; m_astro.Gender = (AppEnum.Gender)_input.FirstGender; m_astro.Gender1 = (AppEnum.Gender)_input.SecondGender; m_astro.birth = DateTime.Parse(_input.FirstBirth.ToString()); string[] tmplatlng = _input.FirstPoi.ToString().Split(new char[] { '|' }); m_astro.position = new LatLng(tmplatlng[1], tmplatlng[0], _input.FirstPoiName); if (_input.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { m_astro.IsDayLight = AppEnum.BOOL.True; } else { m_astro.IsDayLight = AppEnum.BOOL.False; } m_astro.zone = int.Parse(_input.FirstTimeZone.ToString()); m_astro.birth1 = DateTime.Parse(_input.SecondBirth.ToString()); tmplatlng = _input.SecondPoi.ToString().Split(new char[] { '|' }); m_astro.position1 = new LatLng(tmplatlng[1], tmplatlng[0], _input.SecondPoiName); if (_input.SecondDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { m_astro.IsDayLight1 = AppEnum.BOOL.True; } else { m_astro.IsDayLight1 = AppEnum.BOOL.False; } m_astro.zone1 = int.Parse(_input.SecondTimeZone.ToString()); //m_astro.houseSystem = int.Parse(drpSOH.SelectedValue); SetPara(); #endregion SetHePan(); if (!IsPostBack) { pnlTuiYun.Style["display"] = "none"; pnlJiaoZheng.Style["display"] = "none"; hepaninfo.Style["display"] = "none"; DatePicker2.SelectedTime = m_astro.birth1; chkDaylight2.Checked = Convert.ToBoolean((int)m_astro.IsDayLight1); District2.Area = m_astro.position1.Area; drpTimeZone2.SelectedIndex = drpTimeZone2.Items.IndexOf(drpTimeZone2.Items.FindByValue(m_astro.zone1.ToString())); LinkButton2.Style["display"] = "none"; } } }
public DataSet GetSameFamous(AstroMod m_astro) { DataSet m_ds = new DataSet(); using (SQLData data = new SQLData()) { string sql = "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[0].Degree + " and Constellation=" + (int)m_astro.Stars[0].Constellation+ " and star=" + (int)PublicValue.AstroStar.Sun + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[1].Degree + " and Constellation=" + (int)m_astro.Stars[1].Constellation + " and star=" + (int)PublicValue.AstroStar.Moo + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[2].Degree + " and Constellation=" + (int)m_astro.Stars[2].Constellation + " and star=" + (int)PublicValue.AstroStar.Mer + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[3].Degree + " and Constellation=" + (int)m_astro.Stars[3].Constellation + " and star=" + (int)PublicValue.AstroStar.Ven + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where degree=" + m_astro.Stars[4].Degree + " and Constellation=" + (int)m_astro.Stars[4].Constellation + " and star=" + (int)PublicValue.AstroStar.Mar + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[0].Gong + " and star=" + (int)PublicValue.AstroStar.Sun + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[1].Gong + " and star=" + (int)PublicValue.AstroStar.Moo + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[2].Gong + " and star=" + (int)PublicValue.AstroStar.Mer + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[3].Gong + " and star=" + (int)PublicValue.AstroStar.Ven + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[4].Gong + " and star=" + (int)PublicValue.AstroStar.Mar + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[5].Gong + " and star=" + (int)PublicValue.AstroStar.Jup + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[6].Gong + " and star=" + (int)PublicValue.AstroStar.Sat + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[7].Gong + " and star=" + (int)PublicValue.AstroStar.Ura + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[8].Gong + " and star=" + (int)PublicValue.AstroStar.Nep + " and IsTop=1;" + "select top 3 Sys_Famous.name,Sys_Famous.sysno from Sys_Famous_AstroStar left join Sys_Famous on Sys_Famous.sysno = famoussysno where gong=" + m_astro.Stars[9].Gong + " and star=" + (int)PublicValue.AstroStar.Plu + " and IsTop=1;"; try { m_ds = data.CmdtoDataSet(sql); } catch (Exception exception) { //throw exception; } return m_ds; } }
public ReturnValue<QA_QuestionShow<AstroMod>> GetQuestionForAstro(int sysno) { QA_QuestionMod tmp = QA_QuestionBll.GetInstance().GetModel(sysno); QA_QuestionShow<AstroMod> ret = new QA_QuestionShow<AstroMod>(); 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) { AstroMod tmpastro = new AstroMod(); if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.personal).ToString()) { #region 设置实体各种参数 tmpastro.type = PublicValue.AstroType.benming; tmpastro.birth = DateTime.Parse(m_chart.FirstBirth.ToString()); tmpastro.Gender = (AppEnum.Gender)m_chart.FirstGender; string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); tmpastro.position = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName); if (m_chart.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { tmpastro.IsDayLight = AppEnum.BOOL.True; } else { tmpastro.IsDayLight = AppEnum.BOOL.False; } tmpastro.zone = int.Parse(m_chart.FirstTimeZone.ToString()); #endregion } else if (m_chart.CharType.ToString() == ((int)AppEnum.ChartType.relation).ToString()) { #region 设置实体各种参数 tmpastro.type = PublicValue.AstroType.hepan; tmpastro.compose = PublicValue.AstroZuhe.bijiao; tmpastro.Gender = (AppEnum.Gender)m_chart.FirstGender; tmpastro.Gender1 = (AppEnum.Gender)m_chart.SecondGender; tmpastro.birth = DateTime.Parse(m_chart.FirstBirth.ToString()); string[] tmplatlng = m_chart.FirstPoi.ToString().Split(new char[] { '|' }); tmpastro.position = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.FirstPoiName); if (m_chart.FirstDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { tmpastro.IsDayLight = AppEnum.BOOL.True; } else { tmpastro.IsDayLight = AppEnum.BOOL.False; } tmpastro.zone = int.Parse(m_chart.FirstTimeZone.ToString()); tmpastro.birth1 = DateTime.Parse(m_chart.SecondBirth.ToString()); tmplatlng = m_chart.SecondPoi.ToString().Split(new char[] { '|' }); tmpastro.position1 = new LatLng(tmplatlng[1], tmplatlng[0], m_chart.SecondPoiName); if (m_chart.SecondDayLight.ToString() == ((int)AppEnum.BOOL.True).ToString()) { tmpastro.IsDayLight1 = AppEnum.BOOL.True; } else { tmpastro.IsDayLight1 = AppEnum.BOOL.False; } tmpastro.zone1 = int.Parse(m_chart.SecondTimeZone.ToString()); #endregion } tmpastro.startsShow.Clear(); for (int i = 1; i <= 30; i++) { tmpastro.startsShow.Add(i, PublicValue.GetAstroStar((PublicValue.AstroStar)i)); } tmpastro.aspectsShow.Clear(); tmpastro.aspectsShow.Add(1, 0); tmpastro.aspectsShow.Add(2, 180); tmpastro.aspectsShow.Add(4, 120); tmpastro.aspectsShow.Add(3, 90); tmpastro.aspectsShow.Add(5, 60); tmpastro.graphicID = AstroBiz.GetInstance().SetGraphicID(tmpastro); if ((tmpastro.type == PublicValue.AstroType.hepan && tmpastro.compose == PublicValue.AstroZuhe.bijiao) || (tmpastro.type == PublicValue.AstroType.tuiyun && tmpastro.transit == PublicValue.AstroTuiyun.xingyun)) { AstroMod tmpinput = new AstroMod(); tmpinput.aspectsShow = tmpastro.aspectsShow; tmpinput.startsShow = tmpastro.startsShow; tmpinput.birth = tmpastro.birth; tmpinput.position = tmpastro.position; tmpinput.IsDayLight = tmpastro.IsDayLight; tmpinput.zone = tmpastro.zone; AstroBiz.GetInstance().GetParamters(ref tmpinput); tmpastro.Stars = tmpinput.Stars; tmpinput = new AstroMod(); tmpinput.aspectsShow = tmpastro.aspectsShow; tmpinput.startsShow = tmpastro.startsShow; tmpinput.birth = tmpastro.birth1; tmpinput.position = tmpastro.position1; tmpinput.IsDayLight = tmpastro.IsDayLight1; tmpinput.zone = tmpastro.zone1; AstroBiz.GetInstance().GetParamters(ref tmpinput); tmpastro.Stars1 = tmpinput.Stars; } else { AstroBiz.GetInstance().GetParamters(ref tmpastro); tmpastro.Stars1 = null; } ret.Chart.Add(tmpastro); } #endregion return ReturnValue<QA_QuestionShow<AstroMod>>.Get200OK(ret); }
protected void Unnamed1_Click(object sender, EventArgs e) { AstroMod m_astro = new AstroMod(); m_astro.type = PublicValue.AstroType.benming; #region 设置实体各种参数 m_astro.birth = DateTime.Parse(HiddenField4.Value); SYS_DistrictMod dis = SYS_DistrictBll.GetInstance().GetModel(int.Parse(HiddenField2.Value)); if (string.IsNullOrEmpty(dis.Latitude) || string.IsNullOrEmpty(dis.longitude)) { SYS_DistrictMod tmp = SYS_DistrictBll.GetInstance().GetModel(dis.UpSysNo); dis.Latitude = tmp.Latitude; dis.longitude = tmp.longitude; } m_astro.position = new LatLng(dis); if (HiddenField1.Value == "1") { m_astro.IsDayLight = AppEnum.BOOL.True; } else if (HiddenField1.Value == "0") { m_astro.IsDayLight = AppEnum.BOOL.False; } else { m_astro.IsDayLight = (AppEnum.BOOL)Convert.ToInt16(PublicDeal.GetInstance().IsDayLight(m_astro.birth, 0)); } if (HiddenField6.Value == "g1") { m_astro.Gender = AppEnum.Gender.male; } else { m_astro.Gender = AppEnum.Gender.female; } m_astro.zone = -8; for (int i = 1; i < 21; i++) { m_astro.startsShow.Add(i, ""); } m_astro.aspectsShow.Clear(); for (int i = 1; i < 6; i++) { m_astro.aspectsShow.Add(i, 5); } #endregion AstroBiz.GetInstance().GetParamters(ref m_astro); Dictionary<PublicValue.AstroStar, Star> m_star = new Dictionary<PublicValue.AstroStar, Star>(); foreach (Star tmpstar in m_astro.Stars) { m_star.Add(tmpstar.StarName, tmpstar); } string jsstr = ""; //吉星 List<PublicValue.AstroStar> goodstars = new List<PublicValue.AstroStar>(); goodstars.Add(PublicValue.AstroStar.Jup); goodstars.Add(PublicValue.AstroStar.Ven); //凶星 Dictionary<PublicValue.AstroStar, int> badstars = new Dictionary<PublicValue.AstroStar, int>(); List<PublicValue.AstroStar> tmpbad = new List<PublicValue.AstroStar>(); tmpbad.Add(PublicValue.AstroStar.Mar); tmpbad.Add(PublicValue.AstroStar.Sat); tmpbad.Add(PublicValue.AstroStar.Ura); tmpbad.Add(PublicValue.AstroStar.Nep); tmpbad.Add(PublicValue.AstroStar.Plu); List<PublicValue.AstroStar> twelve = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 12, false); List<PublicValue.AstroStar> eight = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 8, false); List<PublicValue.AstroStar> seven = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false); List<PublicValue.AstroStar> two = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 2, false); foreach (PublicValue.AstroStar tmp in tmpbad) { badstars.Add(tmp, 1); } foreach (PublicValue.AstroStar tmp in eight) { if (!tmpbad.Contains(tmp)) { if (!badstars.ContainsKey(tmp)) badstars.Add(tmp, 1); } else { badstars[tmp]++; } } foreach (PublicValue.AstroStar tmp in twelve) { if (!tmpbad.Contains(tmp)) { if (!badstars.ContainsKey(tmp)) badstars.Add(tmp, 1); } else { badstars[tmp]++; } } List<PublicValue.AstroStar> mingzhu = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 1, false); foreach (PublicValue.AstroStar tmp in mingzhu) { if (!tmpbad.Contains(tmp)) { if (!badstars.ContainsKey(tmp)) badstars.Add(tmp, 1); } else { badstars[tmp]++; } } #region 花 //Label1.Text = "1.金星星座为:" + PublicValue.GetConstellation(m_star[PublicValue.AstroStar.Ven].Constellation) + "<br/>"; jsstr += "showItem('hua', " + (int)m_star[PublicValue.AstroStar.Ven].Constellation + ");"; ViewState["hua"] = (int)m_star[PublicValue.AstroStar.Ven].Constellation; #endregion #region 金星元素 int venusEle = 0; venusEle = (int)PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Ven].Constellation); //Label1.Text += "2.金星星座元素为:" + PublicValue.GetElement(PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Ven].Constellation)) + "<br />"; #endregion #region 红杏 bool hongxing = false; if (PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.he, AppConst.DecimalNull) || PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.chong, AppConst.DecimalNull) || PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.xing, AppConst.DecimalNull)) { hongxing = true; } ////Label1.Text += "金星:" + ((int)m_star[PublicValue.AstroStar.Ven].Constellation) * 30 + " " + m_star[PublicValue.AstroStar.Ven].Degree + " " + m_star[PublicValue.AstroStar.Ven].Cent / 60 * 100; ////Label1.Text += "婚神:" + ((int)m_star[PublicValue.AstroStar.Jun].Constellation) * 30 + " " + m_star[PublicValue.AstroStar.Jun].Degree + " " + m_star[PublicValue.AstroStar.Jun].Cent / 60 * 100; //Label1.Text += "3.是否有红杏:" + (hongxing==true ? "有" : "没有") + "<br />"; jsstr += "showItem('hongxing', " + (hongxing == true ? "1" : "0") + ");"; if (hongxing) { li5.Style["display"] = ""; } #endregion #region 蜜蜂 int beecount = 0; List<PublicValue.AstroStar> beestars = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false); //Label1.Text += "7宫主:"; foreach (PublicValue.AstroStar tmpstar in beestars) { //Label1.Text += PublicValue.GetAstroStar(tmpstar); } //Label1.Text += "<br />"; //Label1.Text += "凶星:"; foreach (PublicValue.AstroStar tmpstar in badstars.Keys) { //Label1.Text += PublicValue.GetAstroStar(tmpstar); } //Label1.Text += "<br />"; beestars.Add(PublicValue.AstroStar.Des); beestars.Add(PublicValue.AstroStar.Jun); foreach (PublicValue.AstroStar tmpstar in beestars) { int tmpflag = 0; if (tmpstar!=goodstars[0]&&PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstar], m_star[goodstars[0]])) { beecount++; tmpflag = 1; } if (tmpstar != goodstars[1] && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstar], m_star[goodstars[1]])) { beecount++; if (tmpflag == 1) { beecount++; } } } //Label1.Text += "4.蜜蜂指数为:" + beecount + "<br />"; jsstr += "showItem('mifeng', " + (beecount + 1 > 3 ? 4 : beecount + 1) + ");"; li1.Style["display"] = ""; ViewState["bee"] = beecount; #endregion #region 负面 Dictionary<string, int> showele = new Dictionary<string, int>(); showele.Add("paopao", 0); showele.Add("chongzi", 0); showele.Add("cu", 0); showele.Add("liehen", 0); showele.Add("bingdong", 0); showele.Add("zhezhi", 0); showele.Add("kuye", 0); List<PublicValue.AstroStar> breakstars = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false); breakstars.Add(PublicValue.AstroStar.Ven); breakstars.Add(PublicValue.AstroStar.Jun); breakstars.Add(PublicValue.AstroStar.Des); breakstars = breakstars.Distinct().ToList(); foreach (PublicValue.AstroStar tmp in badstars.Keys) { //if (tmp != goodstars[0]) // continue; int tmpflag = 0; for (int i = 0; i < breakstars.Count; i++) { if (PublicDeal.GetInstance().HasAnyBadPhase(m_star[tmp], m_star[breakstars[i]])) { bool Exact = false; if (PublicDeal.GetInstance().HasAnyBadPhase(m_star[tmp], m_star[breakstars[i]], 1)) { Exact = true; } switch (tmp) { case PublicValue.AstroStar.Mar: case PublicValue.AstroStar.Sun: showele["zhezhi"]+=badstars[tmp]; if (Exact) showele["zhezhi"]++; break; case PublicValue.AstroStar.Jup: case PublicValue.AstroStar.Ven: showele["kuye"] += badstars[tmp]; if (Exact) showele["kuye"]++; break; case PublicValue.AstroStar.Sat: showele["liehen"] += badstars[tmp]; if (Exact) showele["liehen"]++; break; case PublicValue.AstroStar.Ura: showele["bingdong"] += badstars[tmp]; if (Exact) showele["bingdong"]++; break; case PublicValue.AstroStar.Nep: showele["paopao"] += badstars[tmp]; if (Exact) showele["paopao"]++; break; case PublicValue.AstroStar.Plu: case PublicValue.AstroStar.Moo: showele["cu"] += badstars[tmp]; if (Exact) showele["cu"]++; break; case PublicValue.AstroStar.Mer: showele["chongzi"] += badstars[tmp]; if (Exact) showele["chongzi"]++; break; } tmpflag++; if(tmpflag > 1) { switch (tmp) { case PublicValue.AstroStar.Mar: case PublicValue.AstroStar.Sun: showele["zhezhi"]++; break; case PublicValue.AstroStar.Jup: case PublicValue.AstroStar.Ven: showele["kuye"]++; break; case PublicValue.AstroStar.Sat: showele["liehen"]++; break; case PublicValue.AstroStar.Ura: showele["bingdong"]++; break; case PublicValue.AstroStar.Nep: showele["paopao"]++; break; case PublicValue.AstroStar.Plu: case PublicValue.AstroStar.Moo: showele["cu"]++; break; case PublicValue.AstroStar.Mer: showele["chongzi"]++; break; } } } } } ////Label1.Text += "4.裂痕指数为:" + breakcount + "<br />"; jsstr += "showItem('liehen', " + (showele["liehen"] > 3 ? 4 : showele["liehen"]) + ");"; if (showele["liehen"] > 0) { li7.Style["display"] = ""; } jsstr += "showItem('paopao', " + (showele["paopao"] > 3 ? 4 : showele["paopao"]) + ");"; if (showele["paopao"] > 0) { li2.Style["display"] = ""; } jsstr += "showItem('chongzi', " + (showele["chongzi"] > 2 ? 3 : showele["chongzi"]) + ");"; if (showele["chongzi"] > 0) { li4.Style["display"] = ""; } jsstr += "showItem('cu', " + (showele["cu"] > 2 ? 3 : showele["cu"]) + ");"; if (showele["cu"] > 0) { li8.Style["display"] = ""; } jsstr += "showItem('bingdong', " + (showele["bingdong"] > 2 ? 3 : showele["bingdong"]) + ");"; if (showele["bingdong"] > 0) { li6.Style["display"] = ""; } jsstr += "showItem('zhezhi', " + (showele["zhezhi"] > 4 ? 4 : showele["zhezhi"]) + ");"; if (showele["zhezhi"] > 0) { li3.Style["display"] = ""; } jsstr += "showItem('kuzhi', " + (showele["kuye"] > 3 ? 3 : showele["kuye"]) + ");"; if (showele["kuye"] > 0) { li9.Style["display"] = ""; } int totalbad = showele["paopao"] + showele["chongzi"] + showele["cu"] + showele["liehen"] + showele["bingdong"] + showele["zhezhi"] + showele["kuye"]; span1.Style["width"] = ((4096 -totalbad * 128) / 32).ToString() + "px"; ltr1.Text = ((3200-totalbad * 100) / 32).ToString(); if (ltr1.Text == "0") { span1.Style["width"] = (1 * 128 / 100).ToString() + "px"; ltr1.Text = "1"; } if (hongxing && int.Parse(ltr1.Text) >= 70) { ltr1.Text = (int.Parse(ltr1.Text) - 15).ToString(); span1.Style["width"] = (int.Parse(ltr1.Text) * 128 / 100).ToString() + "px"; } if (int.Parse(ltr1.Text) > 100) { span1.Style["width"] = "128px"; ltr1.Text = "100"; } ViewState["fumian"] = showele; ////Label1.Text += "5.泡泡:" + showele["paopao"] + "; 虫子:" + showele["chongzi"] + "; 醋:" + showele["cu"] + "; 裂痕:" + showele["liehen"] + "; 冰冻:" + showele["bingdong"] + "; 折枝:" + showele["zhezhi"] + "; 枯叶:" + showele["kuye"] + "<br />"; #endregion #region 花盆 int huapen = 1; if (totalbad >= 20) { huapen = 3; } else if ((totalbad >= 13 && totalbad < 20) || (hongxing && totalbad > 6)) { huapen = 2; } //Label1.Text += "5.花盆为:" + huapen + "<br />"; jsstr += "showItem('huapen', " + huapen + ");"; #endregion #region 花心指数 int flowercount = 0; foreach (PublicValue.AstroStar tmpstar in goodstars) { if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar])) { flowercount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Chi], m_star[tmpstar])) { flowercount++; } foreach (PublicValue.AstroStar tmpstarr in eight) { if (tmpstar != tmpstarr && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstarr], m_star[tmpstar])) { flowercount++; } } } if(m_star[PublicValue.AstroStar.Moo].Constellation==PublicValue.Constellation.Gem || m_star[PublicValue.AstroStar.Moo].Constellation==PublicValue.Constellation.Sag || m_star[PublicValue.AstroStar.Moo].Constellation==PublicValue.Constellation.Pis ) { flowercount++; } if (m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Gem || m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Sag || m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Pis) { flowercount++; } if (m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Gem || m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Sag || m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Pis) { flowercount++; } if (m_star[PublicValue.AstroStar.Moo].Gong == 12 ) { flowercount++; } if (m_star[PublicValue.AstroStar.Ven].Gong == 12) { flowercount++; } if (PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Sun].Constellation) == PublicValue.Element.wind && PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Moo].Constellation) == PublicValue.Element.earth) { flowercount++; } if (PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Sun].Constellation) == PublicValue.Element.fire && PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Moo].Constellation) == PublicValue.Element.wind) { flowercount++; } if (m_astro.Gender == AppEnum.Gender.male) { flowercount++; } span3.Style["width"] = (flowercount * 128 / 10).ToString() + "px"; ltr3.Text = (flowercount * 100 / 10).ToString(); if (ltr3.Text == "0") { span3.Style["width"] = (1 * 128 / 100).ToString() + "px"; ltr3.Text = "1"; } if (int.Parse(ltr3.Text) > 100) { span3.Style["width"] = "128px"; ltr3.Text = "100"; } //Label1.Text += "5.花心指数为:" + flowercount + "<br />"; #endregion #region 魅力指数 int meilicount = beecount; if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Ura], m_star[PublicValue.AstroStar.For])) { meilicount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Ura], m_star[PublicValue.AstroStar.Ven])) { meilicount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[PublicValue.AstroStar.Ven])) { meilicount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Sun], m_star[PublicValue.AstroStar.Jup])) { meilicount++; } span2.Style["width"] = (meilicount * 128 / 12).ToString() + "px"; ltr2.Text = (meilicount * 100 / 12).ToString(); if (ltr2.Text == "0") { span2.Style["width"] = (1 * 128 / 100).ToString() + "px"; ltr2.Text = "1"; } if (int.Parse(ltr2.Text) > 100) { span2.Style["width"] = "128px"; ltr2.Text = "100"; } #endregion #region 对方有钱 int richcount = PublicDeal.GetInstance().GetGongPower(m_astro.Stars, 8); if (richcount > 15) { richcount = 15; } foreach (PublicValue.AstroStar tmpstar in seven) { if (m_star[tmpstar].Gong == 8||m_star[tmpstar].Gong == 7) { richcount = richcount + 5; } } foreach (PublicValue.AstroStar tmpstar in eight) { if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar])) { richcount=richcount+5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } } foreach (PublicValue.AstroStar tmpstar in two) { if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } } if (m_star[PublicValue.AstroStar.Jun].Gong==11) { richcount = richcount + 5; } if (m_star[PublicValue.AstroStar.Ura].Gong==8) { richcount = richcount + 5; } span4.Style["width"] = (richcount * 128 / 30).ToString() + "px"; ltr4.Text = (richcount * 100 / 30).ToString(); if (ltr4.Text == "0") { span4.Style["width"] = (1 * 128 / 100).ToString() + "px"; ltr4.Text = "1"; } if (int.Parse(ltr4.Text) > 100) { span4.Style["width"] = "128px"; ltr4.Text = "100"; } //Label1.Text += "6.对方有钱指数为:" + richcount + "<br />"; //测试显示互溶关系 List<List<PublicValue.AstroStar>> hurong = PublicDeal.GetInstance().GetHuRong(m_astro.Stars, true); foreach (List<PublicValue.AstroStar> tmplist in hurong) { foreach (PublicValue.AstroStar tmpstar in tmplist) { //Label1.Text += PublicValue.GetAstroStar(tmpstar) + "->"; } //Label1.Text += "<br />"; } #endregion jsstr += @"$("".f-box"").children(""div:not(0)"").children(""div"").each(function () { if (!$(this).is(':has(a)')&&$(this).attr(""id"")!='nohover') { $(this).bind(""mouseenter"", function () { $(this).css(""cursor"", ""pointer"") var bgimg = $(this).css(""background-image""); bgimg = bgimg.replace("".png"", ""_on.png""); $(this).css(""background-image"", bgimg); }).bind(""mouseleave"", function () { $(this).attr(""style"", "" ""); $(this).css(""display"", ""block""); }) } else { //蜜蜂等区域热点 $(this).children(""a"").bind(""mouseenter"", function () { var bgimg = $(this).parent().css(""background-image""); bgimg = bgimg.replace("".png"", ""_on.png""); $(this).parent().css(""background-image"", bgimg); }).bind(""mouseleave"", function () { $(this).parent().attr(""style"", "" ""); $(this).parent().css(""display"", ""block""); }) } })"; ScriptManager.RegisterStartupScript(Page, this.GetType(), "show", jsstr, true); tip.Style["display"] = "none"; ViewState["jsstr"] = jsstr; MultiView1.ActiveViewIndex = 1; //Page.ClientScript.RegisterStartupScript(this.GetType(), "showflash", // @"swfobject.embedSWF('LoveRose.swf', 'flashmov', '816', '459', '9.0.0',null,{ele:'"+ele+"'});",true); #region 记录用户数据 LoveRoseMod m_record = new LoveRoseMod(); m_record.Area = int.Parse(HiddenField2.Value); m_record.BirthTime = m_astro.birth; m_record.Source = (int)AppEnum.AppsSourceType.qq; m_record.TS = DateTime.Now; LoveRoseBll.GetInstance().Add(m_record); #endregion #region 显示信息 ltrInfo.Text = m_astro.birth.ToString("yyyy年MM月dd日 HH:mm") + @" <br /> 性别:"+AppEnum.GetGender(m_astro.Gender)+@"<br /> 所属时区: " + (m_astro.zone > 0 ? "西" + m_astro.zone.ToString() : "东" + m_astro.zone.ToString()) + @"区<br /> 夏令时:" + (((int)m_astro.IsDayLight) == 1 ? "是" : "否") + @" <br /> 出生地: " + m_astro.position.name.Remove(m_astro.position.name.LastIndexOf("-")) + @" <br /> (经度" + m_astro.position.Lng + @" 纬度" + m_astro.position.Lat + @") <br />"; #endregion HyperLink1.NavigateUrl = "http://share.v.t.qq.com/index.php?c=share&a=index&url=" + Server.UrlEncode("http://astro.fashion.qq.com/app/aiqinghua.htm") + "&pic=" + Server.UrlEncode("../WebResources/Images/LoveRose/img/share" + ViewState["hua"].ToString() + ".jpg") + "&appkey=801402959&title=" + Server.UrlEncode("#腾讯星座爱情花# " + AppCmn.CommonTools.CutStr(content[int.Parse(ViewState["hua"].ToString()) - 1, 0], 50) + " 嘿嘿~这是我的爱情花!我的爱情婚姻原来是这样的。挺有意思,你也来玩玩吧!") + "&line1=&line2=&line3="; }
/// <summary> /// 根据ID获取星盘参数 /// </summary> /// <param name="GraphicID"></param> public void GetParamters(ref AstroMod mod) { mod.graphicID = SetGraphicID(mod); if (mod.graphicID == "") { return ; } string argument = mod.graphicID.Replace("_", " ").Replace(";", ":"); string tmpname = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + CommonTools.GetRandomString(5); argument += " -o0 " + tmpname;//输出 argument = argument.Replace("file1", mod.composeFile1); argument = argument.Replace("file2", mod.composeFile2); //try //{ string[] args = argument.Split(new char[] { '$' }); for (int i = 0; i < args.Length; i++) { RunAstrolog(args[i]); } //生成临时参数文件 SetParas(ref mod, tmpname); //删除排盘临时文件 if (mod.composeFile1 != "") { File.Delete(mod.composeFile1); } if (mod.composeFile2 != "") { File.Delete(mod.composeFile2); } //} //catch (Exception ex) //{ // LogManagement.getInstance().WriteException(ex, "PPLive.Astro", ""); // return; //} }
/// <summary> /// 排合盘 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton1_Click(object sender, EventArgs e) { m_astro = (AstroMod)ViewState["NowChart"]; m_astro.type = PublicValue.AstroType.hepan; m_astro.compose = (PublicValue.AstroZuhe)int.Parse(drpCompareType.SelectedValue); m_astro.birth1 = DatePicker2.SelectedTime; m_astro.position1 = new LatLng(SYS_DistrictBll.GetInstance().GetModel(District2.Area3SysNo)); if (chkDaylight2.Checked) { m_astro.IsDayLight1 = AppEnum.BOOL.True; } else { m_astro.IsDayLight1 = AppEnum.BOOL.False; } m_astro.zone1 = int.Parse(drpTimeZone2.SelectedValue); SetPara(); InitialFate(); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "hepan", "document.getElementById('" + pnlHePan.ClientID + "').click();", true); }
/// <summary> /// 根据命盘实体返回ID /// </summary> /// <param name="mod"></param> /// <returns></returns> public string SetGraphicID(AstroMod mod) { string argument = SetAstrologArgument(mod); return argument.Replace(" ", "_").Replace(":", ";"); }
/// <summary> /// 返回原盘 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton2_Click(object sender, EventArgs e) { m_astro = (AstroMod)ViewState["OriginalChart"]; ViewState["NowChart"] = m_astro; SetPara(); InitialFate(); }
/// <summary> /// 根据命盘实体返回Astrolog参数 /// </summary> /// <param name="mod"></param> /// <returns></returns> private string SetAstrologArgument(AstroMod mod) { string argument = ""; if (mod.type == PublicValue.AstroType.benming) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; } else if (mod.type == PublicValue.AstroType.hepan) { mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -o file1"; argument += "$-qb " + mod.birth1.Month + " " + mod.birth1.Day + " " + mod.birth1.Year + " " + mod.birth1.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight1 + " " + mod.zone1 + " " + mod.position1.Lng + " " + mod.position1.Lat; argument += " -o file2"; if (mod.compose == PublicValue.AstroZuhe.bijiao) { argument += "$-r0 file1 file2"; } else if (mod.compose == PublicValue.AstroZuhe.zuhe) { argument += "$-rc file1 file2"; } else if (mod.compose == PublicValue.AstroZuhe.shikong) { argument += "$-rm file1 file2"; } else if (mod.compose == PublicValue.AstroZuhe.hebing) { argument += "$-r file1 file2"; } } else if (mod.type == PublicValue.AstroType.tuiyun) { if (mod.transit == PublicValue.AstroTuiyun.xingyun) { mod.composeFile1 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); mod.composeFile2 = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\C" + CommonTools.GetRandomString(4); argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -o file1"; argument += "$-qb " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year + " " + mod.transitTime.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.transitPosition.Lng + " " + mod.transitPosition.Lat; argument += " -o file2"; argument += "$-r0 file1 file2"; } else if (mod.transit == PublicValue.AstroTuiyun.cixian) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -pd 365.25636 -p " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } else if (mod.transit == PublicValue.AstroTuiyun.sanxian) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -pd 29.530588 -p " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } else if (mod.transit == PublicValue.AstroTuiyun.sanxian1) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -pd 27.321582 -p " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } else if (mod.transit == PublicValue.AstroTuiyun.rifanzhao) { string file = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\R" + CommonTools.GetRandomString(5); DateTime lastbirth = mod.birth; for (int i = 1; i > 0; i++) { if (lastbirth.AddYears(1) > mod.transitTime) { break; } lastbirth = lastbirth.AddYears(1); } //DateTime tmpbirth = mod.birth.AddHours(-mod.zone); string tmparg = "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " 0 " + mod.position.Lng + " " + mod.position.Lat; tmparg += " -tY " + lastbirth.AddYears(-1).Year + " 3 -R0 sun -RT0 sun > " + file; RunAstrolog(tmparg); #region 分析文件 if (!File.Exists(file)) { return null; } StreamReader smRead = new StreamReader(file, System.Text.Encoding.Default); string line; while ((line = smRead.ReadLine()) != null) { if (line.Contains("Solar Return")) { TimeSpan tmp = new DateTime(int.Parse(line.Substring(6,4)),int.Parse(line.Substring(0,2)),int.Parse(line.Substring(3,2)))- lastbirth; if (tmp.Days < 5&& tmp.Days>-5) { break; } } } smRead.Dispose(); #endregion DateTime returndate = new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2)), int.Parse(line.Substring(11, 2)), int.Parse(line.Substring(14, 2)), 0); if (line.Contains("pm")) { returndate = returndate.AddHours(12); } argument += "-qb " + returndate.Month + " " + returndate.Day + " " + returndate.Year + " " + returndate.ToString("HH:mm:ss") + " 0 " + mod.zone + " " + mod.transitPosition.Lng + " " + mod.transitPosition.Lat; File.Delete(file); } else if (mod.transit == PublicValue.AstroTuiyun.yuefanzhao) { string file = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\R" + CommonTools.GetRandomString(5); DateTime lastbirth = mod.birth; for (int i = 1; i > 0; i++) { if (lastbirth.AddYears(1) > mod.transitTime) { break; } lastbirth = lastbirth.AddYears(1); } string tmparg = "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " 0 " + mod.position.Lng + " " + mod.position.Lat; tmparg += " -tY " + lastbirth.AddYears(-1).Year + " 3 -R0 moon -RT0 moon > " + file; RunAstrolog(tmparg); #region 分析文件 if (!File.Exists(file)) { return null; } StreamReader smRead = new StreamReader(file, System.Text.Encoding.Default); string line; DateTime returndate = AppConst.DateTimeNull; while ((line = smRead.ReadLine()) != null) { if (line.Contains("Lunar Return")) { if (returndate != AppConst.DateTimeNull && new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2)), int.Parse(line.Substring(11, 2)), int.Parse(line.Substring(14, 2)), 0) > mod.transitTime) { break; } returndate = new DateTime(int.Parse(line.Substring(6, 4)), int.Parse(line.Substring(0, 2)), int.Parse(line.Substring(3, 2)), int.Parse(line.Substring(11, 2)), int.Parse(line.Substring(14, 2)), 0); } } smRead.Dispose(); #endregion if (line.Contains("pm")) { returndate = returndate.AddHours(12); } argument += "-qb " + returndate.Month + " " + returndate.Day + " " + returndate.Year + " " + returndate.ToString("HH:mm:ss") + " 0 " + mod.zone + " " + mod.transitPosition.Lng + " " + mod.transitPosition.Lat; File.Delete(file); } else if (mod.transit == PublicValue.AstroTuiyun.taiyanghu) { argument += "-qb " + mod.birth.Month + " " + mod.birth.Day + " " + mod.birth.Year + " " + mod.birth.ToString("HH:mm:ss") + " " + (int)mod.IsDayLight + " " + mod.zone + " " + mod.position.Lng + " " + mod.position.Lat; argument += " -p0 " + mod.transitTime.Month + " " + mod.transitTime.Day + " " + mod.transitTime.Year; } } argument += " -c " + mod.houseSystem;//分宫法 #region 容许度 argument += " -YAo 1 5"; foreach (int key in mod.aspectsShow.Keys) { argument += " " + mod.aspectsShow[key].ToString("0"); } #endregion #region 星体显示 argument += " -R0"; foreach (int key in mod.startsShow.Keys) { argument += " " + key; } #endregion //argument += " -Xr";//反白 //argument += " -Xw 400 400";//设置输出尺寸 return argument; }
/// <summary> /// 推运盘 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton3_Click(object sender, EventArgs e) { m_astro = (AstroMod)ViewState["NowChart"]; m_astro.type = PublicValue.AstroType.tuiyun; m_astro.transitTime = DatePickert1.SelectedTime; m_astro.transitPosition = m_astro.position; m_astro.position1 = m_astro.position; m_astro.transit = (PublicValue.AstroTuiyun)int.Parse(drpProgressType.SelectedValue); SetPara(); InitialFate(); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "tuiyun", "document.getElementById('" + pnlTuiYun.ClientID + "').click();", true); }
protected void Unnamed10_Click(object sender, EventArgs e) { AstroMod m_astro = new AstroMod(); #region 设置实体各种参数 m_astro.birth = new DateTime(int.Parse(drpYear.SelectedValue),int.Parse(drpMonth.SelectedValue),int.Parse(drpDay.SelectedValue), int.Parse(drpHour.SelectedValue),int.Parse(drpMinute.SelectedValue),0); m_astro.position = new LatLng(SYS_DistrictBll.GetInstance().GetModel(int.Parse(drpDistrict3.SelectedValue))); if (chkDaylight.Checked) { m_astro.IsDaylight = AppEnum.BOOL.True; } else { m_astro.IsDaylight = AppEnum.BOOL.False; } m_astro.houseSystem = int.Parse(drpSOH.SelectedValue); m_astro.startsShow.Clear(); for(int i=0;i<chkStar.Items.Count;i++) { if (chkStar.Items[i].Selected) { m_astro.startsShow.Add(int.Parse(chkStar.Items[i].Value), chkStar.Items[i].Text); } } try { m_astro.aspectsShow.Clear(); if (chkAspect1.Checked) { m_astro.aspectsShow.Add(1, decimal.Parse(txtAspect1.Text)); } else { m_astro.aspectsShow.Add(1, -1); } if (chkAspect2.Checked) { m_astro.aspectsShow.Add(2, decimal.Parse(txtAspect2.Text)); } else { m_astro.aspectsShow.Add(2, -1); } if (chkAspect3.Checked) { m_astro.aspectsShow.Add(4, decimal.Parse(txtAspect3.Text)); } else { m_astro.aspectsShow.Add(4, -1); } if (chkAspect4.Checked) { m_astro.aspectsShow.Add(3, decimal.Parse(txtAspect4.Text)); } else { m_astro.aspectsShow.Add(3, -1); } if (chkAspect5.Checked) { m_astro.aspectsShow.Add(5, decimal.Parse(txtAspect5.Text)); } else { m_astro.aspectsShow.Add(5, -1); } } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('输入容许度格式有误');", true); } #endregion //生成ID并访问图片页 Image1.ImageUrl = "AstroChart.aspx?ID=" + AstroBiz.GetInstance().SetGraphicID(m_astro) + "&fa="+ m_astro.composeFile1.Replace(AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\","") + "&fb=" + m_astro.composeFile2.Replace(AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\", ""); Image1.Visible = true; }
/// <summary> /// 生时校正 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void LinkButton4_Click(object sender, EventArgs e) { m_astro = (AstroMod)ViewState["OriginalChart"]; m_astro.birth = DatePickert3.SelectedTime; ViewState["NowChart"] = m_astro; SetPara(); InitialFate(); DatePickert3.SelectedTime = m_astro.birth; Page_Load(sender, e); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "jiaozheng", "document.getElementById('" + pnlJiaoZheng.ClientID + "').click();", true); }
protected void Button1_Click(object sender, EventArgs e) { DateTime now = DatePicker1.SelectedTime; Dictionary<string, SortedDictionary<int, int>> result = new Dictionary<string, SortedDictionary<int, int>>(); int count = 0; for (DateTime tmpnow = now; tmpnow < now.AddYears(1); tmpnow = tmpnow.AddHours(1)) { #region 计算 AstroMod m_astro = new AstroMod(); m_astro.type = PublicValue.AstroType.benming; #region 设置实体各种参数 m_astro.birth = tmpnow; m_astro.position = new LatLng(SYS_DistrictBll.GetInstance().GetModel(1)); //if (chkDaylight1.Checked) //{ // m_astro.IsDayLight = AppEnum.BOOL.True; //} //else //{ // m_astro.IsDayLight = AppEnum.BOOL.False; //} m_astro.IsDayLight = AppEnum.BOOL.False; m_astro.zone = -8; for (int i = 1; i < 21; i++) { m_astro.startsShow.Add(i, ""); } m_astro.aspectsShow.Clear(); for (int i = 1; i < 6; i++) { m_astro.aspectsShow.Add(i, 5); } #endregion AstroBiz.GetInstance().GetParamters(ref m_astro); Dictionary<PublicValue.AstroStar, Star> m_star = new Dictionary<PublicValue.AstroStar, Star>(); foreach (Star tmpstar in m_astro.Stars) { m_star.Add(tmpstar.StarName, tmpstar); } string jsstr = ""; //吉星 List<PublicValue.AstroStar> goodstars = new List<PublicValue.AstroStar>(); goodstars.Add(PublicValue.AstroStar.Jup); goodstars.Add(PublicValue.AstroStar.Ven); //凶星 Dictionary<PublicValue.AstroStar, int> badstars = new Dictionary<PublicValue.AstroStar, int>(); List<PublicValue.AstroStar> tmpbad = new List<PublicValue.AstroStar>(); tmpbad.Add(PublicValue.AstroStar.Mar); tmpbad.Add(PublicValue.AstroStar.Sat); tmpbad.Add(PublicValue.AstroStar.Ura); tmpbad.Add(PublicValue.AstroStar.Nep); tmpbad.Add(PublicValue.AstroStar.Plu); List<PublicValue.AstroStar> twelve = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 12, false); List<PublicValue.AstroStar> eight = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 8, false); List<PublicValue.AstroStar> seven = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false); List<PublicValue.AstroStar> two = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 2, false); foreach (PublicValue.AstroStar tmp in tmpbad) { badstars.Add(tmp, 1); } foreach (PublicValue.AstroStar tmp in eight) { if (!tmpbad.Contains(tmp)) { if (!badstars.ContainsKey(tmp)) badstars.Add(tmp, 1); } else { badstars[tmp]++; } } foreach (PublicValue.AstroStar tmp in twelve) { if (!tmpbad.Contains(tmp)) { if (!badstars.ContainsKey(tmp)) badstars.Add(tmp, 1); } else { badstars[tmp]++; } } List<PublicValue.AstroStar> mingzhu = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 1, false); foreach (PublicValue.AstroStar tmp in mingzhu) { if (!tmpbad.Contains(tmp)) { if (!badstars.ContainsKey(tmp)) badstars.Add(tmp, 1); } else { badstars[tmp]++; } } #region 红杏 bool hongxing = false; if (PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.he, AppConst.DecimalNull) || PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.chong, AppConst.DecimalNull) || PublicDeal.GetInstance().HasPhase(m_star[PublicValue.AstroStar.Ven], m_star[PublicValue.AstroStar.Jun], PublicValue.Phase.xing, AppConst.DecimalNull)) { hongxing = true; } if (!result.ContainsKey("红杏")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); tmpdic.Add(0, 0); tmpdic.Add(1, 0); result.Add("红杏", tmpdic); } if (!hongxing) { result["红杏"][0]++; } else { result["红杏"][1]++; } #endregion #region 蜜蜂 int beecount = 0; List<PublicValue.AstroStar> beestars = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false); beestars.Add(PublicValue.AstroStar.Des); beestars.Add(PublicValue.AstroStar.Jun); foreach (PublicValue.AstroStar tmpstar in beestars) { int tmpflag = 0; if (tmpstar != goodstars[0] && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstar], m_star[goodstars[0]])) { beecount++; tmpflag = 1; } if (tmpstar != goodstars[1] && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstar], m_star[goodstars[1]])) { beecount++; if (tmpflag == 1) { beecount++; } } } if (!result.ContainsKey("蜜蜂")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("蜜蜂", tmpdic); } if (!result["蜜蜂"].ContainsKey(beecount)) { result["蜜蜂"].Add(beecount, 0); } result["蜜蜂"][beecount]++; #endregion #region 花盆 #endregion #region 负面 Dictionary<string, int> showele = new Dictionary<string, int>(); showele.Add("paopao", 0); showele.Add("chongzi", 0); showele.Add("cu", 0); showele.Add("liehen", 0); showele.Add("bingdong", 0); showele.Add("zhezhi", 0); showele.Add("kuye", 0); List<PublicValue.AstroStar> breakstars = PublicDeal.GetInstance().GetGongMasters(m_astro.Stars, 7, false); breakstars.Add(PublicValue.AstroStar.Ven); breakstars.Add(PublicValue.AstroStar.Jun); breakstars.Add(PublicValue.AstroStar.Des); breakstars = breakstars.Distinct().ToList(); foreach (PublicValue.AstroStar tmp in badstars.Keys) { //if (tmp != goodstars[0]) // continue; int tmpflag = 0; for (int i = 0; i < breakstars.Count; i++) { if (PublicDeal.GetInstance().HasAnyBadPhase(m_star[tmp], m_star[breakstars[i]])) { bool Exact = false; if (PublicDeal.GetInstance().HasAnyBadPhase(m_star[tmp], m_star[breakstars[i]], 1)) { Exact = true; } switch (tmp) { case PublicValue.AstroStar.Mar: case PublicValue.AstroStar.Sun: showele["zhezhi"] += badstars[tmp]; if (Exact) showele["zhezhi"]++; break; case PublicValue.AstroStar.Jup: case PublicValue.AstroStar.Ven: showele["kuye"] += badstars[tmp]; if (Exact) showele["kuye"]++; break; case PublicValue.AstroStar.Sat: showele["liehen"] += badstars[tmp]; if (Exact) showele["liehen"]++; break; case PublicValue.AstroStar.Ura: showele["bingdong"] += badstars[tmp]; if (Exact) showele["bingdong"]++; break; case PublicValue.AstroStar.Nep: showele["paopao"] += badstars[tmp]; if (Exact) showele["paopao"]++; break; case PublicValue.AstroStar.Plu: case PublicValue.AstroStar.Moo: showele["cu"] += badstars[tmp]; if (Exact) showele["cu"]++; break; case PublicValue.AstroStar.Mer: showele["chongzi"] += badstars[tmp]; if (Exact) showele["chongzi"]++; break; } tmpflag++; if (tmpflag > 1) { switch (tmp) { case PublicValue.AstroStar.Mar: case PublicValue.AstroStar.Sun: showele["zhezhi"]++; break; case PublicValue.AstroStar.Jup: case PublicValue.AstroStar.Ven: showele["kuye"]++; break; case PublicValue.AstroStar.Sat: showele["liehen"]++; break; case PublicValue.AstroStar.Ura: showele["bingdong"]++; break; case PublicValue.AstroStar.Nep: showele["paopao"]++; break; case PublicValue.AstroStar.Plu: case PublicValue.AstroStar.Moo: showele["cu"]++; break; case PublicValue.AstroStar.Mer: showele["chongzi"]++; break; } } } } } if (!result.ContainsKey("泡泡")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("泡泡", tmpdic); } if (!result["泡泡"].ContainsKey(showele["paopao"])) { result["泡泡"].Add(showele["paopao"], 0); } result["泡泡"][showele["paopao"]]++; if (!result.ContainsKey("虫子")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("虫子", tmpdic); } if (!result["虫子"].ContainsKey(showele["chongzi"])) { result["虫子"].Add(showele["chongzi"], 0); } result["虫子"][showele["chongzi"]]++; if (!result.ContainsKey("醋")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("醋", tmpdic); } if (!result["醋"].ContainsKey(showele["cu"])) { result["醋"].Add(showele["cu"], 0); } result["醋"][showele["cu"]]++; if (!result.ContainsKey("裂痕")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("裂痕", tmpdic); } if (!result["裂痕"].ContainsKey(showele["liehen"])) { result["裂痕"].Add(showele["liehen"], 0); } result["裂痕"][showele["liehen"]]++; if (!result.ContainsKey("冰冻")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("冰冻", tmpdic); } if (!result["冰冻"].ContainsKey(showele["bingdong"])) { result["冰冻"].Add(showele["bingdong"], 0); } result["冰冻"][showele["bingdong"]]++; if (!result.ContainsKey("折枝")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("折枝", tmpdic); } if (!result["折枝"].ContainsKey(showele["zhezhi"])) { result["折枝"].Add(showele["zhezhi"], 0); } result["折枝"][showele["zhezhi"]]++; if (!result.ContainsKey("枯叶")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("枯叶", tmpdic); } if (!result["枯叶"].ContainsKey(showele["kuye"])) { result["枯叶"].Add(showele["kuye"], 0); } result["枯叶"][showele["kuye"]]++; if (!result.ContainsKey("总负面")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("总负面", tmpdic); } int tmpbadd = showele["paopao"] + showele["chongzi"] + showele["cu"] + showele["liehen"] + showele["bingdong"] + showele["zhezhi"] + showele["kuye"]; if (!result["总负面"].ContainsKey(tmpbadd)) { result["总负面"].Add(tmpbadd, 0); } result["总负面"][tmpbadd]++; #endregion #region 花心指数 int flowercount = 0; foreach (PublicValue.AstroStar tmpstar in goodstars) { if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar])) { flowercount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Chi], m_star[tmpstar])) { flowercount++; } foreach (PublicValue.AstroStar tmpstarr in eight) { if (tmpstar != tmpstarr && PublicDeal.GetInstance().HasAnyMainPhase(m_star[tmpstarr], m_star[tmpstar])) { flowercount++; } } } if (m_star[PublicValue.AstroStar.Moo].Constellation == PublicValue.Constellation.Gem || m_star[PublicValue.AstroStar.Moo].Constellation == PublicValue.Constellation.Sag || m_star[PublicValue.AstroStar.Moo].Constellation == PublicValue.Constellation.Pis) { flowercount++; } if (m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Gem || m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Sag || m_star[PublicValue.AstroStar.Ven].Constellation == PublicValue.Constellation.Pis) { flowercount++; } if (m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Gem || m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Sag || m_star[PublicValue.AstroStar.Des].Constellation == PublicValue.Constellation.Pis) { flowercount++; } if (m_star[PublicValue.AstroStar.Moo].Gong == 12) { flowercount++; } if (m_star[PublicValue.AstroStar.Ven].Gong == 12) { flowercount++; } if (PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Sun].Constellation) == PublicValue.Element.wind && PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Moo].Constellation) == PublicValue.Element.earth) { flowercount++; } if (PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Sun].Constellation) == PublicValue.Element.fire && PublicDeal.GetInstance().GetConstellationElement(m_star[PublicValue.AstroStar.Moo].Constellation) == PublicValue.Element.wind) { flowercount++; } if (m_astro.Gender == AppEnum.Gender.male) { flowercount++; } if (!result.ContainsKey("花心")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("花心", tmpdic); } if (!result["花心"].ContainsKey(flowercount)) { result["花心"].Add(flowercount, 0); } result["花心"][flowercount]++; #endregion #region 魅力指数 int meilicount = beecount; if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Ura], m_star[PublicValue.AstroStar.For])) { meilicount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Ura], m_star[PublicValue.AstroStar.Ven])) { meilicount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[PublicValue.AstroStar.Ven])) { meilicount++; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Sun], m_star[PublicValue.AstroStar.Jup])) { meilicount++; } if (!result.ContainsKey("魅力")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("魅力", tmpdic); } if (!result["魅力"].ContainsKey(meilicount)) { result["魅力"].Add(meilicount, 0); } result["魅力"][meilicount]++; #endregion #region 对方有钱 int richcount = PublicDeal.GetInstance().GetGongPower(m_astro.Stars, 8); if (richcount > 15) { richcount = 15; } foreach (PublicValue.AstroStar tmpstar in seven) { if (m_star[tmpstar].Gong == 8 || m_star[tmpstar].Gong == 7) { richcount = richcount + 5; } } foreach (PublicValue.AstroStar tmpstar in eight) { if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } } foreach (PublicValue.AstroStar tmpstar in two) { if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.For], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } if (PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[tmpstar]) && PublicDeal.GetInstance().HasAnyMainPhase(m_star[PublicValue.AstroStar.Jun], m_star[PublicValue.AstroStar.For])) { richcount = richcount + 5; } } if (m_star[PublicValue.AstroStar.Jun].Gong == 11) { richcount = richcount + 5; } if (m_star[PublicValue.AstroStar.Ura].Gong == 8) { richcount = richcount + 5; } if (richcount >= 60) { Label1.Text += m_astro.birth.ToString("yyyy-MM-dd HH:mm:ss") + "<br />"; //return; } List<List<PublicValue.AstroStar>> hurong = PublicDeal.GetInstance().GetHuRong(m_astro.Stars, true); ; if (!result.ContainsKey("对方有钱")) { SortedDictionary<int, int> tmpdic = new SortedDictionary<int, int>(); result.Add("对方有钱", tmpdic); } if (!result["对方有钱"].ContainsKey(richcount)) { result["对方有钱"].Add(richcount, 0); } result["对方有钱"][richcount]++; #endregion #endregion count++; } #region 打印 Label1.Text += now.ToString("yyyy-MM-dd") + "至" + DatePicker1.SelectedTime.ToString("yyyy-MM-dd") + "<br />"; foreach (KeyValuePair<string, SortedDictionary<int, int>> s in result) { Label1.Text += s.Key + ":<br />"; foreach (KeyValuePair<int, int> ss in s.Value) { Label1.Text += ss.Key + ":" + ss.Value + "个<br />"; } } #endregion }
protected void LinkButton7_Click(object sender, EventArgs e) { m_astro = (AstroMod)ViewState["NowChart"]; SetPara(); InitialFate(); if (m_astro.type == PublicValue.AstroType.tuiyun) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "tuiyun", "document.getElementById('" + pnlTuiYun.ClientID + "').click();", true); } else if (m_astro.type == PublicValue.AstroType.hepan) { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "hepan", "document.getElementById('" + pnlHePan.ClientID + "').click();", true); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "jiaozhengqian", "document.getElementById('" + pnlJiaoZheng.ClientID + "').click();", true); } }