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

📄 clientform.h

📁 实现了很好的客户关系管理功能
💻 H
📖 第 1 页 / 共 5 页
字号:
			// 添加日期DateTimePicker
			// 
			this->添加日期DateTimePicker->Anchor = static_cast<System::Windows::Forms::AnchorStyles>(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left) 
				| System::Windows::Forms::AnchorStyles::Right));
			this->添加日期DateTimePicker->DataBindings->Add((gcnew System::Windows::Forms::Binding(L"Value", this->客户资料BindingSource, L"添加日期", 
				true)));
			this->添加日期DateTimePicker->Location = System::Drawing::Point(425, 214);
			this->添加日期DateTimePicker->Name = L"添加日期DateTimePicker";
			this->添加日期DateTimePicker->Size = System::Drawing::Size(112, 21);
			this->添加日期DateTimePicker->TabIndex = 103;
			// 
			// 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"删除";
			// 
			// 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"新增";
			// 
			// toolStripLabel1
			// 
			this->toolStripLabel1->Name = L"toolStripLabel1";
			this->toolStripLabel1->Size = System::Drawing::Size(59, 22);
			this->toolStripLabel1->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, &ClientForm::查询ToolStripButton_Click);
			// 
			// 客户名称ToolStripComboBox
			// 
			this->客户名称ToolStripComboBox->Name = L"客户名称ToolStripComboBox";
			this->客户名称ToolStripComboBox->Size = System::Drawing::Size(170, 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^  >(25) {this->dataGridViewTextBoxColumn1, 
				this->dataGridViewTextBoxColumn2, this->dataGridViewTextBoxColumn3, this->dataGridViewTextBoxColumn4, this->dataGridViewTextBoxColumn5, 
				this->dataGridViewTextBoxColumn6, this->dataGridViewTextBoxColumn7, this->dataGridViewTextBoxColumn8, this->dataGridViewTextBoxColumn9, 
				this->dataGridViewTextBoxColumn10, this->dataGridViewTextBoxColumn11, this->dataGridViewTextBoxColumn12, this->dataGridViewTextBoxColumn13, 
				this->dataGridViewTextBoxColumn14, this->dataGridViewTextBoxColumn15, this->dataGridViewTextBoxColumn16, this->dataGridViewTextBoxColumn17, 
				this->dataGridViewTextBoxColumn18, this->dataGridViewTextBoxColumn19, this->dataGridViewTextBoxColumn20, this->dataGridViewTextBoxColumn21, 
				this->dataGridViewTextBoxColumn22, this->dataGridViewTextBoxColumn23, this->dataGridViewTextBoxColumn24, this->dataGridViewTextBoxColumn25});
			this->客户资料DataGridView->DataSource = this->客户资料BindingSource;
			this->客户资料DataGridView->Location = System::Drawing::Point(4, 242);
			this->客户资料DataGridView->MultiSelect = false;
			this->客户资料DataGridView->Name = L"客户资料DataGridView";
			this->客户资料DataGridView->ReadOnly = true;
			this->客户资料DataGridView->RowHeadersVisible = false;
			this->客户资料DataGridView->RowTemplate->Height = 23;
			this->客户资料DataGridView->Size = System::Drawing::Size(533, 170);
			this->客户资料DataGridView->TabIndex = 53;
			// 
			// 客户资料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 = 52;
			this->客户资料BindingNavigator->Text = L"bindingNavigator1";
			// 
			// ClientForm
			// 
			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->企业性质ComboBox);
			this->Controls->Add(this->省份ComboBox);
			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->Controls->Add(this->联系人TextBox);
			this->Controls->Add(this->开户银行TextBox);
			this->Controls->Add(this->银行帐号TextBox);
			this->Controls->Add(this->纳税号码TextBox);
			this->Controls->Add(this->客户来源ComboBox);
			this->Controls->Add(this->客户类型ComboBox);
			this->Controls->Add(this->客户阶段ComboBox);
			this->Controls->Add(this->客户状态ComboBox);
			this->Controls->Add(this->客户级别ComboBox);
			this->Controls->Add(this->信用等级ComboBox);
			this->Controls->Add(this->客户规模ComboBox);
			this->Controls->Add(this->说明TextBox);
			this->Controls->Add(this->添加日期DateTimePicker);
			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(客户类型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->客户资料DataGridView);
			this->Controls->Add(this->客户资料BindingNavigator);
			this->Name = L"ClientForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"客户资料管理";
			this->Load += gcnew System::EventHandler(this, &ClientForm::ClientForm_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
		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 ClientForm_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 DISTINCT 省份 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();
            }    
		 }
		private: System::Void 省份ComboBox_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			String^ MySQLConnectionString = MyCRMConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            System::Data::DataTable^ MyQueryTable = gcnew System::Data::DataTable();
            String^ MySQL = "SELECT 城市 FROM 中国省份 WHERE 省份='"+this->省份ComboBox->Text+"'";
            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 城市ComboBox_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
			String^ MySQLConnectionString = MyCRMConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            System::Data::DataTable^ MyQueryTable = gcnew System::Data::DataTable();
            String^ MySQL = "SELECT 区号 FROM 中国省份 WHERE 城市='" + this->城市ComboBox->Text + "'";
            SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyQueryTable);
            this->电话TextBox->Text = MyQueryTable->Rows[0][0]->ToString();
            this->传真TextBox->Text = MyQueryTable->Rows[0][0]->ToString();
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		 }
		private: System::Void 查询ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			try
            {
    

⌨️ 快捷键说明

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