コード例 #1
0
ファイル: Menu.cs プロジェクト: ewin66/Management-System
        private static int ResponseDefaultMenu(RoleResourceMapping menuItem)
        {
            switch (menuItem.Resource.WinName)
            {
            case "*#$%Register":

                frmLogin _frmLogin = new frmLogin();
                _frmLogin.ShowDialog();

                return(0);

            case "*#$%ResetGroup":
                foreach (Form f in parentForm.MdiChildren)
                {
                    f.Close();
                }
                Neusoft.HISFC.Models.Base.Employee user = Neusoft.FrameWork.Management.Connection.Operator as Neusoft.HISFC.Models.Base.Employee;
                //{D55E413A-9947-4783-B031-9EA1F2E6104B}
                //LoginFunction.Login(user.User01, user.Password);
                if (LoginFunction.Login(user.User01, user.Password) < 0)
                {
                    return(-1);
                }
                if (HIS.Program.MainForm == null)
                {
                    HIS.Program.MainForm = new frmMain();
                }
                HIS.Program.MainForm.InitMenu(((Neusoft.HISFC.Models.Base.Employee)Neusoft.FrameWork.Management.Connection.Operator).CurrentGroup.ID);

                return(0);

            case "*#$%ChangePWD":

                frmChangePwd _frmChange = new frmChangePwd();
                _frmChange.ShowDialog();

                return(0);

            case "*#$%Help":
                try
                {
                    System.Diagnostics.Process.Start(Neusoft.FrameWork.WinForms.Classes.Function.CurrentPath + "help.chm");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                return(0);

            case "*#$%About":
                frmAbout frm = new frmAbout();
                frm.ShowDialog();

                return(0);

                #region {DD84CBE6-6C42-4b29-AB55-4775F7A759D0}
            case "*#$%Calc":
                try
                {
                    System.Diagnostics.Process.Start("calc.exe");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("加载系统计算器时发生异常");
                }
                return(0);

                #endregion
            case "*#$%Language":
                //frmLanguage language = new frmLanguage();
                //language.ShowDialog();
                return(0);

            case "*#$%SuperMan":
                //frmSelectUser frmSuperMan = new frmSelectUser();
                //frmSuperMan.MdiParent = mainForm;
                //frmSuperMan.Show();
                //frmSuperMan.WindowState = FormWindowState.Normal;
                //frmSuperMan.WindowState = FormWindowState.Maximized;
                return(0);

            case "*#$%Skin":
                //frmSkinManager frmSkin = new frmSkinManager();
                //frmSkin.ShowDialog();
                return(0);

            case "*#$%Exit":
                parentForm.Close();
                return(0);
            }

            return(2);//继续下面的
        }
コード例 #2
0
        private void neuButton1_Click(object sender, EventArgs e)
        {
            //确定
            if (this.txtUserID.Text.Trim() == "")
            {
                this.txtUserID.Focus();
                Program.isMessageShow = false;
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请输入用户名!"), Neusoft.FrameWork.Management.Language.Msg("提示"));
                Program.isMessageShow = true;
                return;
            }
            if (this.txtPWD.Text.Trim() == "")
            {
                this.txtUserID.Focus();
                Program.isMessageShow = false;
                MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("请输入密码!"), Neusoft.FrameWork.Management.Language.Msg("提示"));
                Program.isMessageShow = true;
                return;
            }

            string _account = this.txtUserID.Text.Trim();
            string _pass    = this.txtPWD.Text.Trim();

            if (LoginFunction.Login(_account, _pass) == -1)
            {
                this.txtPWD.Focus();
                return;
            }

            this.Hide();

            if (HIS.Program.MainForm == null)
            {
                HIS.Program.MainForm = new frmMain();
            }

            HIS.Program.MainForm.InitMenu(((Neusoft.HISFC.Models.Base.Employee)Neusoft.FrameWork.Management.Connection.Operator).CurrentGroup.ID);
            if (Program.IsTestDB)
            {
                HIS.Program.MainForm.Text = HIS.Program.MainForm.Text + " - 测试库";
            }
            HIS.Program.MainForm.Show();

            ////新增加的代码如下;用来判断用户的状态
            //int retv = 0;//
            ////if ((retv = Program.ShowMainForm(this.txtUserID.Text, this.txtPWD.Text, "", "")) == 0)
            ////{
            ////    this.txtPWD.Clear();
            ////    this.Hide();
            ////}
            //if ((retv =Login(_account,_pass) )== 0)
            //{
            //    this.txtPWD.Clear();
            //    this.Hide();
            //}
            //else
            //{
            //    if (retv == -1)
            //    {
            //        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("用户名或密码不正确,请重试!"), Neusoft.FrameWork.Management.Language.Msg("提示"));
            //        this.txtUserID.Focus();
            //        this.txtUserID.SelectAll();
            //    }
            //    else if (retv == -2)
            //    {
            //        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("用户名已经停用,请更换!"), Neusoft.FrameWork.Management.Language.Msg("提示"));
            //        this.txtUserID.Focus();
            //        this.txtUserID.SelectAll();
            //    }
            //    else
            //    {
            //        MessageBox.Show(Neusoft.FrameWork.Management.Language.Msg("用户名已经废弃,请更改!"), Neusoft.FrameWork.Management.Language.Msg("提示"));
            //        this.txtUserID.Focus();
            //        this.txtUserID.SelectAll();
            //    }
            //}
            //新增加的代码结束;
        }