protected void Page_Load(object sender, EventArgs e) { Login(Request.Url.ToString()); if (Request.QueryString["order"] != null) { try { ordersysno = int.Parse(Request.QueryString["order"]); } catch { ShowError(""); } } else { ShowError(""); } ORD_CashMod m_order = ORD_CashBll.GetInstance().GetModel(ordersysno); if (m_order.CustomerSysNo != GetSession().CustomerEntity.SysNo) { ShowError("");//非当前用户的订单 } orderid = m_order.OrderID; price = m_order.PayAmount.ToString("¥0.00"); PayPannel1.m_order = m_order;; PayPannel1.initial(); }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.QueryString["notify_id"], Request.QueryString["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 //商户订单号 string out_trade_no = Request.QueryString["out_trade_no"]; orderID = out_trade_no; //支付宝交易号 string trade_no = Request.QueryString["trade_no"]; //交易状态 string trade_status = Request.QueryString["trade_status"]; if (Request.QueryString["trade_status"] == "TRADE_FINISHED" || Request.QueryString["trade_status"] == "TRADE_SUCCESS") { succ = true; if (out_trade_no.Contains("C")) { ordertype = 1; } else if (out_trade_no.Contains("P")) { ordertype = 2; } ORD_CashMod m_mod = ORD_CashBll.GetInstance().GetModelByOrderID(out_trade_no); if (m_mod == null) { ShowError("");//订单号错误 } if (m_mod.Status == (int)AppEnum.CashOrderStatus.beforepay) { m_mod.CurrentID = trade_no;//记录支付流水号 ORD_CashBll.GetInstance().SetPaySucc(m_mod); } //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 } else { LogManagement.getInstance().WriteTrace("订单" + orderID + "支付宝返回" + Request.QueryString["trade_status"], "PayReturnForAlipay", base.Request.UserHostAddress); } //打印页面 ShowResult(); //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { LogManagement.getInstance().WriteTrace("订单" + orderID + "支付宝返回验证失败", "PayReturnForAlipay", base.Request.UserHostAddress); } } else { LogManagement.getInstance().WriteTrace("支付宝返回无参数", "PayReturnForAlipay", base.Request.UserHostAddress); ShowError("请从正确的入口进入"); } }
protected void BindList() { DataTable m_dt = new DataTable(); int total = 0; switch (tab) { case 0: ltrPoint.Text = GetSession().CustomerEntity.Point.ToString(); m_dt = ORD_PointBll.GetInstance().GetList(pagesize, pageindex, GetSession().CustomerEntity.SysNo, AppConst.IntNull, AppConst.IntNull, AppConst.IntNull, "", ref total); m_dt.Columns.Add("content"); for (int i = 0; i < m_dt.Rows.Count; i++) { m_dt.Rows[i]["content"] = AppEnum.GetPointOrderType(int.Parse(m_dt.Rows[i]["type"].ToString())); if (m_dt.Rows[i]["type"].ToString() == ((int)AppEnum.PointOrderType.appconsume).ToString()) { m_dt.Rows[i]["content"] += "应用-" + AppEnum.GetApps(int.Parse(m_dt.Rows[i]["productsysno"].ToString())); } else if (m_dt.Rows[i]["type"].ToString() == ((int)AppEnum.PointOrderType.questaward).ToString()) { m_dt.Rows[i]["content"] = "悬赏-" + "<a href='" + AppConfig.HomeUrl() + "Quest/Question/" + m_dt.Rows[i]["productsysno"].ToString() + "' target='_blank'>" + CommonTools.CutStr(m_dt.Rows[i]["content"].ToString(), 10) + "</a>"; } } Repeater1.DataSource = m_dt; Repeater1.DataBind(); break; case 1: ltrCash.Text = GetSession().CustomerEntity.Credit.ToString(); m_dt = ORD_CashBll.GetInstance().GetList(pagesize, pageindex, GetSession().CustomerEntity.SysNo, AppConst.IntNull, AppConst.IntNull, AppConst.IntNull, "", ref total); m_dt.Columns.Add("content"); m_dt.Columns.Add("target"); for (int i = 0; i < m_dt.Rows.Count; i++) { if ((m_dt.Rows[i]["producttype"].ToString() == ((int)AppEnum.CashOrderType.consultget).ToString() || m_dt.Rows[i]["producttype"].ToString() == ((int)AppEnum.CashOrderType.consultpay).ToString()) && m_dt.Rows[i]["productsysno"] != null && m_dt.Rows[i]["productsysno"].ToString() != "") { try { DataTable tmp_dt = QA_OrderBll.GetInstance().GetOrderDetail(int.Parse(m_dt.Rows[i]["productsysno"].ToString())); if (tmp_dt.Rows.Count > 0) { m_dt.Rows[i]["content"] = AppEnum.GetCashOrderType(int.Parse(m_dt.Rows[i]["producttype"].ToString())); if (m_dt.Rows[i]["producttype"].ToString() == ((int)AppEnum.CashOrderType.consultget).ToString()) { m_dt.Rows[i]["target"] = tmp_dt.Rows[0]["questuname"].ToString(); } else if (m_dt.Rows[i]["producttype"].ToString() == ((int)AppEnum.CashOrderType.consultpay).ToString()) { m_dt.Rows[i]["target"] = tmp_dt.Rows[0]["orderuname"].ToString(); } } } catch { } } } Repeater2.DataSource = m_dt; Repeater2.DataBind(); break; } Pager1.url = "MyAccount.aspx?tab=" + tab + "&pn="; Pager1.totalrecord = total; if (total % AppConst.PageSize == 0) { this.Pager1.total = total / pagesize; } else { this.Pager1.total = total / pagesize + 1; } this.Pager1.index = pageindex; this.Pager1.numlenth = 3; }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { //e.Item.FindControl("LinkButton1").Visible = true; //if (m_qustion.EndTime <= DateTime.Now || GetSession().CustomerEntity.SysNo.ToString() == ((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()) //{ // e.Item.FindControl("LinkButton1").Visible = false; //} e.Item.FindControl("LinkButton5").Visible = true; e.Item.FindControl("Literal1").Visible = true; } else { //e.Item.FindControl("LinkButton1").Visible = false; if (REL_Customer_CategoryBll.GetInstance().HasRecord(GetSession().CustomerEntity.SysNo, m_qustion.CateSysNo, (int)AppEnum.CategoryType.QA) || GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) { e.Item.FindControl("LinkButton5").Visible = true; e.Item.FindControl("Literal1").Visible = true; } } #region 绑定评论列表 Repeater m_rpt = (Repeater)e.Item.FindControl("Repeater3"); DataTable m_dt = QA_CommentBll.GetInstance().GetListByAnswer(int.Parse(((DataRowView)e.Item.DataItem)["SysNo"].ToString())); if (m_dt != null) { m_dt.Columns.Add("color"); for (int i = 0; i < m_dt.Rows.Count; i++) { if (m_dt.Rows[i]["CustomerSysNo"].ToString() == m_qustion.CustomerSysNo.ToString()) { m_dt.Rows[i]["color"] = "color: #A5534C"; } } m_rpt.DataSource = m_dt; m_rpt.DataBind(); } #endregion #region 绑定用户奖章 Repeater m_rpt1 = (Repeater)e.Item.FindControl("Repeater4"); DataTable m_dt1 = REL_Customer_MedalBll.GetInstance().GetMedalByCustomer(int.Parse(((DataRowView)e.Item.DataItem)["CustomerSysNo"].ToString()), 0); if (m_dt1 != null) { m_rpt1.DataSource = m_dt1; m_rpt1.DataBind(); } #endregion #region 设置报价单权限 DataRowView rowv = (DataRowView)e.Item.DataItem; if (rowv["Price"] != null && rowv["Price"].ToString() != "") { if (GetSession().CustomerEntity.SysNo == m_qustion.CustomerSysNo) //求测者 { e.Item.FindControl("LinkButton5").Visible = false; //报价单无法删除 if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforepay).ToString()) { e.Item.FindControl("buyicon").Visible = true; } else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.beforeconfirm).ToString()) { e.Item.FindControl("confirmicon").Visible = true; DateTime replytime = DateTime.Parse(rowv["replytime"].ToString()); if (replytime != AppConst.DateTimeNull) { TimeSpan m_span = replytime.AddHours(AppConst.ConsultConfirmTime) - DateTime.Now; string tmpstr = ""; if (m_span.Days > 0) { tmpstr += m_span.Days + "天"; } if (m_span.Days > 0) { tmpstr += m_span.Hours + "小时"; } ((Literal)e.Item.FindControl("Literal4")).Text = tmpstr; } } else if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString()) { e.Item.FindControl("buyedtip").Visible = true; DateTime paytime = ORD_CashBll.GetInstance().GetPayTimeByQAOrder(int.Parse(rowv["ordersysno"].ToString())); if (paytime != AppConst.DateTimeNull) { TimeSpan m_span = paytime.AddHours(AppConst.ConsultReplyTime) - DateTime.Now; string tmpstr = ""; if (m_span.Days > 0) { tmpstr += m_span.Days + "天"; } if (m_span.Days > 0) { tmpstr += m_span.Hours + "小时"; } ((Literal)e.Item.FindControl("Literal3")).Text = tmpstr; } else { ShowError(""); } } } if (GetSession().CustomerEntity.SysNo == Convert.ToInt32(rowv["CustomerSysNo"]))//占卜师 { if (rowv["status"].ToString() == ((int)AppEnum.ConsultOrderStatus.payed).ToString()) { e.Item.FindControl("replyicon").Visible = true; } } } #endregion }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { Login(Request.Url.ToString()); if (e.CommandName == "Love") { if (!CheckCommentCookies(int.Parse(e.CommandArgument.ToString()))) { QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString())); m_answer.Love++; QA_AnswerBll.GetInstance().Update(m_answer); SetCommentCookies(int.Parse(e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您对该回答表示了赞同!');", true); BindList(); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您已对该回答发表了看法!');", true); } } else if (e.CommandName == "Hate") { if (!CheckCommentCookies(int.Parse(e.CommandArgument.ToString()))) { QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString())); m_answer.Hate++; QA_AnswerBll.GetInstance().Update(m_answer); SetCommentCookies(int.Parse(e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('您对该回答表示了不赞同!');", true); BindList(); } else { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addlove", "alert('您已对该回答发表了看法!');", true); } } //else if (e.CommandName == "Award") //{ // QA_QuestionMod m_quest = QA_QuestionBll.GetInstance().GetModel(SysNo); // int usedAward = QA_AnswerBll.GetInstance().GetUsedAward(SysNo); // ltrMax.Text = "该问题的总悬赏积分为:" + (m_quest.Award - usedAward).ToString(); // HiddenField1.Value = e.CommandArgument.ToString(); // ModalPopupExtender1.Show(); //} else if (e.CommandName == "Reply") { if (((TextBox)e.Item.FindControl("txtRe")).Text.Trim() == "") { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('请输入您的回复信息!');", true); return; } try { QA_CommentMod m_comment = new QA_CommentMod(); m_comment.AnswerSysNo = int.Parse(e.CommandArgument.ToString()); m_comment.Context = AppCmn.CommonTools.SystemInputFilter(((TextBox)e.Item.FindControl("txtRe")).Text.Trim()); m_comment.DR = (int)AppEnum.State.normal; m_comment.QuestionSysNo = SysNo; m_comment.TS = DateTime.Now; m_comment.CustomerSysNo = GetSession().CustomerEntity.SysNo; QA_CommentBll.GetInstance().AddComment(m_comment); RefreshSession(); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('发表看法成功!');", true); } catch { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addComment", "alert('系统故障,请联系管理员');", true); } BindList(); } else if (e.CommandName == "Del") { QA_AnswerMod m_answer = QA_AnswerBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString())); m_answer.DR = (int)AppEnum.State.deleted; QA_AnswerBll.GetInstance().Update(m_answer); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "addhate", "alert('成功删除该回答!');", true); BindList(); } else if (e.CommandName == "buy") { //生成订单 QA_OrderMod m_order = QA_OrderBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString())); ORD_CashMod m_mod = new ORD_CashMod(); m_mod.CustomerSysNo = GetSession().CustomerEntity.SysNo; m_mod.CurrentID = ""; m_mod.Discount = 0; m_mod.PayAmount = m_order.Price; m_mod.PayType = AppConst.IntNull; m_mod.Price = m_order.Price; m_mod.ProductSysNo = m_order.SysNo; m_mod.Status = (int)AppEnum.CashOrderStatus.beforepay; m_mod.ProductType = (int)AppEnum.CashOrderType.consultpay;; m_mod.TS = DateTime.Now; m_mod.OrderID = "C" + m_mod.ProductType.ToString("0") + m_mod.TS.ToString("yyyyMMdd") + m_mod.ProductSysNo + CommonTools.ThrowRandom(0, 99999).ToString("00000"); m_mod.SysNo = ORD_CashBll.GetInstance().Add(m_mod); //m_qustion.BuyCount++;//支付成功后修改订单购买数 QA_QuestionBll.GetInstance().Update(m_qustion); Response.Redirect(AppConfig.HomeUrl() + "Order/ConsultOrder.aspx?order=" + m_mod.SysNo); } else if (e.CommandName == "score") { string score = ((HiddenField)e.Item.FindControl("HiddenField3")).Value; if (score == "") { ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "score", "alert('请先选择评价!');", true); return; } else { QA_OrderMod m_order = QA_OrderBll.GetInstance().GetModel(int.Parse(e.CommandArgument.ToString())); m_order.Score = int.Parse(score); m_order.Status = (int)AppEnum.ConsultOrderStatus.confirmed; QA_OrderBll.GetInstance().Update(m_order); ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), "score", "alert('已评价成功!');", true); BindList(); } } }
protected void Page_Load(object sender, EventArgs e) { SortedDictionary <string, string> sPara = GetRequestPost(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, Request.Form["notify_id"], Request.Form["sign"]); if (verifyResult)//验证成功 { ///////////////////////////////////////////////////////////////////////////////////////////////////////////// //请在这里加上商户的业务逻辑程序代码 //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表 //商户订单号 string out_trade_no = Request.Form["out_trade_no"]; orderID = out_trade_no; //支付宝交易号 string trade_no = Request.Form["trade_no"]; //交易状态 string trade_status = Request.Form["trade_status"]; if (Request.Form["trade_status"] == "TRADE_FINISHED" || Request.Form["trade_status"] == "TRADE_SUCCESS") { succ = true; if (out_trade_no.Contains("C")) { ordertype = 1; } else if (out_trade_no.Contains("P")) { ordertype = 2; } ORD_CashMod m_mod = ORD_CashBll.GetInstance().GetModelByOrderID(out_trade_no); if (m_mod == null) { ShowError("");//订单号错误 } if (m_mod.Status == (int)AppEnum.CashOrderStatus.beforepay) { m_mod.CurrentID = trade_no;//记录支付流水号 ORD_CashBll.GetInstance().SetPaySucc(m_mod); } //判断该笔订单是否在商户网站中已经做过处理 //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 //如果有做过处理,不执行商户的业务程序 //注意: //该种交易状态只在两种情况下出现 //1、开通了普通即时到账,买家付款成功后。 //2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。 } //else if (Request.Form["trade_status"] == "TRADE_SUCCESS") //{ // //判断该笔订单是否在商户网站中已经做过处理 // //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 // //如果有做过处理,不执行商户的业务程序 // //注意: // //该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。 //} else { LogManagement.getInstance().WriteTrace("订单" + orderID + "支付宝返回" + Request.QueryString["trade_status"], "PayReturnForAlipay", base.Request.UserHostAddress); } //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— Response.Write("success"); //请不要修改或删除 ///////////////////////////////////////////////////////////////////////////////////////////////////////////// } else//验证失败 { Response.Write("fail"); } } else { Response.Write("无通知参数"); } }