public FATE_ChartMod GetChartByQuest(int SysNo) { int fatesysno = 0; using (SQLData data = new SQLData()) { StringBuilder builder = new StringBuilder(); builder.Append(@"select Chart_SysNo from REL_Question_Chart where Question_SysNo=").Append(SysNo); try { fatesysno = Convert.ToInt32(data.CmdtoDataTable(builder.ToString()).Rows[0]["Chart_SysNo"]); } catch (Exception exception) { return(null); } } return(FATE_ChartBll.GetInstance().GetModel(fatesysno)); }
protected void Unnamed3_Click(object sender, EventArgs e) { Login(Request.Url.ToString()); #region 判断输入项 if (drpCate.SelectedIndex == 0) { CateTip.InnerHtml = "请选择分类"; CateTip.Attributes["class"] = "err"; Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true); return; } if (txtTitle.Text.Trim() == "") { TitleTip.InnerHtml = "请输入标题"; TitleTip.Attributes["class"] = "err"; Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true); return; } if (txtTitle.Text.Trim().Length > 200) { TitleTip.InnerHtml = "您输入的标题太长,请控制在200字以内"; TitleTip.Attributes["class"] = "err"; Page.ClientScript.RegisterStartupScript(this.GetType(), "typemodify", "qaTypeChanged(document.getElementById('" + drpType.ClientID + "'));", true); return; } #endregion try { QA_QuestionMod m_quest = new QA_QuestionMod(); m_quest.Award = 0; m_quest.CateSysNo = int.Parse(drpCate.SelectedValue); m_quest.Context = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(txtContext.Text.Trim())); m_quest.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_quest.LastReplyTime = DateTime.Now; m_quest.ReplyCount = 0; m_quest.ReadCount = 0; m_quest.BuyCount = 0; m_quest.OrderCount = 0; m_quest.Title = AppCmn.CommonTools.SystemInputFilter(txtTitle.Text.Trim()); m_quest.TS = DateTime.Now; m_quest.DR = (int)AppEnum.State.normal; int sysno = 0; QA_QuestionBll.GetInstance().AddQuest(ref m_quest, false); sysno = m_quest.SysNo; RefreshSession(); FATE_ChartMod m_chart = new FATE_ChartMod(); m_chart.CharType = int.Parse(drpType.SelectedValue); if (m_chart.CharType != (int)AppEnum.ChartType.nochart) { m_chart.FirstBirth = DatePicker1.SelectedTime; m_chart.FirstPoi = District1.lng + "|" + District1.lat; m_chart.Transit = DateTime.Now; m_chart.TransitPoi = m_chart.FirstPoi; m_chart.TheoryType = 0; m_chart.FirstPoiName = District1.Area1Name + "-" + District1.Area2Name + "-" + District1.Area3Name; m_chart.FirstTimeZone = -8; m_chart.FirstGender = int.Parse(drpGender1.SelectedValue); if (chkDaylight1.Checked) { m_chart.FirstDayLight = (int)AppEnum.BOOL.True; } else { m_chart.FirstDayLight = (int)AppEnum.BOOL.False; } if (m_chart.CharType == (int)AppEnum.ChartType.relation) { m_chart.SecondBirth = DatePicker2.SelectedTime; m_chart.SecondPoi = District2.lng + "|" + District2.lat; m_chart.SecondPoiName = District2.Area1Name + "-" + District2.Area2Name + "-" + District2.Area3Name; m_chart.SecondTimeZone = -8; m_chart.SecondGender = int.Parse(drpGender2.SelectedValue); if (chkDaylight2.Checked) { m_chart.SecondDayLight = (int)AppEnum.BOOL.True; } else { m_chart.SecondDayLight = (int)AppEnum.BOOL.False; } } m_chart.TS = DateTime.Now; m_chart.DR = (int)AppEnum.State.normal; int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart); REL_Question_ChartMod m_qchart = new REL_Question_ChartMod(); m_qchart.Chart_SysNo = fatesysno; m_qchart.Question_SysNo = sysno; REL_Question_ChartBll.GetInstance().Add(m_qchart); } LogManagement.getInstance().WriteTrace("前台话题", "Ask", "IP:" + Request.UserHostAddress + "|UID:" + GetSession().CustomerEntity.Email); Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('话题发布成功!');", true); Response.Redirect(AppConfig.HomeUrl() + "Quest/Topic/" + sysno, false); } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "QA-Add", Request.UserHostAddress, "发布话题失败"); Page.ClientScript.RegisterStartupScript(this.GetType(), "askok", "alert('系统故障,请联系管理员!');", true); } }
protected void AddCollection(object sender, EventArgs e) { int addsysno = 0; BLG_CollectionMod m_collection = new BLG_CollectionMod(); try { switch (type) { case (int)AppCmn.AppEnum.CollectionType.quest: if (Request.QueryString["sysno"] == null) { Response.Redirect("../Error.aspx?msg="); } try { addsysno = int.Parse(Request.QueryString["sysno"]); } catch { Response.Redirect("../Error.aspx?msg="); } m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_collection.DR = (int)AppEnum.State.normal; m_collection.Name = ""; m_collection.TS = DateTime.Now; m_collection.Type = (int)AppEnum.CollectionType.quest; m_collection.RefSysNo = addsysno; BLG_CollectionBll.GetInstance().Add(m_collection); Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('问题收藏成功');", true); break; case (int)AppCmn.AppEnum.CollectionType.article: if (Request.QueryString["sysno"] == null) { Response.Redirect("../Error.aspx?msg="); } try { addsysno = int.Parse(Request.QueryString["sysno"]); } catch { Response.Redirect("../Error.aspx?msg="); } m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_collection.DR = (int)AppEnum.State.normal; m_collection.Name = ""; m_collection.TS = DateTime.Now; m_collection.Type = (int)AppEnum.CollectionType.article; m_collection.RefSysNo = addsysno; BLG_CollectionBll.GetInstance().Add(m_collection); Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('文章收藏成功');", true); break; case (int)AppCmn.AppEnum.CollectionType.famous: if (Request.QueryString["sysno"] == null) { Response.Redirect("../Error.aspx?msg="); } try { addsysno = int.Parse(Request.QueryString["sysno"]); } catch { Response.Redirect("../Error.aspx?msg="); } m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_collection.DR = (int)AppEnum.State.normal; m_collection.Name = ""; m_collection.TS = DateTime.Now; m_collection.Type = (int)AppEnum.CollectionType.famous; m_collection.RefSysNo = addsysno; BLG_CollectionBll.GetInstance().Add(m_collection); Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('名人收藏成功');", true); break; case (int)AppCmn.AppEnum.CollectionType.chart: FATE_ChartMod m_fate = new FATE_ChartMod(); try { string[] tmps = Request.QueryString["p"].Split(new char[] { '_' }); switch (Request.QueryString["minitype"].ToUpper()) { case "ASTRO": m_fate.CharType = (int)AppEnum.ChartType.personal; m_fate.FirstBirth = new DateTime(int.Parse(tmps[0]), int.Parse(tmps[1]), int.Parse(tmps[2]), int.Parse(tmps[3]), int.Parse(tmps[4]), 0); m_fate.FirstPoi = tmps[7] + "|" + tmps[6]; m_fate.Transit = DateTime.Now; m_fate.TransitPoi = m_fate.FirstPoi; m_fate.TheoryType = 0; DataTable m_dist = SYS_DistrictBll.GetInstance().GetInfoByPoi(tmps[6], tmps[7]); if (m_dist.Rows.Count > 0) { m_fate.FirstPoiName = m_dist.Rows[0]["Name1"] + "-" + m_dist.Rows[0]["Name2"] + "-" + m_dist.Rows[0]["Name3"]; } else { m_fate.FirstPoiName = "未知"; } m_fate.FirstTimeZone = int.Parse(tmps[8]); m_fate.FirstGender = int.Parse(drpGender.SelectedValue); if (tmps[5] == "1") { m_fate.FirstDayLight = (int)AppEnum.BOOL.True; } else { m_fate.FirstDayLight = (int)AppEnum.BOOL.False; } break; case "ZIWEI": m_fate.CharType = (int)AppEnum.ChartType.personal; m_fate.FirstBirth = new DateTime(int.Parse(tmps[0]), int.Parse(tmps[1]), int.Parse(tmps[2]), int.Parse(tmps[3]), int.Parse(tmps[4]), 0); m_fate.FirstPoi = "120.129798|30.259497"; m_fate.Transit = DateTime.Now; m_fate.TransitPoi = m_fate.FirstPoi; m_fate.TheoryType = 0; m_fate.FirstPoiName = "浙江省-杭州市-西湖区"; m_fate.FirstTimeZone = -8; m_fate.FirstGender = int.Parse(tmps[5]); m_fate.FirstDayLight = (int)AppEnum.BOOL.False; break; case "BAZI": m_fate.CharType = (int)AppEnum.ChartType.personal; m_fate.FirstBirth = new DateTime(int.Parse(tmps[0]), int.Parse(tmps[1]), int.Parse(tmps[2]), int.Parse(tmps[3]), int.Parse(tmps[4]), 0); m_fate.FirstPoi = "120.129798|30.259497"; m_fate.Transit = DateTime.Now; m_fate.TransitPoi = m_fate.FirstPoi; m_fate.TheoryType = 0; m_fate.FirstPoiName = "浙江省-杭州市-西湖区"; m_fate.FirstTimeZone = -8; m_fate.FirstGender = int.Parse(tmps[5]); m_fate.FirstDayLight = (int)AppEnum.BOOL.False; break; default: Response.Redirect("../Error.aspx?msg="); break; } } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "Collection-AddFate", Request.UserHostAddress, "收藏命盘失败"); Page.ClientScript.RegisterStartupScript(this.GetType(), "addwrong", "alert('系统错误,请联系管理员');", true); } m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_collection.DR = (int)AppEnum.State.normal; m_collection.Name = Server.HtmlEncode(txtName.Text.Trim()); m_collection.TS = DateTime.Now; m_collection.Type = (int)AppEnum.CollectionType.chart; m_collection.Detail = Server.HtmlEncode(txtDetail.Text.Trim()); m_collection.RefSysNo = FATE_ChartBll.GetInstance().Add(m_fate); BLG_CollectionBll.GetInstance().Add(m_collection); Page.ClientScript.RegisterStartupScript(this.GetType(), "addfateok", "alert('命盘收藏成功');", true); ModalPopupExtender1.Hide(); break; case (int)AppCmn.AppEnum.CollectionType.url: m_collection.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_collection.DR = (int)AppEnum.State.normal; m_collection.Name = Server.HtmlEncode(txtName.Text.Trim()); m_collection.TS = DateTime.Now; m_collection.Type = (int)AppEnum.CollectionType.url; m_collection.RefUrl = Server.HtmlEncode(txtUrl.Text.Trim()); m_collection.Detail = Server.HtmlEncode(txtDetail.Text.Trim()); BLG_CollectionBll.GetInstance().Add(m_collection); Page.ClientScript.RegisterStartupScript(this.GetType(), "addquestok", "alert('站外资源收藏成功');", true); break; default: Response.Redirect("../Error.aspx?msg="); //type无效 break; } } catch (Exception ex) { LogManagement.getInstance().WriteException(ex, "Collection-Add", Request.UserHostAddress, "添加收藏失败"); Page.ClientScript.RegisterStartupScript(this.GetType(), "addwrong", "alert('系统错误,请联系管理员');", true); } Response.Redirect("MyCollection.aspx?type=" + type); }
public ReturnValue <USR_CustomerShow> AddQuestionWithChart(Stream openPageData) { QA_QuestionInput <FATE_ChartMod> input; //try //{ 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); input = XMS.Core.Json.JsonSerializer.Deserialize <QA_QuestionInput <FATE_ChartMod> >(textJson); if (input == null) { throw new BusinessException("参数有误"); } //} //catch (Exception ex) //{ // throw ex; //} #region 判断输入项 if (input.CateSysNo == 0 || input.CateSysNo == AppConst.IntNull) { throw new BusinessException("请选择分类"); } if (input.Title.DoTrim() == "") { throw new BusinessException("请输入标题"); } if (input.Title.DoTrim().Length > 30) { throw new BusinessException("您输入的标题太长,请控制在30字以内"); } int point = USR_CustomerBll.GetInstance().GetModel(input.CustomerSysNo).Point; if (input.Award > point && point != AppConst.IntNull) { throw new BusinessException("您最多可用" + point + "积分"); } #endregion //try //{ QA_QuestionMod m_quest = new QA_QuestionMod(); m_quest.Award = input.Award; m_quest.CateSysNo = input.CateSysNo; m_quest.Context = SQLData.SQLFilter(AppCmn.CommonTools.StringFilter(input.Context)); m_quest.CustomerSysNo = input.CustomerSysNo; m_quest.LastReplyTime = DateTime.Now; m_quest.ReplyCount = 0; m_quest.ReadCount = 0; m_quest.BuyCount = 0; m_quest.OrderCount = 0; m_quest.Title = AppCmn.CommonTools.SystemInputFilter(input.Title); m_quest.TS = DateTime.Now; m_quest.DR = (int)AppEnum.State.normal; int sysno = 0; QA_QuestionBll.GetInstance().AddQuest(ref m_quest, true); sysno = m_quest.SysNo; if (input.Chart.Count > 0) { FATE_ChartMod m_chart = new FATE_ChartMod(); m_chart.CharType = input.Chart[0].CharType;; if (m_chart.CharType != (int)AppEnum.ChartType.nochart) { m_chart.FirstBirth = input.Chart[0].FirstBirth; m_chart.FirstPoi = input.Chart[0].FirstPoi; m_chart.Transit = DateTime.Now; m_chart.TransitPoi = input.Chart[0].FirstPoi; m_chart.TheoryType = 0; m_chart.FirstPoiName = input.Chart[0].FirstPoiName; m_chart.FirstTimeZone = -8; m_chart.FirstGender = input.Chart[0].FirstGender; m_chart.FirstDayLight = input.Chart[0].FirstDayLight; if (m_chart.CharType == (int)AppEnum.ChartType.relation) { m_chart.SecondBirth = input.Chart[0].SecondBirth; m_chart.SecondPoi = input.Chart[0].SecondPoi; m_chart.SecondPoiName = input.Chart[0].SecondPoiName; m_chart.SecondTimeZone = -8; m_chart.SecondGender = input.Chart[0].SecondGender; m_chart.SecondDayLight = input.Chart[0].SecondDayLight; } m_chart.TS = DateTime.Now; m_chart.DR = (int)AppEnum.State.normal; int fatesysno = FATE_ChartBll.GetInstance().Add(m_chart); REL_Question_ChartMod m_qchart = new REL_Question_ChartMod(); m_qchart.Chart_SysNo = fatesysno; m_qchart.Question_SysNo = sysno; REL_Question_ChartBll.GetInstance().Add(m_qchart); } } //} //catch (Exception ex) //{ // throw ex; //} USR_CustomerShow ret = new USR_CustomerShow(); USR_CustomerBll.GetInstance().GetModel(input.CustomerSysNo).MemberwiseCopy(ret); return(ReturnValue <USR_CustomerShow> .Get200OK(ret)); }