protected void Button1_Click(object sender, EventArgs e) { report_Entity report = new report_Entity(); report.s_account = sellerNameList.SelectedValue; report.p_name = prodectList.SelectedValue; report.report = reportInfo.Text; if (report.s_account.Length <= 0) { Response.Write(MessagesBox.showMessages("商家姓名不能为空!")); return; } else if (report.p_name.Length <= 0) { Response.Write(MessagesBox.showMessages("商品不能为空!")); return; } else if (report.report.Length <= 0) { Response.Write(MessagesBox.showMessages("内容不能为空!")); return; } bool result = data.sendReport(report); if (result) { reportInfo.Text = ""; Response.Write(MessagesBox.showMessages("您的反馈我们已经收到,我们会尽快处理!")); Response.Write("<script language=javascript>history.go(-1);</script>"); } }
protected void Button1_Click(object sender, EventArgs e) { SellService db = new SellService(); seller_Entity a = new seller_Entity(); a.S_account = txtSell_Account.Text; a.S_password = txtSell_password.Text; a.S_name = txtSell_Name.Text; a.S_storeName = txtSell_storename.Text; a.S_tel = txtSell_tel.Text; a.S_question = ddlQuestion.Text; a.S_answer = txtSell_answer.Text; if (!db.exist(txtSell_Account.Text)) { Session["UserAccount"] = a.S_account.Trim(); Session["UserPassword"] = a.S_password.Trim(); Session["Logged"] = true; Session["UserType"] = "1"; db.create(a); Response.Write(MessagesBox.showMessages("注册成功")); System.Web.Security.FormsAuthentication.RedirectFromLoginPage(a.S_account, true); } else { Response.Write(MessagesBox.showMessages("账号已存在,请重新输入")); } }
/// <summary> /// 计算所选商品总价 /// </summary> public void cal() { results = 0; for (int i = 0; i < gv.Rows.Count; i++) { CheckBox chkProduct = (CheckBox)gv.Rows[i].FindControl("chkProducts"); if (chkProduct.Checked == true)//判断是否选中 { TextBox txtNum = (TextBox)gv.Rows[i].FindControl("txtNum"); //判断商品库存量是否足够 if (int.Parse(txtNum.Text) > seller.searchProCNum(int.Parse(gv.Rows[i].Cells[4].Text))) { Response.Write(MessagesBox.showMessages("商品名称为:" + gv.Rows[i].Cells[5].Text + " 的商品的库存不足,请重新输入商品数量!")); } else { //判断所选商品数量是否小于零 if (int.Parse(txtNum.Text) <= 0) { Response.Write(MessagesBox.showMessages("请重新输入商品名称为:" + gv.Rows[i].Cells[5].Text + " 的商品数量!")); } else { results += double.Parse(gv.Rows[i].Cells[6].Text) * double.Parse(txtNum.Text);//单价*数量 } } } } lblTotalPrice.Text = results.ToString();//显示总价 }
protected void Button1_Click(object sender, EventArgs e) { buyer_Entity buyer = new buyer_Entity(); buyerIntSer B = new buyerIntSer(); buyer.B_account = Session["UserAccount"].ToString().Trim(); bool b = B.ifBuyerExist(buyer.B_account); if (b) { buyer.B_name = txtName.Text; buyer.B_tel = txtTel.Text; buyer.B_question = DropDownList1.SelectedItem.Value; buyer.B_answer = txtAnswer.Text; buyer.B_email = txtEmail.Text; B.BuyerModify(buyer.B_account, buyer.B_name, buyer.B_tel, buyer.B_question, buyer.B_answer, buyer.B_email); Response.Write(MessagesBox.showMessages("修改成功!")); System.Threading.Thread.Sleep(1000); Response.Redirect("~/Default.aspx"); } else { Response.Write(MessagesBox.showMessages("信息修改失败,请重新进行修改操作!")); } }
protected void btn_Ensure_Click(object sender, EventArgs e) { if (Session["UserType"].ToString() == "1") { if (sell.check(txtSell_Account.Text, Label1.Text, txtSell_Answer.Text)) { Response.Redirect("../seller/Modify.aspx"); } else { Response.Write(MessagesBox.showMessages("回答错误,请重新回答。")); } } else { if (buyer.ShowAnswer(txtSell_Account.Text) == txtSell_Answer.Text) { Response.Redirect("../buyer/Modify.aspx"); } else { Response.Write(MessagesBox.showMessages("回答错误,请重新回答。")); } } }
protected void Button1_Click(object sender, EventArgs e) { SellService a = new SellService(); buyerIntSer b = new buyerIntSer(); if (RadioButtonList1.SelectedItem != null) { if (RadioButtonList1.SelectedItem.Value.ToString() == "卖家") { if (!txtCode.Text.Trim().Equals(lblCode.Text.Trim())) { Response.Write(MessagesBox.showMessages("验证码错误!")); } else { if (a.landing(txtAccount.Text.Trim(), txtPassword.Text.Trim())) { Session["UserAccount"] = txtAccount.Text.Trim(); Session["UserPassword"] = txtPassword.Text.Trim(); Session["Logged"] = true; Session["UserType"] = "1"; System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtAccount.Text, true); } else { Response.Write(MessagesBox.showMessages("账号或密码错误!")); } } } else { if (!txtCode.Text.Trim().Equals(lblCode.Text.Trim())) { Response.Write(MessagesBox.showMessages("验证码错误!")); } else { if (b.login(txtAccount.Text.Trim(), txtPassword.Text.Trim())) { Session["UserAccount"] = txtAccount.Text.Trim(); Session["UserPassword"] = txtPassword.Text.Trim(); Session["Logged"] = true; Session["UserType"] = "0"; System.Web.Security.FormsAuthentication.RedirectFromLoginPage(txtAccount.Text, true); } else { Response.Write(MessagesBox.showMessages("账号或密码错误!")); } } } } else { Response.Write(MessagesBox.showMessages("请先选择用户角色!")); } }
protected void btnClear_Click(object sender, EventArgs e) { string account = Session["UserAccount"].ToString().Trim(); buyer.DeleteFromCartByBuyer(account); gv.DataSource = null; gv.DataBind(); Response.Write(MessagesBox.showMessages("购物车已清空!")); }
protected void Button1_Click(object sender, EventArgs e) { if (txtAccount.Text == "admin" && txtPassword.Text == "admin") { Response.Write(MessagesBox.showMessages("登录成功!")); Response.Redirect("~/Administrator/AdminManage.aspx"); } else { Response.Write(MessagesBox.showMessages("登录失败!")); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserAccount"] == null) { Response.Redirect("../login.aspx"); return; } if (gv.Rows.Count <= 0) { Response.Write(MessagesBox.showMessages("你的购物车空空如也!")); } }
protected void Button1_Click(object sender, EventArgs e) { SellService a = new SellService(); product_Entity b = new product_Entity(); b.S_account = Session["UserAccount"].ToString().Trim(); b.P_name = txtProduct_name.Text; b.P_category = txtProduct_category.Text; b.P_price = double.Parse(txtProduct_price.Text); b.P_cNum = int.Parse(txtProduct_number.Text); b.P_photo = FileUpload1.FileName; a.add(b, FileUpload1); Response.Write(MessagesBox.showMessages("添加成功")); }
protected void Button1_Click(object sender, EventArgs e) { if (Session["UserType"].ToString().Trim() == "0") { buyerIntSer buyer = new buyerIntSer(); buyer.Updatepassword(Session["UserAccount"].ToString().Trim(), txtSell_password.Text.Trim()); Response.Write(MessagesBox.showMessages("修改成功!")); Response.Redirect("~/Default.aspx"); } else { SellService a = new SellService(); a.change(Session["UserAccount"].ToString().Trim(), txtSell_password.Text.Trim()); Response.Write(MessagesBox.showMessages("修改成功!")); Response.Redirect("~/Default.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { buyerIntSer buyer = new buyerIntSer(); bool b = buyer.BuyerReg(txtSell_Account.Text.Trim(), txtSell_password.Text.Trim(), txtSell_Name.Text.Trim(), txtSell_tel.Text.Trim(), ddlQuestion.SelectedItem.Value, txtSell_answer.Text.Trim(), txtSell_mail.Text.Trim()); if (!b) { Response.Write(MessagesBox.showMessages("注册成功")); Response.Redirect("~/Default.aspx"); } else { Response.Write(MessagesBox.showMessages("账号已存在,请重新输入")); } }
protected void btnSendFeedBack_Click(object sender, EventArgs e) { if (txtFeedBack.Text.Trim().Length <= 0) { Response.Write(MessagesBox.showMessages("内容不能为空")); return; } String account = Session["UserAccount"].ToString(); String feedBackText = txtFeedBack.Text; feedback_Entity feedbackEntity = new feedback_Entity(); feedbackEntity.account = account; feedbackEntity.reportInfo = feedBackText; bool result = data.sendFeedback(feedbackEntity); if (result) { Response.Write(MessagesBox.showMessages("感谢您的反馈!")); Response.Write("<script language=javascript>history.go(-1);</script>"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { SellService a = new SellService(); product_Entity b = new product_Entity(); b.P_Id = int.Parse(Request.QueryString["id"].ToString()); b.S_account = Session["UserAccount"].ToString().Trim(); b.P_name = txtProduct_name.Text.Trim(); b.P_category = txtProduct_category.Text.Trim(); b.P_price = double.Parse(txtProduct_price.Text.Trim()); b.P_cNum = int.Parse(txtProduct_number.Text.Trim()); b.P_photo = "~/Images/" + Session["UserAccount"].ToString().Trim() + "/" + FileUpload1.FileName; if (a.updateProInfo(Session["UserAccount"].ToString().Trim(), b, FileUpload1)) { Response.Write(MessagesBox.showMessages("更改成功!")); } else { Response.Write(MessagesBox.showMessages("更改失败!")); } }
protected void btn_submit_Click(object sender, EventArgs e) { SellService db = new SellService(); seller_Entity sell = new seller_Entity(); string account = Session["UserAccount"].ToString().Trim(); sell.S_account = account; sell.S_name = txt_s_name.Text.Trim(); sell.S_storeName = txt_s_storename.Text.Trim(); sell.S_tel = txt_s_tel.Text.Trim(); sell.S_question = ddl_s_question.Text.Trim(); sell.S_answer = txt_s_answer.Text.Trim(); if (db.changeUserInfo(sell)) { Response.Write(MessagesBox.showMessages("用户信息修改成功!")); Response.Redirect("~/Default.aspx"); } else { Response.Write(MessagesBox.showMessages("用户信息修改失败!")); } }
protected void Button1_Click(object sender, EventArgs e) { SellService db = new SellService(); seller_Entity a = new seller_Entity(); a.S_account = txtSell_Account.Text; a.S_password = txtSell_password.Text; a.S_name = txtSell_Name.Text; a.S_storeName = txtSell_storename.Text; a.S_tel = txtSell_tel.Text; a.S_question = ddlQuestion.Text; a.S_answer = txtSell_answer.Text; if (!db.exist(txtSell_Account.Text)) { db.create(a); Response.Write(MessagesBox.showMessages("注册成功")); } else { Response.Write(MessagesBox.showMessages("账号已存在,请重新输入")); } }
protected void Button2_Click(object sender, EventArgs e) { Response.Write(MessagesBox.showMessages("添加成功")); System.Web.Security.FormsAuthentication.RedirectFromLoginPage(Session["UserAccount"].ToString(), true); }
protected void btnSubmit_Click1(object sender, EventArgs e) { string account = Session["UserAccount"].ToString().Trim(); double balance = (double)buyer.SearchBalance(account); int totalPrice = int.Parse(lblTotalPrice.Text); if (totalPrice <= 0) { Response.Write(MessagesBox.showMessages("请点击重新计算或选择所要购买的商品!")); } else { if (balance >= totalPrice)//判断买家余额是否足够 { if (chkIsOnline.Checked == true) { buyer.AddMoney(account, -1.0 * totalPrice);//扣除买家余额 } for (int i = 0; i < gv.Rows.Count; i++) { CheckBox chkProduct = (CheckBox)gv.Rows[i].FindControl("chkProducts"); if (chkProduct.Checked == true) { //向买家订单表插数据 b_order = new b_order_Entity(); b_order.B_account = gv.Rows[i].Cells[1].Text; b_order.S_account = gv.Rows[i].Cells[2].Text; b_order.S_storeName = gv.Rows[i].Cells[3].Text; b_order.B_o_totalprice = double.Parse(lblTotalPrice.Text); if (chkIsOnline.Checked == true) { b_order.B_order_state = "已付款"; } else { b_order.B_order_state = "未支付"; } //记录上一次的卖家和买家账号用于判断所选的是否属性同一个订单 string b_account = ""; //买家账号 string s_account = ""; //卖家账号 if (i > 0) { b_account = gv.Rows[i - 1].Cells[1].Text; s_account = gv.Rows[i - 1].Cells[2].Text; } //如果是第一个商品的话,增加一条订单记录 if (i == 0) { buyer.AddOrder(b_order.B_account, b_order.S_account, b_order.S_storeName, b_order.B_order_state, b_order.B_o_totalprice); } else { //根据买家、卖家账号判断所选商品是否属性同一个订单 if (b_account == gv.Rows[i].Cells[1].Text && s_account == gv.Rows[i].Cells[2].Text) { } else { buyer.AddOrder(b_order.B_account, b_order.S_account, b_order.S_storeName, b_order.B_order_state, b_order.B_o_totalprice); } } //向买家订单项目表插数据 int id = buyer.searchLatestBOrderId();//获取最新的订单编号 b_order_item = new b_order_item_Entity(); b_order_item.B_o_id = id; b_order_item.P_id = int.Parse(gv.Rows[i].Cells[4].Text); b_order_item.P_price = double.Parse(gv.Rows[i].Cells[6].Text); TextBox txtNum = (TextBox)gv.Rows[i].FindControl("txtNum"); b_order_item.P_num = int.Parse(txtNum.Text); //buyer.AddOrderItem(b_order_item.B_o_id, b_order_item.P_id, b_order_item.P_price, b_order_item.P_num); //向买家订单状态表插数据 b_order_state = new b_order_state_Entity(); b_order_state.B_o_id = id; b_order_state.B_o_subTime = DateTime.Now; if (chkIsOnline.Checked == true) { b_order_state.B_o_state = "已付款"; } else { b_order_state.B_o_state = "未支付"; } //buyer.AddOrderState(b_order_state.B_o_id, b_order_state.B_o_state); buyer.DeleteFromCart(Session["UserAccount"].ToString().Trim(), int.Parse(gv.Rows[i].Cells[4].Text)); } } Response.Write(MessagesBox.showMessages("提交结算成功!")); Response.Redirect("../Default.aspx"); } else { Response.Write(MessagesBox.showMessages("您的余额不足,请充值!")); Response.Redirect("../buyer/SearchBalance.aspx"); } } }