Newer
Older
GHFX_REFACTOR / Frm_password_reset.cs
wxn on 2 Nov 2016 2 KB 提交
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevComponents.DotNetBar;
using System.Data.OracleClient;

namespace Cyberpipe
{
    public partial class Frm_password_reset : Office2007Form
    {
        public static bool IS_OPEN = false;

        public Frm_password_reset()
        {
            InitializeComponent();
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(combo_user.Text.Trim()))
                {
                    MessageBox.Show("请选择账号!");
                    return;
                }
                else
                {
                    if (MessageBox.Show("确定重置?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        string sql = "update casic_userinfotest set password='" + Utility.MD5Encrypt2("111111") + "' where username='" + combo_user.Text.Trim() + "' and sysname='GHFX'";
                        OracleUtils.ExecuteNonQuery(OracleUtils.ConnectionString, CommandType.Text, sql);
                        MessageBox.Show("重置成功!密码已重置为111111", "结果", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void initCombox()
        {
            string sql = "select username from casic_userinfotest where sysname='GHFX'";
            using (OracleDataReader reader = OracleUtils.ExecuteReader(OracleUtils.ConnectionString, CommandType.Text, sql))
            {
                while (reader.Read())
                {
                    combo_user.Items.Add(reader[0]);
                }
            }
        }

        private void Frm_password_reset_Load(object sender, EventArgs e)
        {
            IS_OPEN = true;
            initCombox();
        }

        private void Frm_password_reset_FormClosing(object sender, FormClosingEventArgs e)
        {
            IS_OPEN = false;
        }
    }
}