Exemplo n.º 1
0
Arquivo: FrmMain.cs Projeto: L-ZhiD/C-
        private void FrmMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            ISuperMarketSaleManager saleManager = new SaleManager();

            Log4net.WriteInfo($"[{Program.CurrentAdmin.LoginId}]退出程序!");
            saleManager.WriteSalesExitLog(Program.CurrentAdmin.LoginLogId);
        }
Exemplo n.º 2
0
Arquivo: FrmMain.cs Projeto: L-ZhiD/C-
        private void toolMenuUpdatePwd_Click(object sender, EventArgs e)
        {
            FrmUpdatePwd pwd     = new FrmUpdatePwd();
            DialogResult Restart = pwd.ShowDialog();

            //密码修改成功,意味着需要重新登录
            if (Restart == DialogResult.OK)
            {
                Log4net.WriteInfo($"[{Program.CurrentAdmin.LoginId}]成功修改密码");

                this.Close();//主线程关闭
                //修改密码之后重启
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 登录事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtLoginId.CheckData(@"^\\d+$", "账号输入有误!") * txtLoginPwd.CheckNullOrEmpty() != 0)
            {
                SysAdmins sys = new SysAdmins()
                {
                    LoginId  = Convert.ToInt32(txtLoginId.Text.Trim()),
                    LoginPwd = txtLoginPwd.Text.Trim()
                };

                try
                {
                    sys = adminManager.AdminLogin(sys);
                    Log4net.WriteInfo($"账号[{sys.LoginId}]开始登录");
                    if (sys != null)
                    {
                        if (sys.AdminStatus == 1)
                        {
                            Log4net.WriteInfo($"[{sys.LoginId}]登录成功!");
                            Program.CurrentAdmin = sys;
                            this.DialogResult    = DialogResult.OK;
                            this.Close();
                        }
                        else
                        {
                            Log4net.WriteInfo($"[{sys.LoginId}]账号被禁用");
                            MessageBox.Show("当前管理员账号已被禁用!", "登录提示");
                        }
                    }
                    else
                    {
                        Log4net.WriteInfo($"[{sys.LoginId}]账号或密码错误登录失败");
                    }
                }
                catch (Exception ex)
                {
                    Log4net.WriteError($"[{sys.LoginId}]登录发生异常", ex);
                    return;
                }
            }
        }