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

📄 rewardsform.h

📁 这是一个用VC++编写的人事工资管理系统,开发平台为VS2005,是开发企业管理程序的程序员的很好参考!
💻 H
📖 第 1 页 / 共 3 页
字号:
			this->员工姓名TextBox->Name = L"员工姓名TextBox";
			this->员工姓名TextBox->ReadOnly = true;
			this->员工姓名TextBox->Size = System::Drawing::Size(90, 21);
			this->员工姓名TextBox->TabIndex = 49;
			// 
			// 奖惩日期DateTimePicker
			// 
			this->奖惩日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->奖惩记录BindingSource, L"奖惩日期", 
				true)));
			this->奖惩日期DateTimePicker->Location = System::Drawing::Point(229, 129);
			this->奖惩日期DateTimePicker->Name = L"奖惩日期DateTimePicker";
			this->奖惩日期DateTimePicker->Size = System::Drawing::Size(120, 21);
			this->奖惩日期DateTimePicker->TabIndex = 51;
			// 
			// 奖惩类型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^  >(4) {L"警告", L"记过", L"记大过", L"开除"});
			this->奖惩类型ComboBox->Location = System::Drawing::Point(229, 156);
			this->奖惩类型ComboBox->Name = L"奖惩类型ComboBox";
			this->奖惩类型ComboBox->Size = System::Drawing::Size(120, 20);
			this->奖惩类型ComboBox->TabIndex = 53;
			// 
			// 奖惩原因TextBox
			// 
			this->奖惩原因TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->奖惩记录BindingSource, L"奖惩原因", true)));
			this->奖惩原因TextBox->Location = System::Drawing::Point(229, 182);
			this->奖惩原因TextBox->Name = L"奖惩原因TextBox";
			this->奖惩原因TextBox->Size = System::Drawing::Size(120, 21);
			this->奖惩原因TextBox->TabIndex = 55;
			// 
			// 奖惩批准单位TextBox
			// 
			this->奖惩批准单位TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->奖惩记录BindingSource, L"奖惩批准单位", true)));
			this->奖惩批准单位TextBox->Location = System::Drawing::Point(449, 128);
			this->奖惩批准单位TextBox->Name = L"奖惩批准单位TextBox";
			this->奖惩批准单位TextBox->Size = System::Drawing::Size(90, 21);
			this->奖惩批准单位TextBox->TabIndex = 57;
			// 
			// 解除处分日期DateTimePicker
			// 
			this->解除处分日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->奖惩记录BindingSource, L"解除处分日期", 
				true)));
			this->解除处分日期DateTimePicker->Location = System::Drawing::Point(449, 155);
			this->解除处分日期DateTimePicker->Name = L"解除处分日期DateTimePicker";
			this->解除处分日期DateTimePicker->Size = System::Drawing::Size(90, 21);
			this->解除处分日期DateTimePicker->TabIndex = 59;
			// 
			// 说明TextBox
			// 
			this->说明TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->奖惩记录BindingSource, L"说明", true)));
			this->说明TextBox->Location = System::Drawing::Point(401, 182);
			this->说明TextBox->Name = L"说明TextBox";
			this->说明TextBox->Size = System::Drawing::Size(138, 21);
			this->说明TextBox->TabIndex = 61;
			// 
			// 基本档案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::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->基本档案DataGridView->BackgroundColor = System::Drawing::SystemColors::ActiveCaption;
			this->基本档案DataGridView->ColumnHeadersHeightSizeMode = System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize;
			this->基本档案DataGridView->Location = System::Drawing::Point(4, 29);
			this->基本档案DataGridView->MultiSelect = false;
			this->基本档案DataGridView->Name = L"基本档案DataGridView";
			this->基本档案DataGridView->ReadOnly = true;
			this->基本档案DataGridView->RowHeadersVisible = false;
			dataGridViewCellStyle1->BackColor = System::Drawing::Color::Green;
			dataGridViewCellStyle1->ForeColor = System::Drawing::Color::Yellow;
			this->基本档案DataGridView->RowsDefaultCellStyle = dataGridViewCellStyle1;
			this->基本档案DataGridView->RowTemplate->Height = 23;
			this->基本档案DataGridView->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
			this->基本档案DataGridView->Size = System::Drawing::Size(533, 93);
			this->基本档案DataGridView->TabIndex = 43;
			this->基本档案DataGridView->SelectionChanged += gcnew System::EventHandler(this, &RewardsForm::基本档案DataGridView_SelectionChanged);
			this->基本档案DataGridView->Click += gcnew System::EventHandler(this, &RewardsForm::基本档案DataGridView_Click);
			// 
			// 奖惩记录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^  >(9) {this->dataGridViewTextBoxColumn1, 
				this->dataGridViewTextBoxColumn2, this->dataGridViewTextBoxColumn3, this->dataGridViewTextBoxColumn4, this->dataGridViewTextBoxColumn5, 
				this->dataGridViewTextBoxColumn6, this->dataGridViewTextBoxColumn7, this->dataGridViewTextBoxColumn8, this->dataGridViewTextBoxColumn9});
			this->奖惩记录DataGridView->DataSource = this->奖惩记录BindingSource;
			dataGridViewCellStyle2->Alignment = System::Windows::Forms::DataGridViewContentAlignment::MiddleLeft;
			dataGridViewCellStyle2->BackColor = System::Drawing::Color::Green;
			dataGridViewCellStyle2->Font = (gcnew System::Drawing::Font(L"宋体", 9, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(134)));
			dataGridViewCellStyle2->ForeColor = System::Drawing::Color::Yellow;
			dataGridViewCellStyle2->SelectionBackColor = System::Drawing::SystemColors::Highlight;
			dataGridViewCellStyle2->SelectionForeColor = System::Drawing::SystemColors::HighlightText;
			dataGridViewCellStyle2->WrapMode = System::Windows::Forms::DataGridViewTriState::False;
			this->奖惩记录DataGridView->DefaultCellStyle = dataGridViewCellStyle2;
			this->奖惩记录DataGridView->Location = System::Drawing::Point(5, 208);
			this->奖惩记录DataGridView->MultiSelect = false;
			this->奖惩记录DataGridView->Name = L"奖惩记录DataGridView";
			this->奖惩记录DataGridView->ReadOnly = true;
			this->奖惩记录DataGridView->RowHeadersVisible = false;
			this->奖惩记录DataGridView->RowTemplate->Height = 23;
			this->奖惩记录DataGridView->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
			this->奖惩记录DataGridView->Size = System::Drawing::Size(533, 204);
			this->奖惩记录DataGridView->TabIndex = 42;
			// 
			// RewardsForm
			// 
			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(自编号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->奖惩日期DateTimePicker);
			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->解除处分日期DateTimePicker);
			this->Controls->Add(说明Label);
			this->Controls->Add(this->说明TextBox);
			this->Controls->Add(this->基本档案DataGridView);
			this->Controls->Add(this->奖惩记录DataGridView);
			this->Controls->Add(this->奖惩记录BindingNavigator);
			this->Name = L"RewardsForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"员工奖惩记录维护";
			(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 查询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 基本档案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);
            }
		 }
		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 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 = "JZ0000000" + MyID.ToString();
                    break;
                case 2:
                    MyNewID = "JZ000000" + MyID.ToString();
                    break;
                case 3:
                    MyNewID = "JZ00000" + MyID.ToString();
                    break;
                case 4:
                    MyNewID = "JZ0000" + MyID.ToString();
                    break;
                case 5:
                    MyNewID = "JZ000" + MyID.ToString();
                    break;
                case 6:
                    MyNewID = "JZ00" + MyID.ToString();
                    break;
                case 7:
                    MyNewID = "JZ0" + MyID.ToString();
                    break;
            }
			if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            this->自编号TextBox->Text = MyNewID;          		
		 }
	};
}

⌨️ 快捷键说明

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