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

📄 familyform.h

📁 这是一个用VC++编写的人事工资管理系统,开发平台为VS2005,是开发企业管理程序的程序员的很好参考!
💻 H
📖 第 1 页 / 共 3 页
字号:
			this->基本档案DataGridView->SelectionChanged += gcnew System::EventHandler(this, &FamilyForm::基本档案DataGridView_SelectionChanged);
			this->基本档案DataGridView->Click += gcnew System::EventHandler(this, &FamilyForm::基本档案DataGridView_Click);
			// 
			// 自编号TextBox
			// 
			this->自编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"自编号", true)));
			this->自编号TextBox->Location = System::Drawing::Point(63, 127);
			this->自编号TextBox->Name = L"自编号TextBox";
			this->自编号TextBox->ReadOnly = true;
			this->自编号TextBox->Size = System::Drawing::Size(88, 21);
			this->自编号TextBox->TabIndex = 25;
			// 
			// 员工编号TextBox
			// 
			this->员工编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"员工编号", true)));
			this->员工编号TextBox->Location = System::Drawing::Point(63, 154);
			this->员工编号TextBox->Name = L"员工编号TextBox";
			this->员工编号TextBox->ReadOnly = true;
			this->员工编号TextBox->Size = System::Drawing::Size(88, 21);
			this->员工编号TextBox->TabIndex = 27;
			// 
			// 员工姓名TextBox
			// 
			this->员工姓名TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"员工姓名", true)));
			this->员工姓名TextBox->Location = System::Drawing::Point(63, 181);
			this->员工姓名TextBox->Name = L"员工姓名TextBox";
			this->员工姓名TextBox->ReadOnly = true;
			this->员工姓名TextBox->Size = System::Drawing::Size(88, 21);
			this->员工姓名TextBox->TabIndex = 29;
			// 
			// 家庭成员姓名TextBox
			// 
			this->家庭成员姓名TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"家庭成员姓名", 
				true)));
			this->家庭成员姓名TextBox->Location = System::Drawing::Point(240, 128);
			this->家庭成员姓名TextBox->Name = L"家庭成员姓名TextBox";
			this->家庭成员姓名TextBox->Size = System::Drawing::Size(121, 21);
			this->家庭成员姓名TextBox->TabIndex = 31;
			// 
			// 与员工关系ComboBox
			// 
			this->与员工关系ComboBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"与员工关系", true)));
			this->与员工关系ComboBox->FormattingEnabled = true;
			this->与员工关系ComboBox->Items->AddRange(gcnew cli::array< System::Object^  >(10) {L"父", L"母", L"兄", L"弟", L"姐", L"妹", L"子", L"女", 
				L"夫", L"妻"});
			this->与员工关系ComboBox->Location = System::Drawing::Point(240, 155);
			this->与员工关系ComboBox->Name = L"与员工关系ComboBox";
			this->与员工关系ComboBox->Size = System::Drawing::Size(121, 20);
			this->与员工关系ComboBox->TabIndex = 33;
			// 
			// 工作单位TextBox
			// 
			this->工作单位TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"工作单位", true)));
			this->工作单位TextBox->Location = System::Drawing::Point(216, 181);
			this->工作单位TextBox->Name = L"工作单位TextBox";
			this->工作单位TextBox->Size = System::Drawing::Size(145, 21);
			this->工作单位TextBox->TabIndex = 35;
			// 
			// 担任职务TextBox
			// 
			this->担任职务TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"担任职务", true)));
			this->担任职务TextBox->Location = System::Drawing::Point(426, 127);
			this->担任职务TextBox->Name = L"担任职务TextBox";
			this->担任职务TextBox->Size = System::Drawing::Size(113, 21);
			this->担任职务TextBox->TabIndex = 37;
			// 
			// 政治面貌TextBox
			// 
			this->政治面貌TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"政治面貌", true)));
			this->政治面貌TextBox->Location = System::Drawing::Point(426, 154);
			this->政治面貌TextBox->Name = L"政治面貌TextBox";
			this->政治面貌TextBox->Size = System::Drawing::Size(113, 21);
			this->政治面貌TextBox->TabIndex = 39;
			// 
			// 联系电话TextBox
			// 
			this->联系电话TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"联系电话", true)));
			this->联系电话TextBox->Location = System::Drawing::Point(426, 181);
			this->联系电话TextBox->Name = L"联系电话TextBox";
			this->联系电话TextBox->Size = System::Drawing::Size(113, 21);
			this->联系电话TextBox->TabIndex = 41;
			// 
			// 其他TextBox
			// 
			this->其他TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->员工家庭成员BindingSource, L"其他", true)));
			this->其他TextBox->Location = System::Drawing::Point(46, 208);
			this->其他TextBox->Name = L"其他TextBox";
			this->其他TextBox->Size = System::Drawing::Size(493, 21);
			this->其他TextBox->TabIndex = 43;
			// 
			// 员工家庭成员DataGridView
			// 
			this->员工家庭成员DataGridView->AllowUserToAddRows = false;
			this->员工家庭成员DataGridView->AllowUserToDeleteRows = false;
			this->员工家庭成员DataGridView->AllowUserToResizeRows = false;
			this->员工家庭成员DataGridView->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
				| System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->员工家庭成员DataGridView->AutoGenerateColumns = false;
			this->员工家庭成员DataGridView->BackgroundColor = System::Drawing::SystemColors::ActiveCaption;
			this->员工家庭成员DataGridView->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^  >(10) {this->dataGridViewTextBoxColumn1, 
				this->dataGridViewTextBoxColumn2, this->dataGridViewTextBoxColumn3, this->dataGridViewTextBoxColumn4, this->dataGridViewTextBoxColumn5, 
				this->dataGridViewTextBoxColumn6, this->dataGridViewTextBoxColumn7, this->dataGridViewTextBoxColumn8, this->dataGridViewTextBoxColumn9, 
				this->dataGridViewTextBoxColumn10});
			this->员工家庭成员DataGridView->DataSource = this->员工家庭成员BindingSource;
			this->员工家庭成员DataGridView->Location = System::Drawing::Point(5, 232);
			this->员工家庭成员DataGridView->MultiSelect = false;
			this->员工家庭成员DataGridView->Name = L"员工家庭成员DataGridView";
			this->员工家庭成员DataGridView->ReadOnly = true;
			this->员工家庭成员DataGridView->RowHeadersVisible = false;
			dataGridViewCellStyle2->BackColor = System::Drawing::Color::Green;
			dataGridViewCellStyle2->ForeColor = System::Drawing::Color::Yellow;
			this->员工家庭成员DataGridView->RowsDefaultCellStyle = dataGridViewCellStyle2;
			this->员工家庭成员DataGridView->RowTemplate->Height = 23;
			this->员工家庭成员DataGridView->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
			this->员工家庭成员DataGridView->Size = System::Drawing::Size(533, 180);
			this->员工家庭成员DataGridView->TabIndex = 23;
			// 
			// FamilyForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->BackColor = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(0)), static_cast<System::Int32>(static_cast<System::Byte>(192)), 
				static_cast<System::Int32>(static_cast<System::Byte>(192)));
			this->ClientSize = System::Drawing::Size(542, 416);
			this->Controls->Add(this->基本档案DataGridView);
			this->Controls->Add(自编号Label);
			this->Controls->Add(this->自编号TextBox);
			this->Controls->Add(员工编号Label);
			this->Controls->Add(this->员工编号TextBox);
			this->Controls->Add(员工姓名Label);
			this->Controls->Add(this->员工姓名TextBox);
			this->Controls->Add(家庭成员姓名Label);
			this->Controls->Add(this->家庭成员姓名TextBox);
			this->Controls->Add(与员工关系Label);
			this->Controls->Add(this->与员工关系ComboBox);
			this->Controls->Add(工作单位Label);
			this->Controls->Add(this->工作单位TextBox);
			this->Controls->Add(担任职务Label);
			this->Controls->Add(this->担任职务TextBox);
			this->Controls->Add(政治面貌Label);
			this->Controls->Add(this->政治面貌TextBox);
			this->Controls->Add(联系电话Label);
			this->Controls->Add(this->联系电话TextBox);
			this->Controls->Add(其他Label);
			this->Controls->Add(this->其他TextBox);
			this->Controls->Add(this->员工家庭成员DataGridView);
			this->Controls->Add(this->员工家庭成员BindingNavigator);
			this->Name = L"FamilyForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"员工家庭成员维护";
			this->Load += gcnew System::EventHandler(this, &FamilyForm::FamilyForm_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->MyPersonnelDataSet))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->员工家庭成员BindingSource))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->员工家庭成员BindingNavigator))->EndInit();
			this->员工家庭成员BindingNavigator->ResumeLayout(false);
			this->员工家庭成员BindingNavigator->PerformLayout();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->基本档案DataGridView))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->员工家庭成员DataGridView))->EndInit();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
		private: static String^ MyPersonnelConnectionString= L"Data Source=.;Initial Catalog=MyPersonnel;Integrated Security=True;Pooling=False";		
		private: System::Void 员工家庭成员BindingNavigatorSaveItem_Click(System::Object^  sender, System::EventArgs^  e) {
				 this->Validate();
				 this->员工家庭成员BindingSource->EndEdit();
				 this->员工家庭成员TableAdapter->Update(this->MyPersonnelDataSet->员工家庭成员);
		 }
		private: System::Void FamilyForm_Load(System::Object^  sender, System::EventArgs^  e) {
			 // TODO: 这行代码将数据加载到表“MyPersonnelDataSet.员工家庭成员”中。您可以根据需要移动或移除它。
			 //this->员工家庭成员TableAdapter->Fill(this->MyPersonnelDataSet->员工家庭成员);
		 }
		private: System::Void 查询ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			String^ MySQLConnectionString = MyPersonnelConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            String^ MySQL = "Select * From 基本档案 Where 姓名 LIKE '" + this->员工姓名ToolStripTextBox->Text + "' AND (员工编号 NOT IN(SELECT 员工编号 FROM 离职管理))";
			System::Data::DataTable^ MyPersonnelTable = gcnew System::Data::DataTable();
            SqlDataAdapter^ MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyPersonnelTable);
            this->基本档案DataGridView->DataSource = MyPersonnelTable;
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		 }
		private: System::Void bindingNavigatorAddNewItem_Click(System::Object^  sender, System::EventArgs^  e) {
			//自动计算自编号
            String^ MySQLConnectionString =MyPersonnelConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            SqlCommand^ MyCommand = MyConnection->CreateCommand();
            MyCommand->CommandText = "Select max(自编号) 最大编号 From 员工家庭成员";
			System::Object^ MyResult = MyCommand->ExecuteScalar();
			System::Int64  MyID = 1;
			if (MyResult != System::DBNull::Value)
            {
                String^ MyMaxID = MyResult->ToString()->Trim();
                MyMaxID = MyMaxID->Substring(2, MyMaxID->Length - 2);
				MyID = Convert::ToInt64(MyMaxID) + 1;
            }
            int MyLength = MyID.ToString()->Length;
            String^ MyNewID = "";
            switch (MyLength)
            {
                case 1:
                    MyNewID = "JT0000000" + MyID.ToString();
                    break;
                case 2:
                    MyNewID = "JT000000" + MyID.ToString();
                    break;
                case 3:
                    MyNewID = "JT00000" + MyID.ToString();
                    break;
                case 4:
                    MyNewID = "JT0000" + MyID.ToString();
                    break;
                case 5:
                    MyNewID = "JT000" + MyID.ToString();
                    break;
                case 6:
                    MyNewID = "JT00" + MyID.ToString();
                    break;
                case 7:
                    MyNewID = "JT0" + MyID.ToString();
                    break;
            }
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            this->自编号TextBox->Text = MyNewID;          
		 }
		private: System::Void 基本档案DataGridView_Click(System::Object^  sender, System::EventArgs^  e) {
		    this->员工编号TextBox->Text = this->基本档案DataGridView->CurrentRow->Cells[1]->Value->ToString();
            this->员工姓名TextBox->Text = this->基本档案DataGridView->CurrentRow->Cells[3]->Value->ToString();
		 }
		private: System::Void 基本档案DataGridView_SelectionChanged(System::Object^  sender, System::EventArgs^  e) {
			String^ My员工姓名=this->基本档案DataGridView->CurrentRow->Cells[3]->Value->ToString();
            try
            {
                this->员工家庭成员TableAdapter->FillBy(this->MyPersonnelDataSet->员工家庭成员, My员工姓名);
            }
			catch (System::Exception^ ex)
            {
				System::Windows::Forms::MessageBox::Show(ex->Message);
            }
		 }
	};
}

⌨️ 快捷键说明

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