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

📄 salehouseform.cs

📁 C++编写的房产中介管理系统
💻 CS
字号:
//文件名:SaleHouseForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using System.Data.SqlClient;

namespace MyHouse
{
    public partial class SaleHouseForm : Form
    {
        public SaleHouseForm()
        {
            InitializeComponent();
        }

  

        private void SaleHouseForm_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“myHouseDataSet1.出售房源管理”中。您可以根据需要移动或移除它。
            this.出售房源管理TableAdapter.Fill(this.myHouseDataSet1.出售房源管理);
            String MySQLConnectionString = global::MyHouse.Properties.Settings.Default.MyHouseConnectionString;
            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[] MyDistData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyDistData)
            {
                this.所在城区ComboBox.Items.Add(MyString);                
            }
            MyName = "类型";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyTypeData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyTypeData)
            {
                this.楼层类型ComboBox.Items.Add(MyString);
            }
            MyName = "朝向";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyDireData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyDireData)
            {
                this.朝向ComboBox.Items.Add(MyString);
            }

            MyName = "用途";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyUseData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyUseData)
            {
                this.房屋用途ComboBox.Items.Add(MyString);
            }
            MyName = "产权";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyPreData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyPreData)
            {
                this.产权性质ComboBox.Items.Add(MyString);
            }
            MyName = "结构";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyStruData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyStruData)
            {
                this.房屋结构ComboBox.Items.Add(MyString);
            }
            MyName = "装修";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyDecoData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyDecoData)
            {
                this.装修级别ComboBox.Items.Add(MyString);
            }
            MyName = "证件";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyCertData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyCertData)
            {
                this.权证名称ComboBox.Items.Add(MyString);
            }
            MyName = "付款";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyPayData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyPayData)
            {
                this.付款方式ComboBox.Items.Add(MyString);
            }
            MyName = "货币";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyMoneyData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyMoneyData)
            {
                this.货币名称ComboBox.Items.Add(MyString);
            }
            MyName = "付佣";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyFeeData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyFeeData)
            {
                this.付佣类别ComboBox.Items.Add(MyString);
            }
            MyName = "委托";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyDeleData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyDeleData)
            {
                this.委托方式ComboBox.Items.Add(MyString);
            }
            MyName = "来源";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MySourceData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MySourceData)
            {
                this.信息来源ComboBox.Items.Add(MyString);
            }
            MyName = "状态";
            MyValue = MyHouseTable.Rows[0][MyName].ToString();
            String[] MyStatusData = MyValue.Split(new char[1] { '、' });
            foreach (String MyString in MyStatusData)
            {
                this.状态ComboBox.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.经纪人ComboBox.Items.Add(MyRow[MyName].ToString());
            }        
            if (MyConnection.State == ConnectionState.Open)
            {
                MyConnection.Close();
            }
        }
        public  string MyTel = "";
        private void 打印ToolStripButton_Click(object sender, EventArgs e)
        {
            this.printPreviewDialog1.Document = this.printDocument1;
            this.printPreviewDialog1.ShowDialog();
        }

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {//打印出售房源
            e.Graphics.DrawString("出 售 房 源" , new Font("宋体", 50), Brushes.Black, 220, 40);
            e.Graphics.DrawLine(new Pen(Color.Black, (float)3.00), 50, 120, 770, 120);        
            e.Graphics.DrawString("编号:" + this.自编号TextBox.Text, new Font("宋体", 20), Brushes.Black, 50, 140);
            e.Graphics.DrawString("位置:" + this.所在城区ComboBox.Text+this.具体位置TextBox.Text, new Font("宋体", 20), Brushes.Black, 350, 140);
            e.Graphics.DrawLine(new Pen(Color.Black), 50, 170, 770, 170);
            e.Graphics.DrawString("类型:" + this.楼层类型ComboBox.Text+this.房屋结构ComboBox.Text, new Font("宋体", 20), Brushes.Black, 50, 190);
            e.Graphics.DrawString("楼层:" + this.楼层TextBox.Text+"/"+this.总层TextBox.Text  , new Font("宋体", 20), Brushes.Black, 350, 190);
            e.Graphics.DrawString("建成年份:" + this.建成年份DateTimePicker.Value.Year.ToString()+"年", new Font("宋体", 20), Brushes.Black, 520, 190);
            e.Graphics.DrawLine(new Pen(Color.Black), 50, 220, 770, 220);
            e.Graphics.DrawString("结构:" + this.房TextBox.Text + "房" + this.厅TextBox.Text + "厅" + this.厨TextBox.Text + "厨" + this.卫TextBox.Text + "卫" + this.阳TextBox.Text + "阳台", new Font("宋体", 20), Brushes.Black, 50, 240);
            e.Graphics.DrawString("产权:" + this.产权性质ComboBox.Text, new Font("宋体", 20), Brushes.Black, 390, 240);
            e.Graphics.DrawString("土地:" + this.土地性质ComboBox.Text, new Font("宋体", 20), Brushes.Black, 610, 240);
            e.Graphics.DrawLine(new Pen(Color.Black), 50, 270, 770, 270);
            e.Graphics.DrawString("建面(m2):" + this.建筑面积TextBox.Text, new Font("宋体", 20), Brushes.Black, 50, 290);
            e.Graphics.DrawString("套面(m2):" + this.套内面积TextBox.Text, new Font("宋体", 20), Brushes.Black, 300, 290);
            e.Graphics.DrawString("装修:" + this.装修级别ComboBox.Text, new Font("宋体", 20), Brushes.Black, 550, 290);
            e.Graphics.DrawLine(new Pen(Color.Black), 50, 320, 770, 320);
            e.Graphics.DrawString("家私:" + this.家私TextBox.Text, new Font("宋体", 20), Brushes.Black, 50, 340);
            e.Graphics.DrawString("家电:" + this.家电TextBox.Text, new Font("宋体", 20), Brushes.Black, 350, 340);
            e.Graphics.DrawLine(new Pen(Color.Black), 50, 375, 770, 375);
            e.Graphics.DrawString("配套设施:" + this.配套设施TextBox.Text, new Font("宋体", 20), Brushes.Black, 50, 390);
            e.Graphics.DrawString("售价:" + (Convert.ToDouble(this.价格TextBox.Text)/10000).ToString()+"万元", new Font("宋体", 20), Brushes.Black, 600, 390);
            e.Graphics.DrawLine(new Pen(Color.Black, (float)3.00), 50, 425, 770, 425);
            //e.Graphics.DrawString("有效日期:" + this.截止日期DateTimePicker.Text + "前", new Font("宋体", 16), Brushes.Black, 50, 440);                   
            e.Graphics.DrawString("联系电话:" + this.MyTel + " 联系人:" + this.经纪人ComboBox.Text, new Font("宋体", 16), Brushes.Black, 350, 440);                   
        }

        private void 出售房源管理BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.出售房源管理BindingSource.EndEdit();
            this.出售房源管理TableAdapter.Update(this.myHouseDataSet1.出售房源管理);
        }
        private void 查询ToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                this.出售房源管理TableAdapter.FillBy(this.myHouseDataSet1.出售房源管理, 自编号ToolStripTextBox.Text, 经纪人ToolStripTextBox.Text);         
            }
            catch (System.Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }
    }
}

⌨️ 快捷键说明

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