📄 frmclient.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using HouseBE;
using HouseBS;
namespace frmLogin
{
/// <summary>
/// frmClient 的摘要说明。
/// </summary>
public class frmClient : System.Windows.Forms.Form
{
private DevComponents.DotNetBar.Controls.GroupPanel groupPanel1;
private DevComponents.DotNetBar.ButtonX buttonX1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private HouseBE.Client ClientBE=new Client();
private HouseBS.ClientBS ClientBS=new ClientBS();
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.ColumnHeader columnHeader4;
private System.Windows.Forms.ColumnHeader columnHeader5;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.ColumnHeader columnHeader10;
private DevComponents.DotNetBar.Controls.TextBoxX txtname;
private ArrayList list;
public frmClient()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmClient));
this.groupPanel1 = new DevComponents.DotNetBar.Controls.GroupPanel();
this.label1 = new System.Windows.Forms.Label();
this.buttonX1 = new DevComponents.DotNetBar.ButtonX();
this.txtname = new DevComponents.DotNetBar.Controls.TextBoxX();
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
this.columnHeader10 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.groupPanel1.SuspendLayout();
this.SuspendLayout();
//
// groupPanel1
//
this.groupPanel1.CanvasColor = System.Drawing.SystemColors.Control;
this.groupPanel1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007;
this.groupPanel1.Controls.Add(this.label1);
this.groupPanel1.Controls.Add(this.buttonX1);
this.groupPanel1.Controls.Add(this.txtname);
this.groupPanel1.Dock = System.Windows.Forms.DockStyle.Top;
this.groupPanel1.Location = new System.Drawing.Point(0, 0);
this.groupPanel1.Name = "groupPanel1";
this.groupPanel1.Size = new System.Drawing.Size(624, 88);
//
// groupPanel1.Style
//
this.groupPanel1.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2;
this.groupPanel1.Style.BackColorGradientAngle = 90;
this.groupPanel1.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground;
this.groupPanel1.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel1.Style.BorderBottomWidth = 1;
this.groupPanel1.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.groupPanel1.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel1.Style.BorderLeftWidth = 1;
this.groupPanel1.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel1.Style.BorderRightWidth = 1;
this.groupPanel1.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid;
this.groupPanel1.Style.BorderTopWidth = 1;
this.groupPanel1.Style.CornerDiameter = 4;
this.groupPanel1.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
this.groupPanel1.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
this.groupPanel1.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
this.groupPanel1.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near;
this.groupPanel1.TabIndex = 0;
this.groupPanel1.Text = "客户信息查询";
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.ForeColor = System.Drawing.Color.Black;
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.TabIndex = 6;
this.label1.Text = "客户姓名:";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// buttonX1
//
this.buttonX1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.buttonX1.Location = new System.Drawing.Point(400, 16);
this.buttonX1.Name = "buttonX1";
this.buttonX1.Size = new System.Drawing.Size(80, 24);
this.buttonX1.TabIndex = 5;
this.buttonX1.Text = "查询";
this.buttonX1.Click += new System.EventHandler(this.buttonX1_Click);
//
// txtname
//
this.txtname.AutoSize = false;
//
// txtname.Border
//
this.txtname.Border.Class = "TextBoxBorder";
this.txtname.Location = new System.Drawing.Point(152, 16);
this.txtname.Name = "txtname";
this.txtname.Size = new System.Drawing.Size(192, 21);
this.txtname.TabIndex = 3;
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader2,
this.columnHeader4,
this.columnHeader5,
this.columnHeader10,
this.columnHeader7,
this.columnHeader8});
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listView1.GridLines = true;
this.listView1.Location = new System.Drawing.Point(0, 88);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(624, 341);
this.listView1.TabIndex = 3;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
//
// columnHeader1
//
this.columnHeader1.Text = "客户姓名";
this.columnHeader1.Width = 72;
//
// columnHeader2
//
this.columnHeader2.Text = "联系电话";
this.columnHeader2.Width = 100;
//
// columnHeader4
//
this.columnHeader4.Text = "需求楼层";
this.columnHeader4.Width = 84;
//
// columnHeader5
//
this.columnHeader5.Text = "形式";
this.columnHeader5.Width = 64;
//
// columnHeader10
//
this.columnHeader10.Text = "朝向";
this.columnHeader10.Width = 73;
//
// columnHeader7
//
this.columnHeader7.Text = "需求面积";
this.columnHeader7.Width = 111;
//
// columnHeader8
//
this.columnHeader8.Text = "购房状态";
this.columnHeader8.Width = 103;
//
// frmClient
//
this.AcceptButton = this.buttonX1;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(624, 429);
this.Controls.Add(this.listView1);
this.Controls.Add(this.groupPanel1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "frmClient";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "客户信息";
this.Load += new System.EventHandler(this.frmClient_Load);
this.groupPanel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void buttonX1_Click(object sender, System.EventArgs e)
{
this.listView1.Items.Clear();
//添加信息
if(this.txtname.Text.Length<1 || this.txtname.Equals(""))
{
//添加购房客户信息
this.list=new ArrayList();
this.list=this.ClientBS.GetMessage();
for(int i=0;i<this.list.Count;i++)
{
this.ClientBE=new Client();
this.ClientBE=(Client)list[i];
ListViewItem lst=new ListViewItem();
lst.SubItems[0].Text=this.ClientBE.ClientName;
lst.SubItems.Add(this.ClientBE.ClientTelphone);
lst.SubItems.Add(this.ClientBE.getFloor.ToString());
lst.SubItems.Add(this.ClientBE.getFormat);
lst.SubItems.Add(this.ClientBE.getXiang);
lst.SubItems.Add(this.ClientBE.getArea.ToString());
lst.SubItems.Add(this.ClientBE.Getstate);
this.listView1.Items.Add(lst);
}
}
else
{
//根据客户姓名查询信息
string name=this.txtname.Text;
this.ClientBE=new Client();
this.ClientBE.ClientName=name;
this.ClientBS=new ClientBS();
this.ClientBS.client=this.ClientBE;
this.ClientBE=new Client();
this.ClientBE=this.ClientBS.getMessage();
this.txtname.Text="";
if(this.ClientBE!=null)
{
//添加信息
ListViewItem lst=new ListViewItem();
lst.SubItems[0].Text=this.ClientBE.ClientName;
lst.SubItems.Add(this.ClientBE.ClientTelphone);
lst.SubItems.Add(this.ClientBE.getFloor.ToString());
lst.SubItems.Add(this.ClientBE.getFormat);
lst.SubItems.Add(this.ClientBE.getXiang);
lst.SubItems.Add(this.ClientBE.getArea.ToString());
lst.SubItems.Add(this.ClientBE.Getstate);
this.listView1.Items.Add(lst);
}
else
{
MessageBox.Show("此人信息不存在");
}
}
}
private void frmClient_Load(object sender, System.EventArgs e)
{
}
private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
private void listView1_DoubleClick(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -