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

📄 punishmentmanage.h

📁 Visual C++.net数据库开发经典案例
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->tBoxCause->Location = System::Drawing::Point(112, 192);
			this->tBoxCause->Name = S"tBoxCause";
			this->tBoxCause->Size = System::Drawing::Size(224, 21);
			this->tBoxCause->TabIndex = 39;
			this->tBoxCause->Text = S"";
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(112, 56);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(56, 16);
			this->label1->TabIndex = 38;
			this->label1->Text = S"职员编号";
			// 
			// tBoxIsInSalary
			// 
			this->tBoxIsInSalary->Location = System::Drawing::Point(392, 136);
			this->tBoxIsInSalary->Name = S"tBoxIsInSalary";
			this->tBoxIsInSalary->Size = System::Drawing::Size(176, 21);
			this->tBoxIsInSalary->TabIndex = 37;
			this->tBoxIsInSalary->Text = S"";
			// 
			// tBoxPunishmentDate
			// 
			this->tBoxPunishmentDate->Location = System::Drawing::Point(208, 136);
			this->tBoxPunishmentDate->Name = S"tBoxPunishmentDate";
			this->tBoxPunishmentDate->Size = System::Drawing::Size(152, 21);
			this->tBoxPunishmentDate->TabIndex = 36;
			this->tBoxPunishmentDate->Text = S"";
			// 
			// tBoxPunishment
			// 
			this->tBoxPunishment->Location = System::Drawing::Point(112, 136);
			this->tBoxPunishment->Name = S"tBoxPunishment";
			this->tBoxPunishment->Size = System::Drawing::Size(80, 21);
			this->tBoxPunishment->TabIndex = 35;
			this->tBoxPunishment->Text = S"";
			// 
			// tBoxPunishmentType
			// 
			this->tBoxPunishmentType->Location = System::Drawing::Point(208, 80);
			this->tBoxPunishmentType->Name = S"tBoxPunishmentType";
			this->tBoxPunishmentType->Size = System::Drawing::Size(360, 21);
			this->tBoxPunishmentType->TabIndex = 34;
			this->tBoxPunishmentType->Text = S"";
			// 
			// tBoxStaffID
			// 
			this->tBoxStaffID->Location = System::Drawing::Point(112, 80);
			this->tBoxStaffID->Name = S"tBoxStaffID";
			this->tBoxStaffID->Size = System::Drawing::Size(80, 21);
			this->tBoxStaffID->TabIndex = 33;
			this->tBoxStaffID->Text = S"";
			// 
			// tBtnAddRecord
			// 
			this->tBtnAddRecord->ImageIndex = 9;
			this->tBtnAddRecord->Text = S"新增记录";
			this->tBtnAddRecord->ToolTipText = S"新增记录";
			// 
			// tBtnDeleteRecord
			// 
			this->tBtnDeleteRecord->ImageIndex = 3;
			this->tBtnDeleteRecord->Text = S"删除记录";
			this->tBtnDeleteRecord->ToolTipText = S"删除记录";
			// 
			// tBtnModifyRecord
			// 
			this->tBtnModifyRecord->ImageIndex = 0;
			this->tBtnModifyRecord->Text = S"保存修改";
			this->tBtnModifyRecord->ToolTipText = S"保存修改";
			// 
			// tBtnLastRecord
			// 
			this->tBtnLastRecord->ImageIndex = 7;
			this->tBtnLastRecord->Text = S"尾记录";
			this->tBtnLastRecord->ToolTipText = S"尾记录";
			// 
			// tBtnPreviousRecord
			// 
			this->tBtnPreviousRecord->ImageIndex = 4;
			this->tBtnPreviousRecord->Text = S"上一记录";
			this->tBtnPreviousRecord->ToolTipText = S"上一记录";
			// 
			// tBtnNextRecord
			// 
			this->tBtnNextRecord->ImageIndex = 8;
			this->tBtnNextRecord->Text = S"下一记录";
			this->tBtnNextRecord->ToolTipText = S"下一记录";
			// 
			// tBtnFirstRecord
			// 
			this->tBtnFirstRecord->ImageIndex = 5;
			this->tBtnFirstRecord->Text = S"首记录";
			this->tBtnFirstRecord->ToolTipText = S"首记录";
			// 
			// toolBar1
			// 
			System::Windows::Forms::ToolBarButton* __mcTemp__1[] = new System::Windows::Forms::ToolBarButton*[9];
			__mcTemp__1[0] = this->tBtnFirstRecord;
			__mcTemp__1[1] = this->tBtnPreviousRecord;
			__mcTemp__1[2] = this->tBtnNextRecord;
			__mcTemp__1[3] = this->tBtnLastRecord;
			__mcTemp__1[4] = this->tBtnAddRecord;
			__mcTemp__1[5] = this->tBtnDeleteRecord;
			__mcTemp__1[6] = this->tBtnModifyRecord;
			__mcTemp__1[7] = this->tBtnCancelModify;
			__mcTemp__1[8] = this->tBtnQuit;
			this->toolBar1->Buttons->AddRange(__mcTemp__1);
			this->toolBar1->DropDownArrows = true;
			this->toolBar1->ImageList = this->imageList1;
			this->toolBar1->Location = System::Drawing::Point(0, 0);
			this->toolBar1->Name = S"toolBar1";
			this->toolBar1->ShowToolTips = true;
			this->toolBar1->Size = System::Drawing::Size(608, 41);
			this->toolBar1->TabIndex = 3;
			this->toolBar1->ButtonClick += new System::Windows::Forms::ToolBarButtonClickEventHandler(this, toolBar1_ButtonClick);
			// 
			// imageList1
			// 
			this->imageList1->ImageSize = System::Drawing::Size(16, 16);
			this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer *  >(resources->GetObject(S"imageList1.ImageStream")));
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
			// 
			// PunishmentManage
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(608, 333);
			this->Controls->Add(this->groupBox1);
			this->Controls->Add(this->toolBar1);
			this->Name = S"PunishmentManage";
			this->Text = S"惩罚管理";
			this->groupBox1->ResumeLayout(false);
			this->ResumeLayout(false);

		}		
		//------------------设置数据绑定----------------------
        void DataBidings()
		{
			this->tBoxStaffID->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"职员编号");
			this->tBoxPunishmentType->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"惩罚类型");
			this->tBoxPunishment->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"惩罚金额");
			this->tBoxPunishmentDate->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"惩罚日期");
			this->tBoxIsInSalary->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"是否计入工资");
			this->tBoxCause->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"惩罚原因");
			this->tBoxDepartmentComment->DataBindings->Add("Text",this->ds->Tables->Item[S"职员惩罚表"],"部门意见");
			
		}
	private: System::Void toolBar1_ButtonClick(System::Object *  sender, System::Windows::Forms::ToolBarButtonClickEventArgs *  e)
		 {
				 if(String::Compare(e->Button->ToolTipText->Trim(),S"首记录") == 0)
			 {				 
				 this->cmPunishment->Position = 0;	
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"上一记录") == 0)
			 {
				 if(this->cmPunishment->Position > 0)
				 {					
					 this->cmPunishment->Position--;
				 }
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"下一记录") == 0)
			 {
				 if(this->cmPunishment->Position < this->cmPunishment->Count - 1)
				 {				
					 this->cmPunishment->Position++;
				 }
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"尾记录") == 0)
			 {
				 this->cmPunishment->Position = this->cmPunishment->Count - 1;
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"新增记录") == 0)
			 {
				 //检查新记录
				 if(this->tBoxStaffID->Text->Trim() == S"")
				 {
					 MessageBox::Show(S"职员编号不能为空",S"提示");
					 return;
				 }				
				 //提交修改
				 this->cmPunishment->AddNew();				 
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"删除记录") == 0)
			 {
				 //修改数据库
				 String* tempSQL = String::Format(S"Delete from 职员惩罚表 where 职员编号 = '{0}' AND 惩罚类型 = '{1}' AND 惩罚日期 = '{2}'",this->tBoxStaffID->Text,this->tBoxPunishmentType->Text,this->tBoxPunishmentDate->Text);
				 this->MyDataBase->SQLOperate(tempSQL);
				 //修改数据集
				 this->cmPunishment->RemoveAt(this->cmPunishment->Position);
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"保存修改") == 0)
			 {
				 //检查新记录
				 if(this->tBoxStaffID->Text->Trim() == S"")
				 {
					 MessageBox::Show(S"职员编号不能为空",S"提示");
					 return;
				 }
				 if(this->tBoxPunishment->Text->Trim() == S"")
				 {
					 MessageBox::Show(S"惩罚金额不能为空!",S"提示");
					 return;
				 }
				 //提交修改
				 this->cmPunishment->EndCurrentEdit();
				 //更新数据库
				 this->MyDataBase->UpdateDataBase(this->ds,S"职员惩罚表");
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"取消修改") == 0)
			 {
				 this->cmPunishment->CancelCurrentEdit();
			 }
			 else if(String::Compare(e->Button->ToolTipText->Trim(),S"退出") == 0)
			 {
				 this->Close();
			 }
		}

};
}

⌨️ 快捷键说明

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