Exemple #1
0
        /// <summary>
        /// 登录方法
        /// </summary>
        /// <returns></returns>
        private bool doLogin()
        {
            string LoginName = this.txtLoginName.Text.Trim();
            string LoginPwd  = this.txtLoginPwd.Text.Trim();

            try
            {
                DataTable dataTable = Global._AppRight.GetUserInfo(LoginName, LoginPwd);
                if (dataTable == null || dataTable.Rows.Count < 1)
                {
                    DxPublic.ShowMessage("用户或密码错误!", this.Text);
                    return(false);
                }

                Global._Session._IsRberPwd = CheckRemPwd.Checked;
                Global._Session._LoginPwd  = LoginPwd;
                Global._Session._LoginName = LoginName;

                DataRow dataRow = dataTable.Rows[0];
                Global._Session._UserId         = DxPublic.GetObjGUID(dataRow["Id"]);
                Global._Session._FullName       = DxPublic.GetObjString(dataRow["FullName"]);
                Global._Session._DepartmentId   = DxPublic.GetObjGUID(dataRow["DepartmentId"]);
                Global._Session._DepartmentName = DxPublic.GetObjString(dataRow["DepartmentName"]);

                return(true);
            }
            catch (Exception ex)
            {
                DxPublic.ShowMessage($"用户登录出错:{ex.Message}", this.Text);
                return(false);
            }
        }
        /// <summary>
        /// 修改密码确定事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void sbtnSave_Click(object sender, EventArgs e)
        {
            Guid   userid = Global._Session._UserId;
            string oldpwd = txtOldPwd.Text.Trim();
            string newpwd = txtNewPwd1.Text.Trim();

            if (oldpwd == "")
            {
                DxPublic.ShowMessage("原密码不能为空", Text);
                txtOldPwd.Focus();
            }
            else
            {
                if (oldpwd == newpwd)
                {
                    DxPublic.ShowMessage("两次输入的密码不一致,请重新输入!", Text);
                    txtNewPwd1.Focus();
                }
                else
                {
                    if (_appRight.ModifyUserPwd(userid, oldpwd, newpwd))
                    {
                        DxPublic.ShowMessage("密码修改成功!", Text);
                        //  clsPublic.appLogs.LogOpInfo("修改密码",DateTime.Now);
                        this.Close();
                    }
                    else
                    {
                        DxPublic.ShowMessage("原密码错识修改失败!", Text);
                        txtOldPwd.Focus();
                    }
                }
            }
        }
 /// <summary>
 /// 保存数据库连接设置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubmit_Click(object sender, System.EventArgs e)
 {
     if (this.Save())
     {
         DxPublic.ShowMessage("保存成功!");
         Application.ExitThread();
         Application.Exit();
     }
     else
     {
         DxPublic.ShowMessage("保存失败!");
     }
 }
 /// <summary>
 /// 数据库连接测试
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnConnTest_Click(object sender, System.EventArgs e)
 {
     if (this.Save())
     {
         if (Global._SqlDb.IsConnectionTest(SQLSetting.GetConnString()))
         {
             DxPublic.ShowMessage("数据库连接成功!");
             Application.ExitThread();
             Application.Exit();
         }
         else
         {
             DxPublic.ShowMessage("数据库连接失败!");
         }
     }
     else
     {
         DxPublic.ShowMessage("数据库连接失败!");
     }
 }
 /// <summary>
 /// 保存数据设置
 /// </summary>
 /// <returns></returns>
 public bool Save()
 {
     try
     {
         if (txtSQLServer.Text.Trim() == "" && txtSQLUser.Text.Trim() == "" && txtSQLPwd.Text.Trim() == "" && txtSQLDbName.Text.Trim() == "")
         {
             DxPublic.ShowMessage("输入信息不能为空");
             return(false);
         }
         SQLSetting.DBServer  = this.txtSQLServer.Text.Trim();
         SQLSetting.DBName    = this.txtSQLDbName.Text.Trim();
         SQLSetting.DBUser    = this.txtSQLUser.Text.Trim();
         SQLSetting.DBUserPwd = this.txtSQLPwd.Text.Trim();
         SQLSetting.DBPort    = this.txtSQLPort.Text.Trim();
         AppSetingHelper.SetConnectionString("SqlConnStringMain", SQLSetting.GetConnString());
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #6
0
        /// <summary>
        /// 主窗体加载事件
        /// </summary>
        private void MainForm_Load(object sender, EventArgs e)
        {
            InitialUserSkin(); //初始化主题

            CloseAllWin();     //关闭所有子窗体

            Menu_Null();       //初始化受权

            if (!Global._SqlDb.IsConnectionTest())
            {
                DxPublic.ShowMessage("数据库连接失败,请重新配置", Text);
                this.btnDBConnSetup_ItemClick(null, null);
            }
            else
            {
                if (this.LoginForm != null)
                {
                    this.LoginForm = null;
                }
                try
                {
                    Thread ThLogin = new Thread(doLogin);
                    ThLogin.Start();
                }
                catch (System.Exception ex)
                {
                    DxPublic.ShowException(ex, this.Text);
                }
                finally
                {
                    if (this.LoginForm != null)
                    {
                        this.LoginForm.Dispose();
                        this.LoginForm = null;
                    }
                }
            }
        }
Exemple #7
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppStartupHelper.BindExceptionHandler();//异常处理
            //程序是否需要更新
            if (AppStartupHelper.IsNeedUpdate())
            {
                AppStartupHelper.StartUpdate();
            }
            else
            {
                BonusSkins.Register();//系统主题
                SkinManager.EnableFormSkins();

                //检查程序是否已经运行
                if (AppStartupHelper.IsRuning())
                {
                    DxPublic.ShowMessage("程序正在运行!");
                    return;
                }
                Application.Run(new MainForm());
            }
        }
Exemple #8
0
 /// <summary>
 /// 没有操作权限
 /// </summary>
 /// <param name="guidFuncId">功能Id</param>
 public void ShowNoRight(string FuncId)
 {
     DxPublic.ShowMessage("权限不足");
 }