⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 managepaymentform.aspx.cs

📁 小区物业管理系统源代码,密码:123456,
💻 CS
字号:
//文件名:ManagePaymentForm.aspx.cs
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 ChargeManage_ManagePaymentForm : System.Web.UI.Page
{
    private static DataTable MyManageTable = new DataTable();
    private static Double MyAmount = 0; 
    protected void Page_Load(object sender, EventArgs e)
    {
        string MyForbidString = Session["MyForbid"].ToString();
        if (MyForbidString.IndexOf("C6") > 1)
        {
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
        }
        this.Button3.OnClientClick = "return confirm('请检查物业管理费收据信息是否正确,一旦保存就无法修改,是否继续?')";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {//新增物管费收据
        MyAmount = 0;
        this.TextBox1.Text = System.Guid.NewGuid().ToString().ToUpper();
        this.TextBox2.Text = DateTime.Now.ToShortDateString();
        this.TextBox6.Text = Session["MyUserName"].ToString();
        //创建无连接的数据表
        DataColumn[] MyKey = new DataColumn[1];
        MyManageTable = new DataTable("物业管理费明细表");
        DataColumn MyColumn = new DataColumn();
        MyColumn.DataType = System.Type.GetType("System.Int16");
        MyColumn.ColumnName = "序号";
        MyManageTable.Columns.Add(MyColumn);
        MyKey[0] = MyColumn;
        MyManageTable.PrimaryKey = MyKey;
        MyManageTable.Columns.Add("年份", System.Type.GetType("System.Int16"));
        MyManageTable.Columns.Add("月份", System.Type.GetType("System.Int16"));
        MyManageTable.Columns.Add("建面", System.Type.GetType("System.Double"));
        MyManageTable.Columns.Add("套面", System.Type.GetType("System.Double"));
        MyManageTable.Columns.Add("单价", System.Type.GetType("System.Double"));
        MyManageTable.Columns.Add("金额", System.Type.GetType("System.Double"));
        MyManageTable.Rows.Clear();
        this.GridView2.DataSource = MyManageTable;
        this.GridView2.DataBind();
    }
    protected void Button2_Click(object sender, EventArgs e)
    {//打印物管费收据
        Server.Transfer("~/ChargeManage/ManagePaymentPrint.aspx");
    }
    public DataTable MyPrintDataTable
    {//设置要传递到打印页的数据
        get
        {
            return MyManageTable;
        }
    }
    public String MyPrint补充说明
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox8.Text;
        }
    }
    public String MyPrint收据编号
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox1.Text;
        }
    }
    public String MyPrint收款日期
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox2.Text;
        }
    }
    public String MyPrint交款人员
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox3.Text;
        }
    }
    public String MyPrint收款金额
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox4.Text;
        }
    }
    public String MyPrint收款形式
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox5.Text;
        }
    }
    public String MyPrint收款事由
    {//设置要传递到打印页的数据
        get
        {
            return this.DropDownList1.SelectedItem.Text + this.DropDownList2.SelectedItem.Text + this.TextBox7.Text;
        }
    }
    public String MyPrint收款人员
    {//设置要传递到打印页的数据
        get
        {
            return this.TextBox6.Text;
        }
    }
    protected void Button3_Click(object sender, EventArgs e)
    {//保存物管费收据
        String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyCommunityDBConnectionString"].ConnectionString;
        SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
        MyConnection.Open();
        SqlCommand MyCommand = MyConnection.CreateCommand();
        string MySQL = "INSERT INTO 费用收据(收据编号,收款日期,交款人员,收款金额,收款形式,收款人员,收款事由,补充说明) VALUES('";
        MySQL += this.TextBox1.Text + "','";
        MySQL += this.TextBox2.Text + "','";
        MySQL += this.TextBox3.Text + "',";
        MySQL += this.TextBox4.Text + ",'";
        MySQL += this.TextBox5.Text + "','";
        MySQL += this.TextBox6.Text + "','";
        MySQL += this.TextBox7.Text + "','";
        MySQL += this.TextBox8.Text + "');";
        MyCommand.CommandText = MySQL;
        MyCommand.ExecuteNonQuery();      
        foreach (DataRow MyRow in MyManageTable.Rows)
        {
            string My原编号 = MyRow[0].ToString();
            string My收据编号 = this.TextBox1.Text;
            MySQL = "UPDATE 物管费用 SET 费用状态='已交费',收据编号='" + My收据编号 + "' WHERE 自动编号=" + My原编号;
            MyCommand.CommandText = MySQL;
            MyCommand.ExecuteNonQuery();
        }
        if (MyConnection.State == ConnectionState.Open)
        {
            MyConnection.Close();
        }
        Server.Transfer("~/ChargeManage/ManagePaymentForm.aspx");
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {//增加物业管理费
        if ((this.TextBox1.Text.Length > 1) && (this.TextBox3.Text.Length > 1))
        {
            try
            {
                DataRow MyRow = MyManageTable.NewRow();
                MyRow[0] = Convert.ToInt16(this.GridView1.SelectedRow.Cells[1].Text.ToString());
                MyRow["年份"] = Convert.ToInt16(this.GridView1.SelectedRow.Cells[2].Text.ToString());
                MyRow["月份"] = Convert.ToInt16(this.GridView1.SelectedRow.Cells[3].Text.ToString());
                MyRow["建面"] = Convert.ToDouble(this.GridView1.SelectedRow.Cells[4].Text.ToString());
                MyRow["套面"] = Convert.ToDouble(this.GridView1.SelectedRow.Cells[5].Text.ToString());
                MyRow["单价"] = Convert.ToDouble(this.GridView1.SelectedRow.Cells[6].Text.ToString());
                MyRow["金额"] = Convert.ToDouble(this.GridView1.SelectedRow.Cells[7].Text.ToString());
                MyManageTable.Rows.Add(MyRow);
                this.GridView2.DataSource = MyManageTable;
                this.GridView2.DataBind();
                MyAmount += Convert.ToDouble(this.GridView1.SelectedRow.Cells[7].Text.ToString());
                this.TextBox4.Text = MyAmount.ToString();
            }
            catch (Exception MyException)
            {
            }            
        }
    }
}

⌨️ 快捷键说明

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