Ejemplo n.º 1
0
        private static bool Login(string UserName, string Password)
        {
            try
            {
                SystemUsersBO aSystemUsersBO = new SystemUsersBO();

                SystemUsers aSystemUsers = aSystemUsersBO.CheckAccount(UserName, Password);

                if (aSystemUsers != null)
                {
                    if (aSystemUsers.Disable == true)
                    {
                        throw new Exception("Bạn đang bị tạm khóa toàn hệ thống với lý do:[Chưa rõ]");
                    }
                    else
                    {

                        PermitsBO aPermitsBO = new PermitsBO();
                        CORE.CURRENTUSER.ListPermitViewAll = aPermitsBO.GetAllInfoLogin_ByUsername(aSystemUsers.Username)
                            .Where(p => p.Permits_SystemUsers_Disable == false)
                            .Where(p => p.Permits_Disable == false)
                            .Where(p => p.PermitDetails_Disable == false)
                            .Where(p => p.Permits_SystemKey == CORE.SYSTEM.SystemKey).ToList();

                        if (CORE.CURRENTUSER.ListPermitViewAll.Count == 0)
                        {
                            throw new Exception("Bạn không đủ quyền vào phần mềm này");
                        }
                        else
                        {
                            CORE.CURRENTUSER.SystemUser = aSystemUsers;
                            return true;
                        }

                    }

                }
                else
                {
                    throw new Exception("Sai username hoặc password");
                }
            }
            catch (Exception eee)
            {
                throw eee;
            }
        }