frmstorey.cs

来自「小区物业管理:管理小区的费用、小区工作人员的编排和工资管理、小区的运作、对住户资」· CS 代码 · 共 932 行 · 第 1/3 页

CS
932
字号
			// 
			this.printworker.Document = this.pdocworker;
			// 
			// pageSetupDialog1
			// 
			this.pageSetupDialog1.Document = this.pdocworker;
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Controls.Add(this.tabPage2);
			this.tabControl1.Location = new System.Drawing.Point(8, 96);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(576, 192);
			this.tabControl1.TabIndex = 8;
			this.tabControl1.Visible = false;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.btn);
			this.tabPage1.Controls.Add(this.btnRe);
			this.tabPage1.Controls.Add(this.btnaddwo);
			this.tabPage1.Controls.Add(this.txttel);
			this.tabPage1.Controls.Add(this.lbladdress);
			this.tabPage1.Controls.Add(this.txtname);
			this.tabPage1.Controls.Add(this.lblUIDcard);
			this.tabPage1.Controls.Add(this.cbocarcor);
			this.tabPage1.Controls.Add(this.lblUcarcor);
			this.tabPage1.Controls.Add(this.txtnum);
			this.tabPage1.Controls.Add(this.lblUname);
			this.tabPage1.Controls.Add(this.txtID);
			this.tabPage1.Controls.Add(this.lblUID);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(568, 167);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "插入住房记录";
			// 
			// btn
			// 
			this.btn.Location = new System.Drawing.Point(479, 136);
			this.btn.Name = "btn";
			this.btn.TabIndex = 29;
			this.btn.Text = "返回";
			this.btn.Click += new System.EventHandler(this.btn_Click);
			// 
			// btnRe
			// 
			this.btnRe.Location = new System.Drawing.Point(383, 136);
			this.btnRe.Name = "btnRe";
			this.btnRe.TabIndex = 28;
			this.btnRe.Text = "重置";
			this.btnRe.Click += new System.EventHandler(this.btnRe_Click);
			// 
			// btnaddwo
			// 
			this.btnaddwo.Location = new System.Drawing.Point(287, 136);
			this.btnaddwo.Name = "btnaddwo";
			this.btnaddwo.TabIndex = 27;
			this.btnaddwo.Text = "插入";
			this.btnaddwo.Click += new System.EventHandler(this.btnaddwo_Click);
			// 
			// txttel
			// 
			this.txttel.Location = new System.Drawing.Point(111, 88);
			this.txttel.Name = "txttel";
			this.txttel.Size = new System.Drawing.Size(136, 21);
			this.txttel.TabIndex = 24;
			this.txttel.Text = "";
			// 
			// lbladdress
			// 
			this.lbladdress.Location = new System.Drawing.Point(15, 88);
			this.lbladdress.Name = "lbladdress";
			this.lbladdress.Size = new System.Drawing.Size(80, 23);
			this.lbladdress.TabIndex = 23;
			this.lbladdress.Text = "住房电话:";
			// 
			// txtname
			// 
			this.txtname.Location = new System.Drawing.Point(112, 48);
			this.txtname.Name = "txtname";
			this.txtname.Size = new System.Drawing.Size(136, 21);
			this.txtname.TabIndex = 22;
			this.txtname.Text = "";
			// 
			// lblUIDcard
			// 
			this.lblUIDcard.Location = new System.Drawing.Point(16, 48);
			this.lblUIDcard.Name = "lblUIDcard";
			this.lblUIDcard.Size = new System.Drawing.Size(80, 23);
			this.lblUIDcard.TabIndex = 21;
			this.lblUIDcard.Text = "住房业主:";
			// 
			// cbocarcor
			// 
			this.cbocarcor.Items.AddRange(new object[] {
														   "已售",
														   "未售"});
			this.cbocarcor.Location = new System.Drawing.Point(384, 48);
			this.cbocarcor.Name = "cbocarcor";
			this.cbocarcor.Size = new System.Drawing.Size(152, 20);
			this.cbocarcor.TabIndex = 20;
			this.cbocarcor.Text = "已售";
			// 
			// lblUcarcor
			// 
			this.lblUcarcor.Location = new System.Drawing.Point(288, 48);
			this.lblUcarcor.Name = "lblUcarcor";
			this.lblUcarcor.Size = new System.Drawing.Size(80, 23);
			this.lblUcarcor.TabIndex = 19;
			this.lblUcarcor.Text = "住房状态:";
			// 
			// txtnum
			// 
			this.txtnum.Location = new System.Drawing.Point(383, 8);
			this.txtnum.Name = "txtnum";
			this.txtnum.Size = new System.Drawing.Size(152, 21);
			this.txtnum.TabIndex = 18;
			this.txtnum.Text = "";
			// 
			// lblUname
			// 
			this.lblUname.Location = new System.Drawing.Point(287, 8);
			this.lblUname.Name = "lblUname";
			this.lblUname.Size = new System.Drawing.Size(80, 23);
			this.lblUname.TabIndex = 17;
			this.lblUname.Text = "住房栋号:";
			// 
			// txtID
			// 
			this.txtID.Location = new System.Drawing.Point(111, 8);
			this.txtID.Name = "txtID";
			this.txtID.Size = new System.Drawing.Size(136, 21);
			this.txtID.TabIndex = 16;
			this.txtID.Text = "";
			// 
			// lblUID
			// 
			this.lblUID.Location = new System.Drawing.Point(15, 8);
			this.lblUID.Name = "lblUID";
			this.lblUID.Size = new System.Drawing.Size(80, 23);
			this.lblUID.TabIndex = 15;
			this.lblUID.Text = "住房房号:";
			// 
			// tabPage2
			// 
			this.tabPage2.Controls.Add(this.btnDEit);
			this.tabPage2.Controls.Add(this.btnDel1);
			this.tabPage2.Controls.Add(this.txtDID);
			this.tabPage2.Controls.Add(this.lblDID);
			this.tabPage2.Location = new System.Drawing.Point(4, 23);
			this.tabPage2.Name = "tabPage2";
			this.tabPage2.Size = new System.Drawing.Size(568, 165);
			this.tabPage2.TabIndex = 1;
			this.tabPage2.Text = "删除住房记录";
			// 
			// btnDEit
			// 
			this.btnDEit.Location = new System.Drawing.Point(360, 64);
			this.btnDEit.Name = "btnDEit";
			this.btnDEit.TabIndex = 6;
			this.btnDEit.Text = "返回";
			this.btnDEit.Click += new System.EventHandler(this.btnDEit_Click);
			// 
			// btnDel1
			// 
			this.btnDel1.Location = new System.Drawing.Point(264, 64);
			this.btnDel1.Name = "btnDel1";
			this.btnDel1.TabIndex = 4;
			this.btnDel1.Text = "删除";
			this.btnDel1.Click += new System.EventHandler(this.btnDel1_Click);
			// 
			// txtDID
			// 
			this.txtDID.Location = new System.Drawing.Point(104, 64);
			this.txtDID.Name = "txtDID";
			this.txtDID.Size = new System.Drawing.Size(144, 21);
			this.txtDID.TabIndex = 1;
			this.txtDID.Text = "";
			// 
			// lblDID
			// 
			this.lblDID.Location = new System.Drawing.Point(24, 64);
			this.lblDID.Name = "lblDID";
			this.lblDID.Size = new System.Drawing.Size(72, 23);
			this.lblDID.TabIndex = 0;
			this.lblDID.Text = "住房房号:";
			// 
			// frmstorey
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(7, 14);
			this.ClientSize = new System.Drawing.Size(592, 334);
			this.Controls.Add(this.btnPrintprv);
			this.Controls.Add(this.btnPrint);
			this.Controls.Add(this.btnExit);
			this.Controls.Add(this.btnAdd);
			this.Controls.Add(this.grpfind);
			this.Controls.Add(this.tabControl1);
			this.Controls.Add(this.dbgworker);
			this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.ForeColor = System.Drawing.SystemColors.ActiveCaption;
			this.Name = "frmstorey";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "楼房资料";
			this.Load += new System.EventHandler(this.frmworker_Load);
			this.grpfind.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dbgworker)).EndInit();
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.tabPage2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// 应用程序的主入口点。
		/// </summary>


		private void frmworker_Load(object sender, System.EventArgs e)
		{
			objSqlConnection=new SqlConnection ("database=atorregulate;uid=sa;pwd=;SERVER=(local)");
			objSqlConnection.Open ();
			objSqlDataAdapter=new SqlDataAdapter ();
			objSqlDataAdapter.SelectCommand =new SqlCommand ("select Nstorey as 住房房号,Nitem as 住房栋号,Nusername as 住房业主,Nhabitus as 住房状态,Ntelnumber as 住房电话 from storey",objSqlConnection);
			objDataSet=new DataSet ();
			objSqlDataAdapter.Fill (objDataSet,"storey");

			//将DataSet控制定到数据集
			this.dbgworker .SetDataBinding (objDataSet,"storey");
			//dbgworker.DataSource =objDataSet.Tables [0].DefaultView ;

			//定义插入命令
			string insCmd="Insert into storey values (@Nstorey,@Nitem,@Nusername,@Nhabitus,@Ntelnumber)";

			//实例化InsertCommand
			this.objSqlDataAdapter .InsertCommand =new SqlCommand (insCmd,this.objSqlConnection );

			//设置插入命令参数
			objParam=objSqlDataAdapter.InsertCommand .Parameters .Add (new SqlParameter  ("@Nstorey",System.Data .SqlDbType .Int ));
			objParam.SourceColumn ="住房房号";
			objParam.SourceVersion =DataRowVersion.Current ;
			objParam=objSqlDataAdapter.InsertCommand .Parameters .Add (new System .Data .SqlClient .SqlParameter ("@Nitem",System.Data .SqlDbType.Int   ));
			objParam.SourceColumn ="住房栋号";
			objParam.SourceVersion =DataRowVersion.Current ;
			objParam=objSqlDataAdapter.InsertCommand .Parameters .Add (new System .Data .SqlClient .SqlParameter ("@Nusername",System.Data .SqlDbType .Char  ));
			objParam.SourceColumn ="住房业主";
			objParam.SourceVersion =DataRowVersion.Current ;
			objParam=objSqlDataAdapter.InsertCommand .Parameters .Add (new System .Data .SqlClient .SqlParameter ("@Nhabitus",System.Data .SqlDbType .Char ));
			objParam.SourceColumn ="住房状态";
			objParam.SourceVersion =DataRowVersion.Current ;
			objParam=objSqlDataAdapter.InsertCommand .Parameters .Add (new System .Data .SqlClient .SqlParameter ("@Ntelnumber",System.Data .SqlDbType .Char ));
			objParam.SourceColumn ="住房电话";
			objParam.SourceVersion =DataRowVersion.Current ;
		}

		//验证插入记录的单个控件
		private bool ValidateFields()
		{
			bool returnValue=true;
			//检查有无空的员工编号
			if (this.txtID .Text .Trim ()==String.Empty||this.txtname .Text .Trim ()==String.Empty ||this.txtnum .Text .Trim ()==String.Empty ||this.txttel  .Text .Trim ()==String.Empty    )
			{
				MessageBox.Show ("提供完整的详细信息","服务器拒绝");
				this.txtID .Focus ();
				return false;
			}
			else
			{
				for(int i=0;i<this.txtname .Text .Length ;i++)
				{
					if(Char.IsNumber (txtname.Text .ToString (),i))
					{
						MessageBox.Show ("住户姓名不能为数字","服务器拒绝");
						this.txtname .Focus ();
						returnValue=false;
						break;
					}
				}
			}
			return returnValue;
		}

		private void btnAdd_Click(object sender, System.EventArgs e)
		{
            this.tabControl1 .Visible =true;
			this.btnAdd .Enabled =false;
			this.btnPrint .Enabled =false;
			this.btnPrintprv .Enabled =false;
		}

		private void btnExid_Click(object sender, System.EventArgs e)
		{
			this.Close ();
		}


		private void btnRu_Click(object sender, System.EventArgs e)
		{
			
			this.dbgworker .Enabled =true;
			objSqlConnection=new SqlConnection ("database=atorregulate;uid=sa;pwd=;SERVER=(local)");
			objSqlConnection.Open ();
			objSqlDataAdapter=new SqlDataAdapter ();
			objSqlDataAdapter.SelectCommand =new SqlCommand ("select Nstorey as 住房房号,Nitem as 住房栋号,Nusername as 住房业主,Nhabitus as 住房状态,Ntelnumber as 住房电话 from storey",objSqlConnection);
			objDataSet=new DataSet ();
			objSqlDataAdapter.Fill (objDataSet,"storey");
			this.dbgworker .SetDataBinding (objDataSet,"storey");

⌨️ 快捷键说明

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