UC_SetUserPassword.cs 2.1 KB
using OnlineStore;
using OnlineStore.Common;
using OnlineStore.LoadCSVLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TheMachine
{
    using crc = OnlineStore.CodeResourceControl;
    public partial class UC_SetUserPassword : UserControl
    {
        public UC_SetUserPassword()
        {
            InitializeComponent();
            crc.GetLanguageEvent += Crc_GetLanguageEvent;
            OnlineStore.CodeResourceControl.LanguageProcess(this);
            crc.LanguageChangeEvent += Crc_LanguageChangeEvent;
        }

        private string Crc_GetLanguageEvent()
        {
            return Setting_Init.App_Default_Language;
        }

        private void Crc_LanguageChangeEvent(object sender, EventArgs e)
        {
            if (!this.Created)
                return;
            OnlineStore.CodeResourceControl.LanguageProcess(this);
            this.Invoke((EventHandler)delegate
            {

            });




        }
        private void button_ok_Click(object sender, EventArgs e)
        {
            if (textBox_oldpwd.Text != Setting_Init.User_AdminPassword)
            {
                MessageBox.Show(crc.GetString("Res0068","旧密码不正确!"));
                textBox_oldpwd.Text = "";
                return;
            }

            if (textBox_newpwd.Text != textBox_newpwd2.Text) {
                MessageBox.Show(crc.GetString("Res0069","两次输入的新密码不一致,请确认!"));
                //textBox_oldpwd.Text = "";
                return;
            }

            if (string.IsNullOrWhiteSpace(textBox_newpwd.Text))
            {
                MessageBox.Show(crc.GetString("Res0070","新密码不能为空!"));
                return;
            }

            Setting_Init.User_AdminPassword = textBox_newpwd.Text.Trim();
            textBox_oldpwd.Text = "";
            textBox_newpwd.Text = "";
            textBox_newpwd2.Text = "";
            MessageBox.Show(crc.GetString("Res0071","密码修改成功!"));
        }
    }
}