Esempio n. 1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            var sqlstr = "UpdatePwd";
            var con    = new SqlConnection(MaLogin.WmsCon);
            var cmd    = new SqlCommand(sqlstr, con)
            {
                CommandType = CommandType.StoredProcedure
            };

            cmd.Parameters.AddWithValue("@uName", utxtUser.Text);
            cmd.Parameters.AddWithValue("@uPassword", WmsFunction.GetMd5Hash(utxtPassword.Text));
            cmd.Parameters.AddWithValue("@uPwd", WmsFunction.GetMd5Hash(utxtPwd.Text));
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"发生异常" + ex.Message, @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (cmd.ExecuteNonQuery() < 1)
            {
                MessageBox.Show(@"修改失败", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show(@"修改成功", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
        }
Esempio n. 2
0
        private void uGridUser_ClickCellButton(object sender, CellEventArgs e)
        {
            var sqlstr = "update BUser set uPassword=@uPwd where uCode=@uName";
            var con    = new SqlConnection(MaLogin.WmsCon);
            var cmd    = new SqlCommand(sqlstr, con);

            cmd.Parameters.AddWithValue("@uName", e.Cell.Value);
            cmd.Parameters.AddWithValue("@uPwd", WmsFunction.GetMd5Hash("123456"));
            try
            {
                con.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"发生异常" + ex.Message, @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (cmd.ExecuteNonQuery() < 1)
            {
                MessageBox.Show(@"重置失败", @"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                MessageBox.Show(@"重置成功", @"Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                DialogResult = DialogResult.OK;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 验证登录
        /// </summary>
        private void OkLogin()
        {
            try
            {
                var ws = new WmsService.BaseConService {
                    Url = "http://" + utxtServer.Text + "/BaseConService.asmx"
                };
                WmsCon        = ws.GetWmsConstring();
                WmsServiceUri = ws.Url;
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"服务器填写错误,或者服务器端未配置正确!
" + ex.Message, @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }


            lblLogin.Image = Properties.Resources.LoginForm_login_btn_click;

            if (string.IsNullOrEmpty(utxtUser.Text.Trim()) || string.IsNullOrEmpty(utxtPassword.Text))
            {
                MessageBox.Show(@"用户名和密码必填!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //记住账套信息
            if (utxtAccount.Value == null || WmsCon == null)
            {
                MessageBox.Show(@"服务器选择有误!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var strpwd = WmsFunction.GetMd5Hash(utxtPassword.Text);
            var cmd    = new SqlCommand("select * from BUser where uCode='admin' and uPassword=@uPassword");

            cmd.Parameters.AddWithValue("@uPassword", strpwd);
            var wf = new WmsFunction(WmsCon);

            if (!wf.BoolExistTable(cmd))
            {
                MessageBox.Show(@"admin密码不正确!", @"注意", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            Hide();
            var mm = new MaMain();

            mm.ShowDialog();

            LoginDate = udDate.DateTime.Date;
            WmsServer = utxtServer.Text;
            Properties.Settings.Default.cServer = utxtServer.Text;
            Properties.Settings.Default.Save();
        }