open.aspx.cs

来自「物业管理系统」· CS 代码 · 共 67 行

CS
67
字号
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class Stockpile_open : System.Web.UI.Page
{
    BaseClass bc = new BaseClass();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Convert.ToString(Session["UID"]) == "")
        {
            Response.Redirect("login.aspx");

        }
        else
        {
            manageman.Text = Session["adminName"].ToString();
        }
        if (!IsPostBack)
        {
            string sql = "select notpayment from homechargefee where id=" + Request["id"].ToString();
            this.payment.Text = ((decimal)bc.ExecCscalar(sql)).ToString();
          
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string payment = this.payment.Text;
        string manageman = this.manageman.Text;
        string username = Convert.ToString(Session["adminName"]);
        string notsql = "select notpayment from homechargefee where id=" + Request["id"].ToString();
        decimal notpayment = (decimal)bc.ExecCscalar(notsql);
       
       



        if (Convert.ToDecimal(this.payment.Text) > notpayment)
        {
            Response.Write("<script>alert('您填写的结款金额大于实际未付金额');history.back()</script>");
            Response.End();
        }
        
        string sql="update homechargefee set factpayment=factpayment+"+payment+",notpayment=notpayment-"+payment+",handle='"+username+"' where id="+Request["id"].ToString();

       // Response.Write(sql);
     //  Response.End();
        if (bc.ExecSql(sql))
        {
             Response.Write("<script>alert('成功');opener.location='homechargefee.aspx';window.close()</script>");
        }
        else
        {
            Response.Write("<script>alert('修改失败,请重试!');</script>");
        }
       
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?