protected void Btn_Add_Click(object sender, EventArgs e) { HuaJiaCartModel huaJiaCartModel = new HuaJiaCartModel(); huaJiaCartModel.setUsername(Session["username"].ToString()); int medicineId = Int32.Parse(this.MedicineId.SelectedValue); huaJiaCartModel.setMedicineId(medicineId); float price = MedicineLogic.getPriceById(medicineId); huaJiaCartModel.setPrice(price); int count = Int32.Parse(this.Count.Text); huaJiaCartModel.setCount(count); float totalPrice = price * count; huaJiaCartModel.setTotalPrice(totalPrice); HuaJiaCartLogic huaJiaCartLogic = new HuaJiaCartLogic(); if (huaJiaCartLogic.AddHuaJiaCartInfo(huaJiaCartModel)) { Response.Write("<script>alert('药品划价销售信息添加成功!');location.href='HuaJiaAdd.aspx';</script>"); } else { Response.Write("<script>alert('" + huaJiaCartLogic.getErrMessage() + "');location.href='HuaJiaAdd.aspx';</script>"); } }