Exemple #1
0
        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Hide();
            FrmUsrMaintenance frmUsrMaintenance = new FrmUsrMaintenance();

            frmUsrMaintenance.ShowDialog();
            //FrmUsrMaintenance frmUsrMaintenance = new FrmUsrMaintenance();
            //frmUsrMaintenance.SetDataSource();
        }
        private void treeViewMenu_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            string nodeName = e.Node.Name;
            string strMsg   = "You do not have permission to access!";

            switch (nodeName)
            {
            case "101":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "402"))
                {
                    FrmSysConfig frmSysConfig = new FrmSysConfig(userInfo);
                    frmSysConfig.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "102":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "403"))
                {
                    FrmUsrMaintenance frmUsrMaintenance = new FrmUsrMaintenance(userInfo);
                    frmUsrMaintenance.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "103":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "403"))
                {
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "104":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "404"))
                {
                    FrmCompactDB frmCompactDb = new FrmCompactDB(userInfo);
                    frmCompactDb.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "105":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "409"))
                {
                    FrmComputerEntry frmComputerEntry = new FrmComputerEntry(userInfo);
                    frmComputerEntry.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "106":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "410"))
                {
                    FrmShiftCodeEntry frmShiftCode = new FrmShiftCodeEntry(userInfo);
                    frmShiftCode.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "201":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAConfig frmTaConfig = new FrmTAConfig(userInfo);
                    frmTaConfig.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "202":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAMenuCategory frmTaMenuCategory = new FrmTAMenuCategory(userInfo);
                    frmTaMenuCategory.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "203":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAMenuItem frmTaMenuItem = new FrmTAMenuItem(userInfo);
                    frmTaMenuItem.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "204":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAManageMenuSet frmTaManageMenuSet = new FrmTAManageMenuSet(userInfo);
                    frmTaManageMenuSet.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "205":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAExtraMenuEdit frmTaExtraMenuEdit = new FrmTAExtraMenuEdit(userInfo);
                    frmTaExtraMenuEdit.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "206":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "207":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTADeptCode frmTaDeptCode = new FrmTADeptCode(userInfo);
                    frmTaDeptCode.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "208":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTATblSetup frmTaTblSetup = new FrmTATblSetup(userInfo);
                    frmTaTblSetup.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "209":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAPrtSetup frmTaPrt = new FrmTAPrtSetup(userInfo);
                    frmTaPrt.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "210":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTADriverSetup frmTaDriverSetup = new FrmTADriverSetup(userInfo);
                    frmTaDriverSetup.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "211":
                if (CommonFunction.GetUsrPermission(userInfo.UsrCode, "101"))
                {
                    FrmTAPostcodeAssign frmTaPostcode = new FrmTAPostcodeAssign(userInfo);
                    frmTaPostcode.ShowDialog();
                }
                else
                {
                    MessageBox.Show(strMsg);
                }
                break;

            case "5":
                FrmSysCtl frmSysCtl = new FrmSysCtl();
                frmSysCtl.ShowDialog();
                break;
            }
        }