📄 leaseclientform.cs
字号:
//文件名:LeaseClientForm.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 LeaseClientForm : Form
{
public LeaseClientForm()
{
InitializeComponent();
}
public string MyTel;
private void 求租客户管理BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.求租客户管理BindingSource.EndEdit();
this.求租客户管理TableAdapter.Update(this.myHouseDataSet.求租客户管理);
}
private void LeaseClientForm_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“myHouseDataSet.求租客户管理”中。您可以根据需要移动或移除它。
this.求租客户管理TableAdapter.Fill(this.myHouseDataSet.求租客户管理);
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[] 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[] MyPayData = MyValue.Split(new char[1] { '、' });
foreach (String MyString in MyPayData)
{
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[] 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();
}
}
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, 450, 140);
e.Graphics.DrawLine(new Pen(Color.Black), 50, 170, 770, 170);
e.Graphics.DrawString("楼层类型:" + this.楼层类型ComboBox.Text, new Font("宋体", 20), Brushes.Black, 50, 190);
e.Graphics.DrawString("房龄要求:" + this.房龄TextBox.Text+"后", new Font("宋体", 20), Brushes.Black, 450, 190);
e.Graphics.DrawLine(new Pen(Color.Black), 50, 220, 770, 220);
e.Graphics.DrawString("房屋结构:" + this.最小房间数TextBox.Text + "~" + this.最大房间数TextBox.Text + "房", new Font("宋体", 20), Brushes.Black, 50, 240);
e.Graphics.DrawString("付租方式:" + this.付租方式ComboBox.Text, new Font("宋体", 20), Brushes.Black, 450, 240);
e.Graphics.DrawLine(new Pen(Color.Black), 50, 270, 770, 270);
e.Graphics.DrawString("面积(m2):" + this.最小面积TextBox.Text + "~" + this.最大面积TextBox.Text + "m2", new Font("宋体", 20), Brushes.Black, 50, 290);
e.Graphics.DrawString("装修级别:" + this.装修级别ComboBox.Text, new Font("宋体", 20), Brushes.Black, 450, 290);
e.Graphics.DrawLine(new Pen(Color.Black), 50, 320, 770, 320);
e.Graphics.DrawString("求租价格:" + this.最低租价TextBox.Text + "~" + this.最高租价TextBox.Text + "元", new Font("宋体", 20), Brushes.Black, 50, 340);
e.Graphics.DrawString("家具家电:" + this.家具家电TextBox.Text, new Font("宋体", 20), Brushes.Black, 450, 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.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 查询ToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.求租客户管理TableAdapter.FillBy(this.myHouseDataSet.求租客户管理, 自编号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 + -