📄 resumeform.h
字号:
// 自编号TextBox
//
this->自编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"自编号", true)));
this->自编号TextBox->Location = System::Drawing::Point(60, 126);
this->自编号TextBox->Name = L"自编号TextBox";
this->自编号TextBox->ReadOnly = true;
this->自编号TextBox->Size = System::Drawing::Size(100, 21);
this->自编号TextBox->TabIndex = 26;
//
// 员工编号TextBox
//
this->员工编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"员工编号", true)));
this->员工编号TextBox->Location = System::Drawing::Point(60, 153);
this->员工编号TextBox->Name = L"员工编号TextBox";
this->员工编号TextBox->ReadOnly = true;
this->员工编号TextBox->Size = System::Drawing::Size(100, 21);
this->员工编号TextBox->TabIndex = 28;
//
// 员工姓名TextBox
//
this->员工姓名TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"员工姓名", true)));
this->员工姓名TextBox->Location = System::Drawing::Point(60, 180);
this->员工姓名TextBox->Name = L"员工姓名TextBox";
this->员工姓名TextBox->ReadOnly = true;
this->员工姓名TextBox->Size = System::Drawing::Size(100, 21);
this->员工姓名TextBox->TabIndex = 30;
//
// 开始时间DateTimePicker
//
this->开始时间DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->工作A简历BindingSource, L"开始时间",
true)));
this->开始时间DateTimePicker->Location = System::Drawing::Point(226, 126);
this->开始时间DateTimePicker->Name = L"开始时间DateTimePicker";
this->开始时间DateTimePicker->Size = System::Drawing::Size(120, 21);
this->开始时间DateTimePicker->TabIndex = 32;
//
// 结束时间DateTimePicker
//
this->结束时间DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->工作A简历BindingSource, L"结束时间",
true)));
this->结束时间DateTimePicker->Location = System::Drawing::Point(226, 153);
this->结束时间DateTimePicker->Name = L"结束时间DateTimePicker";
this->结束时间DateTimePicker->Size = System::Drawing::Size(120, 21);
this->结束时间DateTimePicker->TabIndex = 34;
//
// 单位名称TextBox
//
this->单位名称TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"单位名称", true)));
this->单位名称TextBox->Location = System::Drawing::Point(226, 180);
this->单位名称TextBox->Name = L"单位名称TextBox";
this->单位名称TextBox->Size = System::Drawing::Size(120, 21);
this->单位名称TextBox->TabIndex = 36;
//
// 担任职务TextBox
//
this->担任职务TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"担任职务", true)));
this->担任职务TextBox->Location = System::Drawing::Point(410, 126);
this->担任职务TextBox->Name = L"担任职务TextBox";
this->担任职务TextBox->Size = System::Drawing::Size(128, 21);
this->担任职务TextBox->TabIndex = 38;
//
// 所在部门TextBox
//
this->所在部门TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"所在部门", true)));
this->所在部门TextBox->Location = System::Drawing::Point(410, 153);
this->所在部门TextBox->Name = L"所在部门TextBox";
this->所在部门TextBox->Size = System::Drawing::Size(127, 21);
this->所在部门TextBox->TabIndex = 40;
//
// 说明TextBox
//
this->说明TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->工作A简历BindingSource, L"说明", true)));
this->说明TextBox->Location = System::Drawing::Point(410, 180);
this->说明TextBox->Name = L"说明TextBox";
this->说明TextBox->Size = System::Drawing::Size(127, 21);
this->说明TextBox->TabIndex = 42;
//
// 工作简历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->工作A简历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(4, 205);
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, 207);
this->工作简历DataGridView->TabIndex = 24;
//
// ResumeForm
//
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->开始时间DateTimePicker);
this->Controls->Add(结束时间Label);
this->Controls->Add(this->结束时间DateTimePicker);
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"ResumeForm";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"员工工作简历维护";
this->Load += gcnew System::EventHandler(this, &ResumeForm::ResumeForm_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->MyPersonnelDataSet))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->工作A简历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->工作A简历BindingSource->EndEdit();
this->工作简历TableAdapter->Update(this->MyPersonnelDataSet->工作简历);
}
private: System::Void ResumeForm_Load(System::Object^ sender, System::EventArgs^ e) {
// TODO: 这行代码将数据加载到表“MyPersonnelDataSet.工作简历”中。您可以根据需要移动或移除它。
//this->工作简历TableAdapter->Fill(this->MyPersonnelDataSet->工作简历);
}
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 = "JL0000000" + MyID.ToString();
break;
case 2:
MyNewID = "JL000000" + MyID.ToString();
break;
case 3:
MyNewID = "JL00000" + MyID.ToString();
break;
case 4:
MyNewID = "JL0000" + MyID.ToString();
break;
case 5:
MyNewID = "JL000" + MyID.ToString();
break;
case 6:
MyNewID = "JL00" + MyID.ToString();
break;
case 7:
MyNewID = "JL0" + 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);
}
}
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();
}
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -