protected void BtnOfSupportSmall_Click(object sender, EventArgs e) { CalculationManager calculationManager = new CalculationManager(); ProjectManager projectManager = new ProjectManager(); SupportProjectManager supportProjectManager = new SupportProjectManager(); //用户捐款的金额 decimal Money = int.Parse(this.SupportSmall.Text); int ProjectId = int.Parse(Request.QueryString["Id"]); int UserId = int.Parse(((Session["user"] as User).Id).ToString()); Project project = projectManager.GetModel(ProjectId); //查看距离完成捐款还差多少钱 decimal Difference = project.Goal - project.CurrentMoney; if (Difference == 0) { Response.Write("<script>alert('当前项目已筹到目标金额!');</script>"); return; } else { if (Money < Difference) { if (calculationManager.CurrentMoneyAddition(ProjectId, Money) > 0 && supportProjectManager.InsertData(UserId, ProjectId, Money) > 0) { Response.Write("<script>alert('感谢您的捐款,祝您生活愉快');</script>"); Response.Write("<script> window.location.href = document.URL; </script>"); } else { Response.Write("<script>alert('捐款失败');</script>"); return; } } else { Response.Write("<script>alert('捐款的金额过多!当前项目距离完成集资还差" + Difference + "'元);</script>"); return; } } }