Ejemplo n.º 1
0
        private static bool checkPrivilegeToAccessForm(string form)
        {
            AuthenService          authenService = new AuthenService();
            UserPrivilegeDataTable upTable       = null;

            if (authenService.IsAuthenticated())
            {
                AuthenticatedEntity authenData = (AuthenticatedEntity)StaticDataFacade.Get(StaticDataKeys.AuthenticatedData);
                upTable = authenData.UserPrivilegeTable;
            }

            if (!authenService.CanAccess(form, upTable))
            {
                if (!authenService.IsAuthenticated())
                {
                    ShowDialog(AppForms.FormLogin);
                }
                else
                {
                    MessageBox.Show("Bạn không thể truy cập vào phần này.", "Thiếu quyền truy cập",
                                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }

                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
 private static void saveCurrentForm(string form, FormShowType showType)
 {
     if (AppForms.FormLogin != form)
     {
         StaticDataFacade.Save(StaticDataKeys.CurrentForm, form);
         StaticDataFacade.Save(StaticDataKeys.CurrentFormShowType, showType);
     }
 }