protected void LinkButton1_Click(object sender, EventArgs e) { string laiyuanbianhao = ""; try { laiyuanbianhao = Request.QueryString["laiyuanbianhao"].ToString(); } catch { } try { type = Request.QueryString["type"].ToString(); } catch { } if (type == "edit") { string table_name = my_b.get_value("u1", "" + ConfigurationSettings.AppSettings["Prefix"].ToString() + "Model", "where id = " + Request.QueryString["Model_id"].ToString() + ""); string sql = "update " + table_name + " set "; for (int d1 = 0; d1 < Model_dt.Rows.Count; d1++) { if (d1 == 0) { sql = sql + Model_dt.Rows[d1]["u1"].ToString() + "=" + db.get_kj(Table1, Model_dt, d1) + ""; } else { sql = sql + "," + Model_dt.Rows[d1]["u1"].ToString() + "=" + db.get_kj(Table1, Model_dt, d1) + ""; } } sql = sql + " where id=" + Request.QueryString["id"].ToString(); //Response.Write(sql); //Response.End(); //处理状态 if (table_name == "sl_yuyue") { //处理预约 start RadioButtonList dr = new RadioButtonList(); dr = (RadioButtonList)form1.FindControl("zhuangtai"); DataTable dt = my_c.GetTable("select * from " + table_name + " where id=" + Request.QueryString["id"].ToString() + ""); //if (dt.Rows[0]["zhuangtai"].ToString() == "正在审核") //{ //审核通过发短信 if (dr.SelectedValue == "已确认") { if (dt.Rows[0]["yonghuming"].ToString() != "") { string wherestrig = "where id=" + dt.Rows[0]["id"].ToString() + ""; my_b.getWebFile(my_b.get_Domain() + "weixinmb.aspx?moban=yuyue&tablename=" + table_name + "&wherestrig=" + HttpUtility.UrlEncode(wherestrig) + ""); //Response.Write(my_b.get_Domain() + "weixinmb.aspx?moban=yuyue&tablename=" + table_name + "&wherestrig=" + HttpUtility.UrlEncode(wherestrig) + ""); //Response.End(); } } //} my_c.genxin(sql); //处理预约 end } else if (table_name == "sl_daodian") { //处理到店 start RadioButtonList dr = new RadioButtonList(); dr = (RadioButtonList)form1.FindControl("zhuangtai"); DataTable dt = my_c.GetTable("select * from " + table_name + " where id=" + Request.QueryString["id"].ToString() + ""); my_c.genxin(sql); if (dt.Rows[0]["songfen"].ToString() != "是") { //审核通过发短信 if (dr.SelectedValue == "已付款") { my_o.daodian_pay(dt.Rows[0]["dingdanhao"].ToString(), table_name.Replace("sl_", "")); my_o.daodian_fanli(dt.Rows[0]["dingdanhao"].ToString(), table_name.Replace("sl_", "")); } } //处理到店 end } else { my_c.genxin(sql); } //end if (laiyuanbianhao == "") { Response.Redirect("err.aspx?err=修改信息成功!马上跳转到信息列表页面!&errurl=" + my_b.tihuan("caiwu_table.aspx?Model_id=" + Request.QueryString["Model_id"].ToString() + "", "&", "fzw123") + ""); } else { Response.Redirect("err.aspx?err=修改信息成功!马上跳转到信息列表页面!&errurl=" + my_b.tihuan("caiwu_table.aspx?Model_id=" + Request.QueryString["Model_id"].ToString() + "&laiyuanbianhao=" + laiyuanbianhao + "", "&", "fzw123") + ""); } } else { string sql = "insert into " + my_b.get_value("u1", "" + ConfigurationSettings.AppSettings["Prefix"].ToString() + "Model", "where id=" + Request.QueryString["Model_id"].ToString() + "") + " "; sql = sql + "("; for (int d1 = 0; d1 < Model_dt.Rows.Count; d1++) { if (d1 == 0) { sql = sql + Model_dt.Rows[d1]["u1"].ToString(); } else { sql = sql + "," + Model_dt.Rows[d1]["u1"].ToString(); } } sql = sql + ") values ("; for (int d1 = 0; d1 < Model_dt.Rows.Count; d1++) { if (d1 == 0) { sql = sql + db.get_kj(Table1, Model_dt, d1) + ""; } else { sql = sql + "," + db.get_kj(Table1, Model_dt, d1) + ""; } } sql = sql + ")"; my_c.genxin(sql); if (laiyuanbianhao == "") { Response.Redirect("err.aspx?err=增加信息成功!马上跳转到信息列表页面!&errurl=" + my_b.tihuan("caiwu_table.aspx?Model_id=" + Request.QueryString["Model_id"].ToString() + "", "&", "fzw123") + ""); } else { Response.Redirect("err.aspx?err=增加信息成功!马上跳转到信息列表页面!&errurl=" + my_b.tihuan("caiwu_table.aspx?Model_id=" + Request.QueryString["Model_id"].ToString() + "&laiyuanbianhao=" + laiyuanbianhao + "", "&", "fzw123") + ""); } } }
//计算 end protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //用户状态 my_b.user_sta("user_name"); //end string type = ""; try { type = Request.QueryString["type"].ToString(); } catch { } if (type == "zongjia") { float jifen = 1; try { jifen = float.Parse(Request.QueryString["jifen"].ToString()); } catch { } float yue = 1; try { yue = float.Parse(Request.QueryString["yue"].ToString()); } catch { } float youhuiquan = 1; try { youhuiquan = float.Parse(Request.QueryString["youhuiquan"].ToString()); } catch { } float jine = 0; try { jine = float.Parse(Request.QueryString["jine"].ToString()); } catch { } Response.Write(jisuan("", jifen, yue, youhuiquan, jine, "")); Response.End(); } if (type == "pay") { string dingdanhao = my_b.get_bianhao(); float jine = float.Parse(Request["jine"].ToString()); string zhifufangshi = Request["zhifufangshi"]; string laiyuanbianhao = Request["laiyuanbianhao"]; string dianpumingcheng = Request["dianpumingcheng"]; string yonghuming = my_b.k_cookie("user_name"); string zhuangtai = "未付款"; string miaoshu = "用户:" + yonghuming + "IP:" + Request.UserHostAddress.ToString() + ",到店付款" + jine + "元"; float jifen = 0; try { jifen = float.Parse(Request["jifen"].ToString()); } catch { jifen = 0; } float jifen_ = 0; try { jifen_ = float.Parse(my_c.GetTable("select sum(fenshu) as count_id from sl_jifen where yonghuming='" + my_b.k_cookie("user_name") + "' and zhuangtai='已处理'").Rows[0]["count_id"].ToString()); } catch { } if (jifen > jifen_) { Response.Redirect("/err.aspx?err=操作不对!&errurl=" + my_b.tihuan(Request.UrlReferrer.ToString(), "&", "fzw123") + ""); } float yue = 0; try { yue = float.Parse(Request["yue"].ToString()); } catch { yue = 0; } float yue_ = 0; try { yue_ = float.Parse(my_c.GetTable("select sum(jine) as count_id from sl_caiwu where yonghuming='" + my_b.k_cookie("user_name") + "' and leixing <>'领取' and zhuangtai='已付款'").Rows[0]["count_id"].ToString()); } catch { } if (yue > yue_) { Response.Redirect("/err.aspx?err=操作不对!&errurl=" + my_b.tihuan(Request.UrlReferrer.ToString(), "&", "fzw123") + ""); } string youhuiquan1 = ""; try { youhuiquan1 = Request["youhuiquan"]; } catch { } string youhuiquan = ""; try { youhuiquan = my_b.c_string(Request["youhuiquan"].ToString()); } catch { } if (youhuiquan == "") { youhuiquan = "0"; } else { youhuiquan = "1"; } string chanpinjine = Request["jine"]; //Response.Write(jifen.ToString() + "|" + yue.ToString() + "|" + youhuiquan + "|" + jine.ToString()); //Response.End(); jine = jisuan(type, jifen, yue, float.Parse(youhuiquan), jine, dingdanhao); //Response.Write(jine); //Response.End(); if (jine == 0) { zhuangtai = "已付款"; } string tablename = "daodian"; if (zhifufangshi == "现金支付") { zhuangtai = "已付款"; } my_c.genxin("insert into sl_daodian(dingdanhao,zhifufangshi,yonghuming,zhuangtai,miaoshu,jine,jifen,yue,youhuiquan,chanpinjine,laiyuanbianhao,dianpumingcheng) values('" + dingdanhao + "','" + zhifufangshi + "','" + yonghuming + "','" + zhuangtai + "','" + miaoshu + "'," + jine + "," + zong_jifen + "," + zong_yue + ",'" + youhuiquan1 + "'," + chanpinjine + "," + laiyuanbianhao + ",'" + dianpumingcheng + "')"); if (zhifufangshi == "现金支付") { zhuangtai = "已付款"; if (jine > 0) { my_o.daodian_pay(dingdanhao, tablename); my_o.daodian_fanli(dingdanhao, tablename); } } if (jine == 0) { my_o.daodian_pay(dingdanhao, tablename); my_o.daodian_fanli(dingdanhao, tablename); Response.Redirect("/err.aspx?err=支付成功!&errurl=" + my_b.tihuan(Request.UrlReferrer.ToString(), "&", "fzw123") + ""); } //处理付款 start string dingdanname = miaoshu; string dingdanjiage = jine.ToString(); if (zhifufangshi == "微信支付") { float weixinzhifu = float.Parse(dingdanjiage) * 100; Response.Redirect("/inc/weixinpay/demo/js_api_call.php?dingdanhao=" + dingdanhao + "&tablename=" + tablename + "&bodystr=网上购物(" + dingdanhao + ")&jine=" + weixinzhifu + ""); } else { Response.Redirect("/err.aspx?err=请把现金交给收银员,并叫收银员把订单状态改为已付款!&errurl=" + my_b.tihuan("/single.aspx?m=user_index", "&", "fzw123") + ""); } //处理付款 end } } }