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

📄 contractform.aspx.cs

📁 一个房屋中介系统的源码
💻 CS
字号:
//文件名:ContractForm.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 ContractManage_ContractForm : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string MyForbidString = Session["MyForbid"].ToString();
        if (MyForbidString.IndexOf("D3") > 1)
        {
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx");
        }
        if (!IsPostBack)
        {
            String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString;
            string MySQL = "Select * From 房源参数 Where 自编号='CQ001'";
            SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
            MyConnection.Open();
            DataTable MyHouseTable = new DataTable();
            SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
            MyAdapter.Fill(MyHouseTable);
            string MyName = "付款";
            string MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyPayData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyPayData)
            {
                this.DropDownList3.Items.Add(MyString);
            }
            MySQL = "Select * From 职员信息";
            DataTable MyPersonnelTable = new DataTable();
            MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
            MyAdapter.Fill(MyPersonnelTable);
            MyName = "职员姓名";
            MyValue = MyPersonnelTable.Rows[0][MyName].ToString();
            foreach (DataRow MyRow in MyPersonnelTable.Rows)
            {
                this.DropDownList1.Items.Add(MyRow[MyName].ToString());
            }
            if (MyConnection.State == ConnectionState.Open)
            {
                MyConnection.Close();
            }
        } 
    }
    protected void Button4_Click(object sender, EventArgs e)
    {//显示合同文件
        string MyPath = HttpContext.Current.Server.MapPath("~/FileData/") + this.TextBox18.Text;
        System.Diagnostics.Process.Start(MyPath);
     }
    protected void btnUpload_Click(object sender, EventArgs e)
    {//上传合同文件
        string MyFileName = this.FileUpload1.FileName;
        string MyTargetFile = System.IO.Path.Combine(HttpContext.Current.Server.MapPath("~/FileData/"), MyFileName);
        this.FileUpload1.PostedFile.SaveAs(MyTargetFile);     
    }
    protected void Button2_Click(object sender, EventArgs e)
    {//新增租售成交信息
        String MySQLConnectionString = ConfigurationManager.ConnectionStrings["MyHouseDBConnectionString"].ConnectionString;
        string MySQL = "Select * From 租售成交 Where (资料类型='" + this.DropDownList2.Text + "') AND (资料编号='" + this.TextBox7.Text + "')";
        SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
        MyConnection.Open();
        DataTable MyQueryTable = new DataTable();
        SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
        MyAdapter.Fill(MyQueryTable);
        if (MyQueryTable.Rows.Count > 0)
            return;
        if (MyConnection.State == ConnectionState.Open)
        {
            MyConnection.Close();
        }
        this.SqlDataSource1.Insert();
    }
    protected void Button3_Click(object sender, EventArgs e)
    {//修改租售成交信息
        this.SqlDataSource1.Update();
    }
    protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
    {//弹出删除操作确认对话框
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            Button MyButton = (Button)e.Row.FindControl("Button1");
            MyButton.OnClientClick = "return confirm('是否确认删除当前选择的记录?')";
        }
    }
    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {//在控件中显示选择的记录
        this.TextBox20.Text = this.GridView1.SelectedRow.Cells[2].Text.ToString();
        this.DropDownList1.SelectedValue = this.GridView1.SelectedRow.Cells[3].Text.ToString();
        this.DropDownList2.SelectedValue = this.GridView1.SelectedRow.Cells[4].Text.ToString();
        this.TextBox7.Text = this.GridView1.SelectedRow.Cells[5].Text.ToString();
        this.TextBox8.Text = this.GridView1.SelectedRow.Cells[6].Text.ToString();
        this.TextBox9.Text = this.GridView1.SelectedRow.Cells[7].Text.ToString();
        this.TextBox10.Text = this.GridView1.SelectedRow.Cells[8].Text.ToString();
        this.DropDownList3.SelectedValue = this.GridView1.SelectedRow.Cells[9].Text.ToString();
        this.TextBox12.Text = this.GridView1.SelectedRow.Cells[10].Text.ToString();
        this.TextBox13.Text = this.GridView1.SelectedRow.Cells[11].Text.ToString();
        this.TextBox14.Text = this.GridView1.SelectedRow.Cells[12].Text.ToString();
        this.TextBox15.Text = this.GridView1.SelectedRow.Cells[13].Text.ToString();
        this.TextBox16.Text = this.GridView1.SelectedRow.Cells[14].Text.ToString();
        this.TextBox17.Text = this.GridView1.SelectedRow.Cells[15].Text.ToString();
        this.TextBox18.Text = this.GridView1.SelectedRow.Cells[16].Text.ToString();
        this.TextBox19.Text = this.GridView1.SelectedRow.Cells[17].Text.ToString();        
    }
}

⌨️ 快捷键说明

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