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

📄 remindform.h

📁 实现了很好的客户关系管理功能
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->dataGridViewTextBoxColumn2->Name = L"dataGridViewTextBoxColumn2";
			this->dataGridViewTextBoxColumn2->ReadOnly = true;
			// 
			// bindingNavigatorMoveFirstItem
			// 
			this->bindingNavigatorMoveFirstItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMoveFirstItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMoveFirstItem.Image")));
			this->bindingNavigatorMoveFirstItem->Name = L"bindingNavigatorMoveFirstItem";
			this->bindingNavigatorMoveFirstItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMoveFirstItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMoveFirstItem->Text = L"移到第一条记录";
			// 
			// 自编号TextBox
			// 
			this->自编号TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->事务提醒BindingSource, L"自编号", true)));
			this->自编号TextBox->Location = System::Drawing::Point(69, 26);
			this->自编号TextBox->Name = L"自编号TextBox";
			this->自编号TextBox->ReadOnly = true;
			this->自编号TextBox->Size = System::Drawing::Size(200, 21);
			this->自编号TextBox->TabIndex = 15;
			// 
			// 客户名称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(69, 53);
			this->客户名称ComboBox->Name = L"客户名称ComboBox";
			this->客户名称ComboBox->Size = System::Drawing::Size(200, 20);
			this->客户名称ComboBox->TabIndex = 17;
			// 
			// 提醒日期DateTimePicker
			// 
			this->提醒日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->事务提醒BindingSource, L"提醒日期", 
				true)));
			this->提醒日期DateTimePicker->Location = System::Drawing::Point(69, 79);
			this->提醒日期DateTimePicker->Name = L"提醒日期DateTimePicker";
			this->提醒日期DateTimePicker->Size = System::Drawing::Size(200, 21);
			this->提醒日期DateTimePicker->TabIndex = 19;
			// 
			// 事务主题TextBox
			// 
			this->事务主题TextBox->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Text", this->事务提醒BindingSource, L"事务主题", true)));
			this->事务主题TextBox->Location = System::Drawing::Point(69, 106);
			this->事务主题TextBox->Name = L"事务主题TextBox";
			this->事务主题TextBox->Size = System::Drawing::Size(200, 21);
			this->事务主题TextBox->TabIndex = 21;
			// 
			// 详细描述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(337, 26);
			this->详细描述TextBox->Multiline = true;
			this->详细描述TextBox->Name = L"详细描述TextBox";
			this->详细描述TextBox->Size = System::Drawing::Size(200, 101);
			this->详细描述TextBox->TabIndex = 23;
			// 
			// toolStripLabel1
			// 
			this->toolStripLabel1->Name = L"toolStripLabel1";
			this->toolStripLabel1->Size = System::Drawing::Size(59, 22);
			this->toolStripLabel1->Text = L"客户名称:";
			// 
			// bindingNavigatorDeleteItem
			// 
			this->bindingNavigatorDeleteItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorDeleteItem.Image")));
			this->bindingNavigatorDeleteItem->Name = L"bindingNavigatorDeleteItem";
			this->bindingNavigatorDeleteItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorDeleteItem->Size = System::Drawing::Size(49, 22);
			this->bindingNavigatorDeleteItem->Text = L"删除";
			// 
			// 查询ToolStripButton
			// 
			this->查询ToolStripButton->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"查询ToolStripButton.Image")));
			this->查询ToolStripButton->Name = L"查询ToolStripButton";
			this->查询ToolStripButton->Size = System::Drawing::Size(49, 22);
			this->查询ToolStripButton->Text = L"查询";
			this->查询ToolStripButton->Click += gcnew System::EventHandler(this, &RemindForm::查询ToolStripButton_Click);
			// 
			// 客户名称ToolStripComboBox
			// 
			this->客户名称ToolStripComboBox->Name = L"客户名称ToolStripComboBox";
			this->客户名称ToolStripComboBox->Size = System::Drawing::Size(160, 25);
			this->客户名称ToolStripComboBox->Text = L"%%";
			// 
			// 事务提醒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->Columns->AddRange(gcnew cli::array< System::Windows::Forms::DataGridViewColumn^  >(5) {this->dataGridViewTextBoxColumn1, 
				this->dataGridViewTextBoxColumn2, this->dataGridViewTextBoxColumn3, this->dataGridViewTextBoxColumn4, this->dataGridViewTextBoxColumn5});
			this->事务提醒DataGridView->DataSource = this->事务提醒BindingSource;
			this->事务提醒DataGridView->Location = System::Drawing::Point(4, 132);
			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, 280);
			this->事务提醒DataGridView->TabIndex = 13;
			// 
			// bindingNavigatorAddNewItem
			// 
			this->bindingNavigatorAddNewItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorAddNewItem.Image")));
			this->bindingNavigatorAddNewItem->Name = L"bindingNavigatorAddNewItem";
			this->bindingNavigatorAddNewItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorAddNewItem->Size = System::Drawing::Size(49, 22);
			this->bindingNavigatorAddNewItem->Text = L"新增";
			this->bindingNavigatorAddNewItem->MouseUp += gcnew System::Windows::Forms::MouseEventHandler(this, &RemindForm::bindingNavigatorAddNewItem_MouseUp);
			// 
			// 事务提醒BindingNavigator
			// 
			this->事务提醒BindingNavigator->AddNewItem = this->bindingNavigatorAddNewItem;
			this->事务提醒BindingNavigator->BindingSource = this->事务提醒BindingSource;
			this->事务提醒BindingNavigator->CountItem = nullptr;
			this->事务提醒BindingNavigator->DeleteItem = this->bindingNavigatorDeleteItem;
			this->事务提醒BindingNavigator->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(12) {this->toolStripLabel1, 
				this->客户名称ToolStripComboBox, this->查询ToolStripButton, this->bindingNavigatorMoveFirstItem, this->bindingNavigatorMovePreviousItem, 
				this->bindingNavigatorSeparator, this->bindingNavigatorMoveNextItem, this->bindingNavigatorMoveLastItem, this->bindingNavigatorSeparator2, 
				this->bindingNavigatorAddNewItem, this->bindingNavigatorDeleteItem, this->事务提醒BindingNavigatorSaveItem});
			this->事务提醒BindingNavigator->Location = System::Drawing::Point(0, 0);
			this->事务提醒BindingNavigator->MoveFirstItem = this->bindingNavigatorMoveFirstItem;
			this->事务提醒BindingNavigator->MoveLastItem = this->bindingNavigatorMoveLastItem;
			this->事务提醒BindingNavigator->MoveNextItem = this->bindingNavigatorMoveNextItem;
			this->事务提醒BindingNavigator->MovePreviousItem = this->bindingNavigatorMovePreviousItem;
			this->事务提醒BindingNavigator->Name = L"事务提醒BindingNavigator";
			this->事务提醒BindingNavigator->PositionItem = nullptr;
			this->事务提醒BindingNavigator->Size = System::Drawing::Size(542, 25);
			this->事务提醒BindingNavigator->TabIndex = 12;
			this->事务提醒BindingNavigator->Text = L"bindingNavigator1";
			// 
			// RemindForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(542, 416);
			this->Controls->Add(自编号Label);
			this->Controls->Add(this->自编号TextBox);
			this->Controls->Add(客户名称Label);
			this->Controls->Add(this->客户名称ComboBox);
			this->Controls->Add(提醒日期Label);
			this->Controls->Add(this->提醒日期DateTimePicker);
			this->Controls->Add(this->事务主题TextBox);
			this->Controls->Add(this->详细描述TextBox);
			this->Controls->Add(事务主题Label);
			this->Controls->Add(详细描述Label);
			this->Controls->Add(this->事务提醒DataGridView);
			this->Controls->Add(this->事务提醒BindingNavigator);
			this->Name = L"RemindForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"客户提醒管理";
			this->Load += gcnew System::EventHandler(this, &RemindForm::RemindForm_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->MyCRMDataSet))->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
		public:static String^ My客户名称 = "";
		private: static String^ MyCRMConnectionString= L"Data Source=.;Initial Catalog=MyCRM;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->MyCRMDataSet->事务提醒);
		 }
		private: System::Void RemindForm_Load(System::Object^  sender, System::EventArgs^  e) {
			 // TODO: 这行代码将数据加载到表“MyCRMDataSet.事务提醒”中。您可以根据需要移动或移除它。
			 //this->事务提醒TableAdapter->Fill(this->MyCRMDataSet->事务提醒);
			String^ MySQLConnectionString = MyCRMConnectionString;
            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 = "客户名称";
            System::Data::DataTable^ MyClientTable = gcnew System::Data::DataTable();
            MySQL = "SELECT 客户名称 FROM 客户资料";
            MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyClientTable);
            for each (DataRow^ MyRow in MyClientTable->Rows)
            {
                this->客户名称ToolStripComboBox->Items->Add(MyRow[0]->ToString());
            }
            this->客户名称ToolStripComboBox->Items->Add("%%");
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            if (this->My客户名称->Length > 1)
            {
                this->事务提醒TableAdapter->FillBy(this->MyCRMDataSet->事务提醒, this->My客户名称);
            }
		 }
		private: System::Void 查询ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			try
            {
                this->事务提醒TableAdapter->FillBy(this->MyCRMDataSet->事务提醒, 客户名称ToolStripComboBox->Text);
            }
			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 = MyCRMConnectionString;
            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 = "TX0000000" + MyID.ToString();
                    break;
                case 2:
                    MyNewID = "TX000000" + MyID.ToString();
                    break;
                case 3:
                    MyNewID = "TX00000" + MyID.ToString();
                    break;
                case 4:
                    MyNewID = "TX0000" + MyID.ToString();
                    break;
                case 5:
                    MyNewID = "TX000" + MyID.ToString();
                    break;
                case 6:
                    MyNewID = "TX00" + MyID.ToString();
                    break;
                case 7:
                    MyNewID = "TX0" + MyID.ToString();
                    break;
            }
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            this->自编号TextBox->Text = MyNewID;
		 }
	};
}

⌨️ 快捷键说明

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