Example #1
0
        private void riUserOperate_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                var    index = gvUserManage.GetFocusedDataSourceRowIndex();//获取行的索引值,从0开始
                string uname = gvUserManage.GetRowCellValue(index, "uname").ToString();

                // MessageBox.Show(e.Button.Caption);//选中了哪一个按钮
                string btnName = e.Button.Caption.Trim();
                switch (btnName)
                {
                case "initialize":
                    wfChangeUser wcu = new wfChangeUser(uname);
                    wcu.Show();
                    break;

                case "edit":
                    wfModifyPassword wfp = new wfModifyPassword(uname);
                    wfp.Show();
                    break;

                case "delete":
                    wfDelte wfd = new wfDelte(uname);
                    wfd.Show();
                    break;

                default:
                    break;
                }
            }catch (Exception ex)
            {
                LogHelper.LogUtlis("usermanager_用户操作", ex);
            }


            //if (btnName== "initialize")
            //{
            //    wfChangeUser wcu = new wfChangeUser(uname);
            //    wcu.Show();
            //}
            //if (btnName == "")
            //{

            //}
            //if(btnName=="1"){
        }
Example #2
0
        private void bbi_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                BarButtonItem v = (BarButtonItem)e.Item;
                if (v == bbiLogin)
                {
                    wfLogin login = new wfLogin();

                    //第四步  初始化事件
                    login.setFormTextVaule += Login_setFormTextVaule;

                    if (login.ShowDialog() == DialogResult.OK)
                    {
                        Logout();
                        bbiUser.Caption = wfLogin.userName;
                        //Program.permissionManager.ActivePermission = wfLogin.permission;
                        UserName = bbiUser.Caption;


                        MessageBox.Show(UserName);
                        // Program.permissionManager.ApplyPermission(this);
                        //定时器初始化
                        timerLogout = new System.Windows.Forms.Timer();
                        this.timerLogout.Interval = 60 * 1000;
                        this.timerLogout.Tick    += new System.EventHandler(OverTimeLogout);
                        timerLogout.Enabled       = true;
                        Program.IdleStart         = new TimeSpan(DateTime.Now.Ticks);

                        if (bbiUser.Caption != Program.infoResource.GetLocalizedString(InfoId.Tourist))
                        {
                            bbiLogout2.Visibility = BarItemVisibility.Always;
                        }
                    }

                    return;
                }
                if (v == bbiModifyPassword)
                {
                    if (bbiUser.Caption == Program.infoResource.GetLocalizedString(InfoId.Tourist))
                    {
                        XtraMessageBox.Show(Program.infoResource.GetLocalizedString(language.InfoId.LoginFirst));
                        return;
                    }
                    if (bbiUser.Caption == SuperManager)
                    {
                        XtraMessageBox.Show(Program.infoResource.GetLocalizedString(language.InfoId.NoPowerChangePwd));
                        return;
                    }
                    else
                    {
                        wfModifyPassword from = new wfModifyPassword(bbiUser.Caption);
                        from.ShowDialog();
                    }
                }
                if (v == bbiLogout)
                {
                    bbiUser.Caption = "游客";


                    menuSystem.Visible  = false;
                    menuStation.Visible = false;
                    menuHelp.Visible    = false;
                    frmMain frm = new frmMain();
                    frm.bbiDeviceManager.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
                    frm.bbiDebugging.Visibility     = DevExpress.XtraBars.BarItemVisibility.Never;
                    frm.bbiDataCount.Visibility     = DevExpress.XtraBars.BarItemVisibility.Never;


                    Logout();
                    //bbiLogout.Visibility = BarItemVisibility.Never;
                }
                //if (v == bbiHelp)
                //{
                //    if (String.IsNullOrEmpty(_helpChmPath)||!File.Exists(_helpChmPath))
                //    {
                //        XtraMessageBox.Show(Program.infoResource.GetLocalizedString(language.InfoId.NoHelpChm));
                //        return;
                //    }
                //    Help.ShowHelpIndex(this, _helpChmPath);
                //}
                if (v.Tag != null)
                {
                    if (activeBarItem != null && activeBarItem.ImageOptions.DisabledLargeImage != null)
                    {
                        activeBarItem.ImageOptions.LargeImage = activeBarItem.ImageOptions.DisabledLargeImage;
                        activeBarItem.ImageOptions.Image      = activeBarItem.ImageOptions.LargeImage;
                    }

                    activeBarItem = v;
                    if (v.ImageOptions.DisabledImage != null)
                    {
                        v.ImageOptions.LargeImage = v.ImageOptions.DisabledImage;
                        v.ImageOptions.Image      = v.ImageOptions.LargeImage;
                    }

                    NavBarItemLink link = new NavBarItemLink(new NavBarItem(v.Name));
                    link.Item.Tag = v.Tag;
                    modulesNavigator.ChangeSelectedItem(link, null);
                }
            }
            catch (Exception ex)
            {
                //    ErrorLog.Error(ex.StackTrace.ToString());
            }
        }