private void BtnUserAccounts_Click(object sender, EventArgs e) { if (!InputControls.UserCanAccess(this, "SysAdmin")) { return; } OpenForm(new frmAccounts(), "User Account Management"); }
private void btnBiometricUser_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; if (!InputControls.UserCanAccess(this, "ViewBiometricUser")) { return; } OpenForm(new frmBiometricUser(), "Biometric User Management"); }
private void btnRolePrivileges_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; try { if (!InputControls.UserCanAccess(this, "SysAdmin")) { return; } using (var frm = new frmRolePrivileges()) { frm.ShowDialog(); } } catch (Exception ex) { MessageDialog.ShowError(ex, this); } }
public frmMain() { InitializeComponent(); styleManager1.ManagerStyle = eStyle.Metro; styleManager1.MetroColorParameters = MetroColorGeneratorParameters.Default; MainRibbonControl.MdiSystemItemVisible = false; MainRibbonControl.FadeEffect = true; Text = @"Megabyte College Information System"; lblServer.Text = @"Connected to: " + Connection.MyDbCredential.DatabasePath(); lblVersion.Text = @"Version : " + App.CurrentVersion(); mdiTab.Tabs.Clear(); #region Event handler btnBatch.Click += (s, ev) => OpenForm(new SchoolYear.frmBatch(), "Batch Management"); btnCourse.Click += (s, ev) => OpenForm(new SchoolYear.frmCourse(), "Course Management"); btnPayMasterList.Click += (s, ev) => OpenForm(new frmMasterFile(), "Payroll Master List"); btnPayPositions.Click += (s, ev) => OpenForm(new frmPosition(), "Payroll Positions"); btnPayDeductions.Click += (s, ev) => OpenForm(new frmDeduction(), "Payroll Deductions"); //btnPayTax.Click += (s, ev) => OpenForm(new Payroll.frmTaxTable(), "Payroll Tax Table"); btnPaySalarySchedule.Click += (s, ev) => OpenForm(new frmSalarySchedule(), "Payroll Salary Schedule"); btnSms.Click += (s, e) => { using (var f = new frmSMS()) { f.ShowDialog(); } }; //Accounts btnUserAccounts.Click += BtnUserAccounts_Click; btnChangePassword.Click += (s, e) => { Cursor.Current = Cursors.WaitCursor; if (!InputControls.UserCanAccess(this, "ChangePassword")) { return; } using (var f = new frmChangePassword()) { f.ShowDialog(); } }; #endregion btnContextMdiTabs.PopupOpen += (s, e) => CreateContextTabMenu(); // SETTINGS TAB ItemPanelSecurity.Visible = App.CurrentUser.User.RoleClass.Can("SysAdmin"); // Handle User ROLE var canViewPayroll = App.CurrentUser.User.RoleClass.Can("ViewPayrollMenu"); RibbonPayroll.Enabled = canViewPayroll; RibbonPayroll.Visible = canViewPayroll; // Handle Contacts var canViewContacts = App.CurrentUser.User.RoleClass.Can("ViewContactsMenu"); RibbonContacts.Visible = canViewContacts; btnContacts.Enabled = canViewContacts; var canAddContacts = App.CurrentUser.User.RoleClass.Can("AddContacts"); btnCreateContacts.Enabled = canAddContacts; // Handle Employee var canViewEmployee = App.CurrentUser.User.RoleClass.Can("ViewEmployee"); RibbonEmployee.Visible = canViewEmployee; btnEmployee.Enabled = canViewEmployee; //Biometric User var canViewBiometricUser = App.CurrentUser.User.RoleClass.Can("ViewBiometricUser"); RibbonBarBiometric.Visible = canViewBiometricUser; RibbonBarBiometric.Enabled = canViewBiometricUser; // CAN SEND SMS var canSendSms = App.CurrentUser.User.RoleClass.Can("AccessSendSms"); RibbonBarDevices.Visible = canSendSms; RibbonBarDevices.Enabled = canSendSms; //RibbonBar STUDENT var canViewStudentMenu = App.CurrentUser.User.RoleClass.Can("ViewStudentMenu"); RibbonBarStudent.Visible = canViewStudentMenu; RibbonBarStudent.Enabled = canViewStudentMenu; }