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

📄 querypersonnelform.h

📁 这是一个用VC++编写的人事工资管理系统,开发平台为VS2005,是开发企业管理程序的程序员的很好参考!
💻 H
📖 第 1 页 / 共 3 页
字号:
            MyPersonnelTable = gcnew System::Data::DataTable();
            String^ MySQL = "Select * From 基本档案 Where 姓名 LIKE '" + this->姓名ToolStripTextBox->Text + "'";
            SqlDataAdapter^ MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyPersonnelTable);
            this->基本档案DataGridView->DataSource = MyPersonnelTable;
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		 }
		private: System::Void 打印基本档案ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			this->printPreviewDialog1->Document = this->printDocument1;
            this->printPreviewDialog1->ShowDialog();
		 }
		private: System::Void printDocument1_PrintPage(System::Object^  sender, System::Drawing::Printing::PrintPageEventArgs^  e) {
			//打印员工人事档案
            e->Graphics->DrawString(this->MyCompany + "员工人事档案", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 150, 80);
            e->Graphics->DrawString("单位公章:", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 145);          
            e->Graphics->DrawString("打印日期:" + DateTime::Now.ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 145);          
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 165, 720, 165);
            e->Graphics->DrawString("员工编号:" +this->基本档案DataGridView->CurrentRow->Cells[1]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 175);
            e->Graphics->DrawString("部门:" + this->基本档案DataGridView->CurrentRow->Cells[2]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 300, 175);
            e->Graphics->DrawString("姓名:" + this->基本档案DataGridView->CurrentRow->Cells[3]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 175);
            e->Graphics->DrawString("性别:" + this->基本档案DataGridView->CurrentRow->Cells[4]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 620, 175);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 195, 720, 195);                       
            e->Graphics->DrawString("出生年月:" + ((DateTime)this->基本档案DataGridView->CurrentRow->Cells[5]->Value).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 200);
            e->Graphics->DrawString("身份证号码:" + this->基本档案DataGridView->CurrentRow->Cells[6]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 300, 200);
            e->Graphics->DrawString("民族:" + this->基本档案DataGridView->CurrentRow->Cells[7]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 620, 200);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 220, 720, 220);
            e->Graphics->DrawString("政治面貌:" + this->基本档案DataGridView->CurrentRow->Cells[8]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 225);
            e->Graphics->DrawString("婚姻状况:" + this->基本档案DataGridView->CurrentRow->Cells[9]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 270, 225);
            e->Graphics->DrawString("文化程度:" + this->基本档案DataGridView->CurrentRow->Cells[10]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 225);
            e->Graphics->DrawString("专业:" + this->基本档案DataGridView->CurrentRow->Cells[11]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 530, 225);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 245, 720, 245);
            e->Graphics->DrawString("毕业院校:" + this->基本档案DataGridView->CurrentRow->Cells[12]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 250);
            e->Graphics->DrawString("职称:" + this->基本档案DataGridView->CurrentRow->Cells[13]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 250);
            e->Graphics->DrawString("职务:" + this->基本档案DataGridView->CurrentRow->Cells[14]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 600, 250);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 270, 720, 270);
            e->Graphics->DrawString("进入本单位时间:" + ((DateTime)this->基本档案DataGridView->CurrentRow->Cells[15]->Value).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 275);
            e->Graphics->DrawString("合同服务年限:" + this->基本档案DataGridView->CurrentRow->Cells[16]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 275);
            e->Graphics->DrawString("基本工资:" + this->基本档案DataGridView->CurrentRow->Cells[17]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 570, 275);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 295, 720, 295);
            e->Graphics->DrawString("银行帐号:" + this->基本档案DataGridView->CurrentRow->Cells[18]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 300);
            e->Graphics->DrawString("养老保险帐号:" + this->基本档案DataGridView->CurrentRow->Cells[19]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 300);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 320, 720, 320);
            e->Graphics->DrawString("医疗保险帐号:" + this->基本档案DataGridView->CurrentRow->Cells[20]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 325);
            e->Graphics->DrawString("住房基金帐号:" + this->基本档案DataGridView->CurrentRow->Cells[21]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 325);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 345, 720, 345);
            e->Graphics->DrawString("联系电话:" + this->基本档案DataGridView->CurrentRow->Cells[22]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 350);
            e->Graphics->DrawString("手机号码:" + this->基本档案DataGridView->CurrentRow->Cells[23]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 350);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 370, 720, 370);            
            e->Graphics->DrawString("电子信箱:" + this->基本档案DataGridView->CurrentRow->Cells[24]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 375);
            e->Graphics->DrawString("家庭住址:" + this->基本档案DataGridView->CurrentRow->Cells[25]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 375);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 395, 720, 395);
            e->Graphics->DrawString("邮政编码:" + this->基本档案DataGridView->CurrentRow->Cells[26]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 400);
            e->Graphics->DrawString("籍贯:" + this->基本档案DataGridView->CurrentRow->Cells[27]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 270, 400);
            e->Graphics->DrawString("说明:" + this->基本档案DataGridView->CurrentRow->Cells[28]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 400);
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 420, 720, 420);
            e->Graphics->DrawString("家庭成员姓名", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 425);
            e->Graphics->DrawString("与员工关系", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, 425);
            e->Graphics->DrawString("工作单位", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 425);
            e->Graphics->DrawString("联系电话", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 620, 425);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 445, 720, 445);
            int MyPosY = 450;
            for (int i = 0; i < MyFamilyTable->Rows->Count; i++)
            {
                e->Graphics->DrawString(MyFamilyTable->Rows[i][0]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY );
                e->Graphics->DrawString(MyFamilyTable->Rows[i][1]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, MyPosY );
                e->Graphics->DrawString(MyFamilyTable->Rows[i][2]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 350, MyPosY );
                e->Graphics->DrawString(MyFamilyTable->Rows[i][5]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 610, MyPosY );
                MyPosY = MyPosY + 20;
            }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 550, 720, 550);
            e->Graphics->DrawString("培训时间", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 555);
            e->Graphics->DrawString("培训单位", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, 555);
            e->Graphics->DrawString("培训内容", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 555);
            e->Graphics->DrawString("证书名称", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 600, 555);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 575, 720, 575);
            MyPosY = 580;
            for (int i = 0; i < this->MyTrainingTable->Rows->Count; i++)
            {
                e->Graphics->DrawString(((DateTime)MyTrainingTable->Rows[i][0]).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                e->Graphics->DrawString(MyTrainingTable->Rows[i][2]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 220, MyPosY);
                e->Graphics->DrawString(MyTrainingTable->Rows[i][4]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 350, MyPosY);
                e->Graphics->DrawString(MyTrainingTable->Rows[i][6]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 560, MyPosY);
                MyPosY = MyPosY + 20;
            }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 680, 720, 680);
            e->Graphics->DrawString("序号", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 685);            
            e->Graphics->DrawString("工作业绩", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 220, 685);
            e->Graphics->DrawString("专长描述", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 685);
            e->Graphics->DrawString("说明", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 620, 685);            
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 705, 720, 705);
            MyPosY = 710;
            for (int i = 0; i <this->MyArchievementTable->Rows->Count; i++)
            {
                e->Graphics->DrawString((i+1).ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                e->Graphics->DrawString(MyArchievementTable->Rows[i][0]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 150, MyPosY);
                e->Graphics->DrawString(MyArchievementTable->Rows[i][1]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 350, MyPosY);
                e->Graphics->DrawString(MyArchievementTable->Rows[i][2]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 550, MyPosY);
                MyPosY = MyPosY + 20;
            }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 810, 720, 810);
            e->Graphics->DrawString("奖惩日期", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 815);
            e->Graphics->DrawString("奖惩类型", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, 815);
            e->Graphics->DrawString("奖惩原因", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 420, 815);
            e->Graphics->DrawString("批准单位", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 600, 815);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 835, 720, 835);
            MyPosY = 840;
            for (int i = 0; i < this->MyRewardsTable->Rows->Count; i++)
            {
                e->Graphics->DrawString(((DateTime)MyRewardsTable->Rows[i][0]).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                e->Graphics->DrawString(MyRewardsTable->Rows[i][1]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 220, MyPosY);
                e->Graphics->DrawString(MyRewardsTable->Rows[i][2]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 350, MyPosY);
                e->Graphics->DrawString(MyRewardsTable->Rows[i][3]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 550, MyPosY);
                MyPosY = MyPosY + 20;
            }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 940, 720, 940);
            e->Graphics->DrawString("序号", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 945);
            e->Graphics->DrawString("开始时间", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 150, 945);
            e->Graphics->DrawString("结束时间", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, 945);
            e->Graphics->DrawString("工作(学习)单位名称", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 380, 945);
            e->Graphics->DrawString("担任职务", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 620, 945);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 965, 720, 965);
            MyPosY = 970;
            for (int i = 0; i < this->MyResumeTable->Rows->Count; i++)
            {
                e->Graphics->DrawString((i + 1).ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                e->Graphics->DrawString(((DateTime)MyResumeTable->Rows[i][0]).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 150, MyPosY);
                e->Graphics->DrawString(((DateTime)MyResumeTable->Rows[i][1]).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, MyPosY);
                e->Graphics->DrawString(MyResumeTable->Rows[i][2]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 350, MyPosY);
                e->Graphics->DrawString(MyResumeTable->Rows[i][3]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 600, MyPosY);
                MyPosY = MyPosY + 20;
            }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 1070, 720, 1070);         
		 }
		private: System::Void 基本档案DataGridView_SelectionChanged(System::Object^  sender, System::EventArgs^  e) {
			String^ My员工编号 = this->基本档案DataGridView->CurrentRow->Cells[1]->Value->ToString();
            String^ MySQLConnectionString = MyPersonnelConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            MyFamilyTable = gcnew System::Data::DataTable();
            String^ MySQL = "Select 家庭成员姓名,与员工关系,工作单位,担任职务,政治面貌,联系电话,其他 From 员工家庭成员 Where 员工编号= '" + My员工编号 + "'";
            SqlDataAdapter^ MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyFamilyTable);
            this->家庭成员DataGridView->DataSource = MyFamilyTable;
            MyTrainingTable = gcnew System::Data::DataTable();
            MySQL = "Select 开始时间,结束时间,培训单位,培训地点,培训内容,培训经费,证书名称,说明 From 培训记录 Where 员工编号= '" + My员工编号 + "'";
            MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyTrainingTable);
            this->培训记录DataGridView->DataSource = MyTrainingTable;
            MyArchievementTable = gcnew System::Data::DataTable();
            MySQL = "Select 工作业绩,专长描述,说明 From 工作业绩 Where 员工编号= '" + My员工编号 + "'";
            MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyArchievementTable);
            this->工作业绩DataGridView->DataSource = MyArchievementTable;
            MyRewardsTable = gcnew System::Data::DataTable();
            MySQL = "Select 奖惩日期,奖惩类型,奖惩原因,奖惩批准单位,解除处分日期,说明 From 奖惩记录 Where 员工编号= '" + My员工编号 + "'";
            MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyRewardsTable);
            this->奖惩记录DataGridView->DataSource = MyRewardsTable;
            MyResumeTable = gcnew System::Data::DataTable();
            MySQL = "Select 开始时间,结束时间,单位名称,担任职务,所在部门,说明 From 工作简历 Where 员工编号= '" + My员工编号 + "'";
            MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyResumeTable);
            this->工作简历DataGridView->DataSource = MyResumeTable;
            MyLeaveTable = gcnew System::Data::DataTable();
            MySQL = "Select 离职时间,离职原因,批准人,说明 From 离职管理 Where 员工编号= '" + My员工编号 + "'";
            MyDataAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyDataAdapter->Fill(MyLeaveTable);
            this->离职原因DataGridView->DataSource = MyLeaveTable;
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		 }
	};
}

⌨️ 快捷键说明

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