📄 accidentform.h
字号:
// 开始日期ToolStripTextBox
//
this->开始日期ToolStripTextBox->Name = L"开始日期ToolStripTextBox";
this->开始日期ToolStripTextBox->Size = System::Drawing::Size(100, 25);
this->开始日期ToolStripTextBox->Text = L"2000-1-1";
//
// 对方姓名TextBox
//
this->对方姓名TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->对方姓名TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"对方姓名", true)));
this->对方姓名TextBox->Location = System::Drawing::Point(421, 107);
this->对方姓名TextBox->Name = L"对方姓名TextBox";
this->对方姓名TextBox->Size = System::Drawing::Size(116, 21);
this->对方姓名TextBox->TabIndex = 56;
//
// 驾驶员TextBox
//
this->驾驶员TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->驾驶员TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"驾驶员", true)));
this->驾驶员TextBox->Location = System::Drawing::Point(432, 26);
this->驾驶员TextBox->Name = L"驾驶员TextBox";
this->驾驶员TextBox->Size = System::Drawing::Size(105, 21);
this->驾驶员TextBox->TabIndex = 36;
//
// 日期DateTimePicker
//
this->日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->出车事故管理BindingSource, L"日期",
true)));
this->日期DateTimePicker->Location = System::Drawing::Point(43, 54);
this->日期DateTimePicker->Name = L"日期DateTimePicker";
this->日期DateTimePicker->Size = System::Drawing::Size(123, 21);
this->日期DateTimePicker->TabIndex = 38;
//
// 地点TextBox
//
this->地点TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"地点", true)));
this->地点TextBox->Location = System::Drawing::Point(213, 53);
this->地点TextBox->Name = L"地点TextBox";
this->地点TextBox->Size = System::Drawing::Size(50, 21);
this->地点TextBox->TabIndex = 40;
//
// 自编号TextBox
//
this->自编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"自编号", true)));
this->自编号TextBox->Location = System::Drawing::Point(55, 27);
this->自编号TextBox->Name = L"自编号TextBox";
this->自编号TextBox->ReadOnly = true;
this->自编号TextBox->Size = System::Drawing::Size(125, 21);
this->自编号TextBox->TabIndex = 32;
//
// 车牌号ComboBox
//
this->车牌号ComboBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"车牌号", true)));
this->车牌号ComboBox->FormattingEnabled = true;
this->车牌号ComboBox->Location = System::Drawing::Point(238, 27);
this->车牌号ComboBox->Name = L"车牌号ComboBox";
this->车牌号ComboBox->Size = System::Drawing::Size(125, 20);
this->车牌号ComboBox->TabIndex = 34;
//
// 公司负担金额TextBox
//
this->公司负担金额TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"公司负担金额",
true)));
this->公司负担金额TextBox->Location = System::Drawing::Point(358, 53);
this->公司负担金额TextBox->Name = L"公司负担金额TextBox";
this->公司负担金额TextBox->Size = System::Drawing::Size(48, 21);
this->公司负担金额TextBox->TabIndex = 42;
//
// 个人负担金额TextBox
//
this->个人负担金额TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->个人负担金额TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"个人负担金额",
true)));
this->个人负担金额TextBox->Location = System::Drawing::Point(494, 53);
this->个人负担金额TextBox->Name = L"个人负担金额TextBox";
this->个人负担金额TextBox->Size = System::Drawing::Size(43, 21);
this->个人负担金额TextBox->TabIndex = 44;
//
// 保险理赔金额TextBox
//
this->保险理赔金额TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"保险理赔金额",
true)));
this->保险理赔金额TextBox->Location = System::Drawing::Point(91, 81);
this->保险理赔金额TextBox->Name = L"保险理赔金额TextBox";
this->保险理赔金额TextBox->Size = System::Drawing::Size(75, 21);
this->保险理赔金额TextBox->TabIndex = 46;
//
// 事故概要TextBox
//
this->事故概要TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->事故概要TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"事故概要", true)));
this->事故概要TextBox->Location = System::Drawing::Point(67, 162);
this->事故概要TextBox->Multiline = true;
this->事故概要TextBox->Name = L"事故概要TextBox";
this->事故概要TextBox->Size = System::Drawing::Size(470, 101);
this->事故概要TextBox->TabIndex = 48;
//
// 对方单位名称TextBox
//
this->对方单位名称TextBox->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left)
| System::Windows::Forms::AnchorStyles::Right));
this->对方单位名称TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"对方单位名称",
true)));
this->对方单位名称TextBox->Location = System::Drawing::Point(262, 80);
this->对方单位名称TextBox->Name = L"对方单位名称TextBox";
this->对方单位名称TextBox->Size = System::Drawing::Size(275, 21);
this->对方单位名称TextBox->TabIndex = 50;
//
// 对方联系电话TextBox
//
this->对方联系电话TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"对方联系电话",
true)));
this->对方联系电话TextBox->Location = System::Drawing::Point(91, 108);
this->对方联系电话TextBox->Name = L"对方联系电话TextBox";
this->对方联系电话TextBox->Size = System::Drawing::Size(75, 21);
this->对方联系电话TextBox->TabIndex = 52;
//
// 对方车牌号TextBox
//
this->对方车牌号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->出车事故管理BindingSource, L"对方车牌号", true)));
this->对方车牌号TextBox->Location = System::Drawing::Point(250, 107);
this->对方车牌号TextBox->Name = L"对方车牌号TextBox";
this->对方车牌号TextBox->Size = System::Drawing::Size(94, 21);
this->对方车牌号TextBox->TabIndex = 54;
//
// AccidentForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(542, 416);
this->Controls->Add(this->出车事故管理DataGridView);
this->Controls->Add(自编号Label);
this->Controls->Add(车牌号Label);
this->Controls->Add(驾驶员Label);
this->Controls->Add(日期Label);
this->Controls->Add(地点Label);
this->Controls->Add(公司负担金额Label);
this->Controls->Add(个人负担金额Label);
this->Controls->Add(保险理赔金额Label);
this->Controls->Add(事故概要Label);
this->Controls->Add(对方单位名称Label);
this->Controls->Add(对方联系电话Label);
this->Controls->Add(对方车牌号Label);
this->Controls->Add(对方姓名Label);
this->Controls->Add(说明Label);
this->Controls->Add(this->说明TextBox);
this->Controls->Add(this->出车事故管理BindingNavigator);
this->Controls->Add(this->对方姓名TextBox);
this->Controls->Add(this->驾驶员TextBox);
this->Controls->Add(this->日期DateTimePicker);
this->Controls->Add(this->地点TextBox);
this->Controls->Add(this->自编号TextBox);
this->Controls->Add(this->车牌号ComboBox);
this->Controls->Add(this->公司负担金额TextBox);
this->Controls->Add(this->个人负担金额TextBox);
this->Controls->Add(this->保险理赔金额TextBox);
this->Controls->Add(this->事故概要TextBox);
this->Controls->Add(this->对方单位名称TextBox);
this->Controls->Add(this->对方联系电话TextBox);
this->Controls->Add(this->对方车牌号TextBox);
this->Name = L"AccidentForm";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"出车事故管理";
this->Load += gcnew System::EventHandler(this, &AccidentForm::AccidentForm_Load);
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->MyOfficeDataSet))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->出车事故管理BindingSource))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->出车事故管理DataGridView))->EndInit();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->出车事故管理BindingNavigator))->EndInit();
this->出车事故管理BindingNavigator->ResumeLayout(false);
this->出车事故管理BindingNavigator->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: static String^ MyOfficeConnectionString= L"Data Source=.;Initial Catalog=MyOffice;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->MyOfficeDataSet->出车事故管理);
}
private: System::Void AccidentForm_Load(System::Object^ sender, System::EventArgs^ e) {
// TODO: 这行代码将数据加载到表“MyOfficeDataSet.出车事故管理”中。您可以根据需要移动或移除它。
this->出车事故管理TableAdapter->Fill(this->MyOfficeDataSet->出车事故管理);
String^ MySQLConnectionString = MyOfficeConnectionString;
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
MyConnection->Open();
System::Data::DataTable^ MyQueryTable = gcnew System::Data::DataTable();
String^ MySQL = "SELECT 车牌号 FROM 车辆登记管理";
SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
MyAdapter->Fill(MyQueryTable);
this->车牌号ComboBox->DataSource = MyQueryTable;
this->车牌号ComboBox->DisplayMember = "车牌号";
this->车牌号ComboBox->ValueMember = "车牌号";
if (MyConnection->State == ConnectionState::Open)
{
MyConnection->Close();
}
}
private: System::Void 查询ToolStripButton_Click(System::Object^ sender, System::EventArgs^ e) {
try
{
this->出车事故管理TableAdapter->FillBy(this->MyOfficeDataSet->出车事故管理, System::Nullable<System::DateTime >((*cli::safe_cast<System::DateTime^>(System::Convert::ChangeType(开始日期ToolStripTextBox->Text,
System::DateTime::typeid)))), System::Nullable<System::DateTime >((*cli::safe_cast<System::DateTime^>(System::Convert::ChangeType(结束日期ToolStripTextBox->Text, System::DateTime::typeid)))));
}
catch (System::Exception^ ex)
{
System::Windows::Forms::MessageBox::Show(ex->Message);
}
}
private: System::Void bindingNavigatorAddNewItem_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
//自动计算自编号
String^ MySQLConnectionString = MyOfficeConnectionString;
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
MyConnection->Open();
String^ MySQL = "Select max(自编号) 自编号 From 出车事故管理";
SqlCommand^ MyCommand = gcnew SqlCommand(MySQL, MyConnection);
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 = "SG0000000" + MyID.ToString();
break;
case 2:
MyNewID = "SG000000" + MyID.ToString();
break;
case 3:
MyNewID = "SG00000" + MyID.ToString();
break;
case 4:
MyNewID = "SG0000" + MyID.ToString();
break;
case 5:
MyNewID = "SG000" + MyID.ToString();
break;
case 6:
MyNewID = "SG00" + MyID.ToString();
break;
case 7:
MyNewID = "SG0" + MyID.ToString();
break;
}
if(MyConnection->State==ConnectionState::Open)
{
MyConnection->Close();
}
this->自编号TextBox->Text = MyNewID;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -