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

📄 complainform.h

📁 实现了很好的客户关系管理功能
💻 H
📖 第 1 页 / 共 3 页
字号:
			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"删除";
			// 
			// toolStripLabel1
			// 
			this->toolStripLabel1->Name = L"toolStripLabel1";
			this->toolStripLabel1->Size = System::Drawing::Size(59, 22);
			this->toolStripLabel1->Text = L"客户名称:";
			// 
			// 客户名称ToolStripComboBox
			// 
			this->客户名称ToolStripComboBox->Name = L"客户名称ToolStripComboBox";
			this->客户名称ToolStripComboBox->Size = System::Drawing::Size(160, 25);
			this->客户名称ToolStripComboBox->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, &ComplainForm::查询ToolStripButton_Click);
			// 
			// 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"移到第一条记录";
			// 
			// bindingNavigatorMovePreviousItem
			// 
			this->bindingNavigatorMovePreviousItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMovePreviousItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMovePreviousItem.Image")));
			this->bindingNavigatorMovePreviousItem->Name = L"bindingNavigatorMovePreviousItem";
			this->bindingNavigatorMovePreviousItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMovePreviousItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMovePreviousItem->Text = L"移到上一条记录";
			// 
			// bindingNavigatorSeparator
			// 
			this->bindingNavigatorSeparator->Name = L"bindingNavigatorSeparator";
			this->bindingNavigatorSeparator->Size = System::Drawing::Size(6, 25);
			// 
			// bindingNavigatorMoveNextItem
			// 
			this->bindingNavigatorMoveNextItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
			this->bindingNavigatorMoveNextItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"bindingNavigatorMoveNextItem.Image")));
			this->bindingNavigatorMoveNextItem->Name = L"bindingNavigatorMoveNextItem";
			this->bindingNavigatorMoveNextItem->RightToLeftAutoMirrorImage = true;
			this->bindingNavigatorMoveNextItem->Size = System::Drawing::Size(23, 22);
			this->bindingNavigatorMoveNextItem->Text = L"移到下一条记录";
			// 
			// ComplainForm
			// 
			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->处理情况TextBox);
			this->Controls->Add(this->投诉主题TextBox);
			this->Controls->Add(this->投诉内容TextBox);
			this->Controls->Add(this->客户投诉DataGridView);
			this->Controls->Add(this->自编号TextBox);
			this->Controls->Add(this->客户名称ComboBox);
			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(this->客户投诉BindingNavigator);
			this->Name = L"ComplainForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"客户投诉管理";
			this->Load += gcnew System::EventHandler(this, &ComplainForm::ComplainForm_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 ComplainForm_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 = "TS0000000" + MyID.ToString();
                    break;
                case 2:
                    MyNewID = "TS000000" + MyID.ToString();
                    break;
                case 3:
                    MyNewID = "TS00000" + MyID.ToString();
                    break;
                case 4:
                    MyNewID = "TS0000" + MyID.ToString();
                    break;
                case 5:
                    MyNewID = "TS000" + MyID.ToString();
                    break;
                case 6:
                    MyNewID = "TS00" + MyID.ToString();
                    break;
                case 7:
                    MyNewID = "TS0" + MyID.ToString();
                    break;
            }
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
            this->自编号TextBox->Text = MyNewID;
		 }
	};
}

⌨️ 快捷键说明

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