예제 #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);
            }
        }
예제 #2
0
 public void MdiShow2(BaseForm frm)
 {
     try
     {
         System.Windows.Forms.Form[] mdiChildren = base.MdiChildren;
         for (int i = 0; i < mdiChildren.Length; i++)
         {
             System.Windows.Forms.Form form = mdiChildren[i];
             if (form.GetType().Equals(frm.GetType()))
             {
                 form.Activate();
                 form.Show();
                 frm.Dispose();
                 return;
             }
         }
         frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
         frm.MdiParent     = this;
         frm.KeyPreview    = true;
         frm.Mainform      = this;
         frm.InitFeatureButton();
         frm.Show();
     }
     catch (System.Exception ex)
     {
         DxPublic.ShowException(ex, this.Text);
     }
 }
예제 #3
0
        /// <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();
                    }
                }
            }
        }
예제 #4
0
 private void btnAppExit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (!DxPublic.GetMessageBoxYesNoResult("是否退出登录?", this.Text))
     {
         return;
     }
     Application.ExitThread();
     Application.Exit();
 }
예제 #5
0
 /// <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("保存失败!");
     }
 }
예제 #6
0
 private void InitialUserSkin()
 {
     try
     {
         SkinHelper.InitSkinGallery(skinRibbon);
         var SkinName = AppSetingHelper.GetDefaultTheme();
         DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(SkinName);//skinName为皮肤名
         skinRibbon.Caption = "主题:" + SkinName;
     }
     catch (Exception ex) {
         DxPublic.ShowException(ex);
         throw ex;
     }
 }
예제 #7
0
 //数据库初始化
 public void Inital()
 {
     try {
         string Sqlconn = AppSetingHelper.GetConnectionString("SqlConnStringMain");
         SQLSetting = new DbSettingInfo(Sqlconn);
         SQLSetting.DBconnStrType = ConnStrType.SQL;
         this.txtSQLServer.Text   = SQLSetting.DBServer;
         this.txtSQLDbName.Text   = SQLSetting.DBName;
         this.txtSQLUser.Text     = SQLSetting.DBUser;
         this.txtSQLPwd.Text      = SQLSetting.DBUserPwd;
         // this.txtSQLPort.Text   = SQLSetting.DBPort;
     }
     catch (Exception ex)
     {
         DxPublic.ShowException(ex, Text);
     }
 }
예제 #8
0
 private void btnLogout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (!this.LoginedIn)
     {
         this.MainForm_Load(null, null);
         return;
     }
     if (!DxPublic.GetMessageBoxYesNoResult("是否注销系统?", this.Text))
     {
         return;
     }
     this.CloseAllWin();
     Global._Session.SessionIntial();
     this.Menu_Null();
     this.MainForm_Load(null, null);
     this.LoginedIn = false;
 }
예제 #9
0
 /// <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("数据库连接失败!");
     }
 }
예제 #10
0
 public void MdiShow(BaseForm frm, object FuncId, bool ReStart = false)
 {
     try
     {
         System.Windows.Forms.Form[] mdiChildren = base.MdiChildren;
         for (int i = 0; i < mdiChildren.Length; i++)
         {
             System.Windows.Forms.Form form = mdiChildren[i];
             if (!ReStart)
             {
                 if (form.GetType().Equals(frm.GetType()))
                 {
                     form.Activate();
                     form.Show();
                     frm.Dispose();
                     return;
                 }
             }
             else if (form.GetType().Equals(frm.GetType()))
             {
                 form.Close();
                 form.Dispose();
             }
         }
         string objectString = DxPublic.GetObjString(FuncId);
         if (!string.IsNullOrEmpty(objectString))
         {
             frm.FuncId = Guid.Parse(objectString);
         }
         frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
         frm.MdiParent     = this;
         frm.KeyPreview    = true;
         frm.Mainform      = this;
         frm.InitFeatureButton();
         frm.Show();
     }
     catch (System.Exception ex)
     {
         DxPublic.ShowException(ex, this.Text);
     }
 }
예제 #11
0
 /// <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);
     }
 }
예제 #12
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;
                    }
                }
            }
        }
예제 #13
0
 /// <summary>
 /// 菜单的初始化
 /// </summary>
 private void Menu_Init()
 {
     base.Invoke(new EventHandler(delegate
     {
         if (Global._Session._UserId != null && Global._Session._UserId != Guid.Empty)
         {
             this.StatusLoginName.Caption = "用户:" + Global._Session._LoginName;
             this.statusLogintime.Caption = DateTime.Now.ToString("yyyy年MM月dd HH:mm:ss dddd");
             this.statusIP.Caption        = "  登录IP:" + Global._Session._IPAddress;
             this.statusMac.Caption       = "  登录MAC:" + Global._Session._MACAddress;
             this.statusFullName.Caption  = "  真实姓名:" + Global._Session._FullName;
             try
             {
                 this.Menu_Visible();
                 this.MenuInited = true;
             }
             catch (System.Exception ex)
             {
                 DxPublic.ShowException(ex, this.Text);
             }
         }
     }));
 }
예제 #14
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());
            }
        }
예제 #15
0
 /// <summary>
 /// 没有操作权限
 /// </summary>
 /// <param name="guidFuncId">功能Id</param>
 public void ShowNoRight(string FuncId)
 {
     DxPublic.ShowMessage("权限不足");
 }