📄 changeuserpasswordform.h
字号:
#pragma once
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace System::Data::SqlClient;
namespace 客户关系管理系统 {
/// <summary>
/// ChangeUserPasswordForm 摘要
///
/// 警告: 如果更改此类的名称,则需要更改
/// 与此类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。否则,
/// 设计器将不能与此窗体的关联
/// 本地化资源正确交互。
/// </summary>
public ref class ChangeUserPasswordForm : public System::Windows::Forms::Form
{
public:
ChangeUserPasswordForm(void)
{
InitializeComponent();
//
//TODO: 在此处添加构造函数代码
//
}
protected:
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
~ChangeUserPasswordForm()
{
if (components)
{
delete components;
}
}
public: System::Windows::Forms::TextBox^ 用户名称TextBox;
protected:
private: System::Windows::Forms::Label^ label4;
public:
private: System::Windows::Forms::Button^ 返回系统Button;
private: System::Windows::Forms::Button^ 修改密码Button;
private: System::Windows::Forms::TextBox^ 再输一次新密码TextBox;
private: System::Windows::Forms::Label^ label3;
private: System::Windows::Forms::TextBox^ 新密码TextBox;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ 旧密码TextBox;
private: System::Windows::Forms::Label^ label1;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
void InitializeComponent(void)
{
System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(ChangeUserPasswordForm::typeid));
this->用户名称TextBox = (gcnew System::Windows::Forms::TextBox());
this->label4 = (gcnew System::Windows::Forms::Label());
this->返回系统Button = (gcnew System::Windows::Forms::Button());
this->修改密码Button = (gcnew System::Windows::Forms::Button());
this->再输一次新密码TextBox = (gcnew System::Windows::Forms::TextBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->新密码TextBox = (gcnew System::Windows::Forms::TextBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->旧密码TextBox = (gcnew System::Windows::Forms::TextBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->SuspendLayout();
//
// 用户名称TextBox
//
this->用户名称TextBox->Location = System::Drawing::Point(121, 98);
this->用户名称TextBox->Name = L"用户名称TextBox";
this->用户名称TextBox->PasswordChar = '*';
this->用户名称TextBox->ReadOnly = true;
this->用户名称TextBox->Size = System::Drawing::Size(173, 21);
this->用户名称TextBox->TabIndex = 59;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(50, 103);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(65, 12);
this->label4->TabIndex = 58;
this->label4->Text = L"用户名称:";
//
// 返回系统Button
//
this->返回系统Button->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"返回系统Button.Image")));
this->返回系统Button->Location = System::Drawing::Point(177, 125);
this->返回系统Button->Name = L"返回系统Button";
this->返回系统Button->Size = System::Drawing::Size(100, 25);
this->返回系统Button->TabIndex = 57;
this->返回系统Button->Text = L"返回系统";
this->返回系统Button->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
this->返回系统Button->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageBeforeText;
this->返回系统Button->UseVisualStyleBackColor = true;
this->返回系统Button->Click += gcnew System::EventHandler(this, &ChangeUserPasswordForm::返回系统Button_Click);
//
// 修改密码Button
//
this->修改密码Button->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"修改密码Button.Image")));
this->修改密码Button->Location = System::Drawing::Point(68, 124);
this->修改密码Button->Name = L"修改密码Button";
this->修改密码Button->Size = System::Drawing::Size(100, 25);
this->修改密码Button->TabIndex = 56;
this->修改密码Button->Text = L"修改密码";
this->修改密码Button->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
this->修改密码Button->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageBeforeText;
this->修改密码Button->UseVisualStyleBackColor = true;
this->修改密码Button->Click += gcnew System::EventHandler(this, &ChangeUserPasswordForm::修改密码Button_Click);
//
// 再输一次新密码TextBox
//
this->再输一次新密码TextBox->Location = System::Drawing::Point(166, 71);
this->再输一次新密码TextBox->Name = L"再输一次新密码TextBox";
this->再输一次新密码TextBox->PasswordChar = '*';
this->再输一次新密码TextBox->Size = System::Drawing::Size(128, 21);
this->再输一次新密码TextBox->TabIndex = 55;
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(50, 76);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(101, 12);
this->label3->TabIndex = 54;
this->label3->Text = L"再输一次新密码:";
//
// 新密码TextBox
//
this->新密码TextBox->Location = System::Drawing::Point(109, 44);
this->新密码TextBox->Name = L"新密码TextBox";
this->新密码TextBox->PasswordChar = '*';
this->新密码TextBox->Size = System::Drawing::Size(185, 21);
this->新密码TextBox->TabIndex = 53;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(50, 49);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(53, 12);
this->label2->TabIndex = 52;
this->label2->Text = L"新密码:";
//
// 旧密码TextBox
//
this->旧密码TextBox->Location = System::Drawing::Point(109, 17);
this->旧密码TextBox->Name = L"旧密码TextBox";
this->旧密码TextBox->PasswordChar = '*';
this->旧密码TextBox->Size = System::Drawing::Size(185, 21);
this->旧密码TextBox->TabIndex = 51;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(50, 22);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(53, 12);
this->label1->TabIndex = 50;
this->label1->Text = L"旧密码:";
//
// ChangeUserPasswordForm
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(342, 166);
this->ControlBox = false;
this->Controls->Add(this->用户名称TextBox);
this->Controls->Add(this->label4);
this->Controls->Add(this->返回系统Button);
this->Controls->Add(this->修改密码Button);
this->Controls->Add(this->再输一次新密码TextBox);
this->Controls->Add(this->label3);
this->Controls->Add(this->新密码TextBox);
this->Controls->Add(this->label2);
this->Controls->Add(this->旧密码TextBox);
this->Controls->Add(this->label1);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::Fixed3D;
this->Name = L"ChangeUserPasswordForm";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"修改用户密码";
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 修改密码Button_Click(System::Object^ sender, System::EventArgs^ e) {
if (!(this->新密码TextBox->Text == this->再输一次新密码TextBox->Text) || (this->新密码TextBox->Text->Length==0))
{
MessageBox::Show("两次密码的输入不一致!", "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
return;
}
String^ MySQLConnectionString = this->MyCRMConnectionString;
String^ MySQL = "Update 操作用户 Set 用户密码='" + this->新密码TextBox->Text + "' Where 用户名称='"+this->用户名称TextBox->Text+"' AND 用户密码='"+this->旧密码TextBox->Text +"'";
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
SqlCommand^ MyCommand = gcnew SqlCommand(MySQL, MyConnection);
MyCommand->Connection->Open();
int MyCount = MyCommand->ExecuteNonQuery();
if (MyCount == 1)
{
MessageBox::Show("在数据库中修改用户密码操作成功!", "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
else
{
MessageBox::Show("在数据库中修改用户密码操作失败!", "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
}
if (MyConnection->State == ConnectionState::Open)
{
MyConnection->Close();
}
}
private: System::Void 返回系统Button_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -