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

📄 frmbuymanager.cs

📁 实现房产销售的房屋管理 客户管理 并且在客户管理中实现了对预定客户和已购房客户的查询和修改
💻 CS
📖 第 1 页 / 共 2 页
字号:

		}
		#endregion

		private void frmBuyManager_Load(object sender, System.EventArgs e)
		{
		    this._ds=this._lps.select();
			foreach(DataRow row in this._ds.Tables[0].Rows)
			{
				this.comboBoxEx1.Items.Add(row[1].ToString());
			}

			this.toolBarButton5.Enabled=false;
			this.toolBarButton6.Enabled=false;
			this.toolBarButton7.Enabled=false;
		}

		private void comboBoxEx1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
				this.treeView1.ShowPlusMinus=true;
				this.treeView1.Nodes.Clear();
				TreeNode node=new TreeNode(this.comboBoxEx1.Text);
				this.treeView1.Nodes.Add(node);
		}

		private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
		{
			
			//获得当前选中的Node对象 
			DataSet dt=new DataSet();
			
			TreeNode node=this.treeView1.SelectedNode;
		    if(node.Text!="")
			{   
				string tag="";
				//加载楼盘信息
				foreach(DataRow row in this._ds.Tables["LPMessage"].Rows)
				{   
					if(node.Text.Trim().Equals(row[1].ToString().Trim()))
					 {
					   tag=row[0].ToString();
					 }
				}
				if(tag!="")
				{
					dt=new DataSet();
					dt=this._lps.selectBytag(tag);
					if(node.Nodes.Count>0)
					{ 
					  
					}
					else
					{
						   //加载楼房信息
						    node.Nodes.Clear();
						    this.table=new Hashtable();
							foreach(DataRow row in dt.Tables["House"].Rows)
							{
								node.Nodes.Add(row[1].ToString());
						        table.Add(row[1].ToString(),row[0].ToString());
							}
					}
				}
				else
				{
				   string tags=table[node.Text].ToString();
			       this.listView1.Items.Clear();
				   DataSet ds1=new DataSet();
				   HouseBS.HomeBS home=new HomeBS();
					//根据编号查询
                  
                    ds1=home.selectByTag(tags);
					foreach(DataRow row in ds1.Tables[0].Rows)
					{
					  ListViewItem list=new ListViewItem(row[0].ToString(),10);
					  this.listView1.Items.Add(list);
					}
				  //加载房屋信息
				}
			}	

		}

        //双击事件
		private void listView1_DoubleClick(object sender, System.EventArgs e)
		{
		  //弹出详细信息
		 //MessageBox.Show(this.listView1.SelectedItems[0].Text);
		}

		private void listView1_Click(object sender, System.EventArgs e)
		{
			this.toolBarButton5.Enabled=true;
			this.toolBarButton6.Enabled=true;
			this.toolBarButton7.Enabled=true;
		}

		private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
		{
			
			string HomeID="";
			try
			{
				    
					string house=this.listView1.SelectedItems[0].Text;
					//根据名称获得编号
					HouseBS.HomeBS home=new HomeBS();
					DataSet ds3=new DataSet();
					ds3=home.selectID(house);
					foreach(DataRow row in ds3.Tables[0].Rows)
					{
						HomeID=row[0].ToString();
					}
			}
			catch(Exception ex)
			{
			  Console.WriteLine(ex.Message);
			}
			if(e.Button==this.toolBarButton5)
			{
				//预定
				if(this.listView1.SelectedItems.Count==0)
				{
					MessageBox.Show("请选择房屋");
					return;
				} 
				HomeBS bs=new HomeBS();
				DataSet ds=new DataSet();
				string state="";
				ds=bs.SelectSateByTag(this.listView1.SelectedItems[0].Text);
				foreach(DataRow row in ds.Tables[0].Rows)
				{
				 state=row[0].ToString();
				}
				if(state.Equals("已售"))
				{
					MessageBox.Show("已经售出不能再次预定!");
					return;
				}
				else if(state.Equals("预定"))
				{
					MessageBox.Show("已经预定不能再次预定!");
					return;
				}
				frmDestine frm=new frmDestine(this.listView1.SelectedItems[0].Text);
				frm.ShowDialog();  
			}
			else if(e.Button==this.toolBarButton6)
			{
				if(this.listView1.SelectedItems.Count==0)
				{
					MessageBox.Show("请选择房屋");
					return;
				} 
				//退定
				HomeBS homes=new HomeBS();
				Home home=new Home();
				//设定选中的值
				DataSet ds=new DataSet();
				string state="";
				ds=homes.SelectSateByTag(this.listView1.SelectedItems[0].Text);
				foreach(DataRow row in ds.Tables[0].Rows)
				{
					state=row[0].ToString();
				}
				if(state.Equals("未售"))
				{
					MessageBox.Show("尚未出售不需操作!");
					return;
				}
				if(HomeID!="")
				{
					home.HomeID=int.Parse(HomeID);
					homes.home=home;
					try
					{
						homes.NotDesine();
						MessageBox.Show("操作成功!");
					}
					catch(Exception ex)
					{
					  MessageBox.Show(ex.Message);
					}
				}
			}
			else if(e.Button==this.toolBarButton7)
			{
				//销售
				if(this.listView1.SelectedItems.Count==0)
				{
					MessageBox.Show("请选择房屋");
					return;
				}
				HomeBS bs=new HomeBS();
				DataSet ds=new DataSet();
				string state="";
				ds=bs.SelectSateByTag(this.listView1.SelectedItems[0].Text);
				foreach(DataRow row in ds.Tables[0].Rows)
				{
					state=row[0].ToString();
				}
				if(state.Equals("已售"))
				{
					MessageBox.Show("已经售出不能再次出售!");
					return;
				}
				frmSale frm=new frmSale(this.listView1.SelectedItems[0].Text);
				frm.ShowDialog();
			}
			else if(e.Button==this.toolBarButton8)
			{
				//打印
				this.printPreviewDialog1.ShowDialog();
			}
			else 
			{
			   this.Close();
			}
		}
		#region  打印
		private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
		{
			System.Drawing.Font objFont = new System.Drawing.Font("宋体",11,FontStyle.Underline);
			Brush objBrush = Brushes.Black;
			Pen objPen = new Pen(objBrush);
			objPen.Width = 2;
			
			//向打印预缆窗口中添加内容
			
			int nLeft = this.pageSetupDialog1.PageSettings.Margins.Left;
			int nTop = this.pageSetupDialog1.PageSettings.Margins.Top;
			int nWidth = this.pageSetupDialog1.PageSettings.PaperSize.Width-
				(this.pageSetupDialog1.PageSettings.Margins.Left + 
				this.pageSetupDialog1.PageSettings.Margins.Right);
			int nHeight = this.pageSetupDialog1.PageSettings.PaperSize.Height-
				(this.pageSetupDialog1.PageSettings.Margins.Top + 
				this.pageSetupDialog1.PageSettings.Margins.Bottom);
			
			
			//打印出表头
			
			e.Graphics.DrawString("销售信息",new System.Drawing.Font("Garamond",40,FontStyle.Bold),Brushes.Blue,nLeft+200,nTop+10);
			e.Graphics.DrawString("客户姓名",objFont,objBrush,nLeft+10,nTop+60);
			e.Graphics.DrawString("面积",objFont,objBrush,nLeft+100,nTop+60);
			e.Graphics.DrawString("层数",objFont,objBrush,nLeft+180,nTop+60);
			e.Graphics.DrawString("规格",objFont,objBrush,nLeft+300,nTop+60);
			e.Graphics.DrawString("朝向",objFont,objBrush,nLeft+420,nTop+60);
			e.Graphics.DrawString("客户电话",objFont,objBrush,nLeft+500,nTop+60);
			e.Graphics.DrawString("状态",objFont,objBrush,nLeft+600,nTop+60);
		
			//打印具体数据
			
			try
			{
				HouseBS.DestineBS employee=new  DestineBS();
				DataSet ds=employee.select();
				int nLine=1;
				foreach( DataRow rows in ds.Tables[0].Rows)
				{
					e.Graphics.DrawString(rows[0].ToString(),objFont,objBrush,nLeft+10,nTop+60+nLine*30);
					e.Graphics.DrawString(rows[1].ToString(),objFont,objBrush,nLeft+100,nTop+60+nLine*30);
					e.Graphics.DrawString(rows[2].ToString(),objFont,objBrush,nLeft+180,nTop+60+nLine*30);
					e.Graphics.DrawString(rows[3].ToString(),objFont,objBrush,nLeft+300,nTop+60+nLine*30);
					e.Graphics.DrawString(rows[4].ToString(),objFont,objBrush,nLeft+420,nTop+60+nLine*30);
					e.Graphics.DrawString(rows[5].ToString(),objFont,objBrush,nLeft+500,nTop+60+nLine*30);
					e.Graphics.DrawString(rows[6].ToString(),objFont,objBrush,nLeft+600,nTop+60+nLine*30);
					nLine++;
				}
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		#endregion

	}
}

⌨️ 快捷键说明

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