protected void Button1_Click(object sender, EventArgs e) { Ord = new orders(); Ord.setP_id(p_id.Text); Ord.setPr_number(pr_number.Text); Ord.setS_amount(Convert.ToInt32(amount.SelectedValue)); Ord.setS_date(s_date.Text); Ord.setS_e_id(s_e_id.Text); Ord.setS_get(Convert.ToDouble(s_get.Text)); Ord.setS_id(s_id.Text); Ord.setS_price(Convert.ToInt32(s_price.Text)); Ord.setS_return(Convert.ToDouble(s_return.Text)); Ord.setS_summary(Convert.ToDouble(s_summary.Text)); Ord.setS_way(s_way.Text); bool flag = SS.salePhone(Ord); if (flag) { Response.Write("<script>alert('购买成功!');</script>"); // 建立实例 IncomeExpenseAction IEA = new IncomeExpenseAction(); // 新建收支明细对象 IEA.addIncomeExpense(); // 设置交易内容 IEA.setIEDeal(Ord.getS_summary(), "", "", "", ""); // 设置交易人内容 IEA.setIEDealMan(Ord.getS_date(), "收入", "现金交易", Ord.getS_e_id()); // 设置交易备注 IEA.setIENote(""); // 提交并操作 IEA.submit(); } else { Response.Write("<script>alert('购买失败!');</script>"); } }
/***************************************************** * - Function name : submit_Click * - Description : 提交响应 * - Variables : object sender, EventArgs e *****************************************************/ protected void submit_Click(object sender, EventArgs e) { // 获取输入值 double money = double.Parse(TextBoxMoney.Text.ToString()); string y = DropDownListYear.Text.ToString(); string m = DropDownListMonth.Text.ToString(); string d = DropDownListDay.Text.ToString(); string h = System.DateTime.Now.Hour.ToString(); string min = System.DateTime.Now.Minute.ToString(); string sec = System.DateTime.Now.Second.ToString(); string date = y + "/" + m + "/" + d + " " + h + ":" + min + ":" + sec; string deal_kind = ""; if (RadioButton1.Checked == true) { deal_kind = "收入"; } else if (RadioButton2.Checked == true) { deal_kind = "支出"; } string receive_name = TextBoxReceiveMan.Text.ToString(); string receive_card = TextBoxReceiveCard.Text.ToString(); string allocate_name = TextBoxAllocateMan.Text.ToString(); string allocate_card = TextBoxAllocateCard.Text.ToString(); string deal_way = DropDownListDealway.Text.ToString(); FinanceDatabaseHelper FDH = new FinanceDatabaseHelper(); string deal_man = TextBoxDealMan.Text.ToString(); string assure_id = FDH.getEmployeeID(deal_man); string note = TextBoxNote.Text.ToString(); // 检验办理人是否合理 if (deal_man != "匿名") { if (deal_man == "") { Response.Write("<script>alert('办理人不合法!');</script>"); return; } } // 创建控制类 IncomeExpenseAction IEA = new IncomeExpenseAction(); // 新建收支对象 IEA.addIncomeExpense(); // 设置属性值 IEA.setIEDeal(money, receive_name, receive_card, allocate_name, allocate_card); IEA.setIEDealMan(date, deal_kind, deal_way, assure_id); IEA.setIENote(note); // 保存 IncomeExpenseService IES = new IncomeExpenseService(); if (IES.saveIncomeExpenseRecord(IEA.getIncomeExpense())) { Response.Write("<script type='text/javascript'>alert('添加成功!');window.location='financeHome.aspx'</script>"); } else { Response.Write("<script>alert('添加失败!');</script>"); } }