示例#1
0
        public string llamarlog(UsuarioEN en)
        {
            LoginAD login = new LoginAD();
            string  d;

            d = login.idLogin(en);
            return(d);
        }
示例#2
0
        public SYS_Account IsValid(SYS_Account account)
        {
            try
            {
                using (var context = new SystemEntities())
                {
                    var isDomainAccount = this.IsDomainAccount(account.Username);

                    // nếu trong dữ liệu user bắt đầu bằng LADP
                    if (isDomainAccount)
                    {
                        var userName = account.Username;
                        var isValid  = new LoginAD().IsValid(userName, account.Password);
                        if (isValid)
                        {
                            return(this.Get(LADP + account.Username));
                        }
                        else
                        {
                            return(null);
                        }
                    }


                    var password   = Helper.MD5.CryptoPassword(account.Password);
                    var sysAccount = context.SYS_Account.
                                     FirstOrDefault(
                        f =>
                        f.Username.Equals(account.Username, StringComparison.OrdinalIgnoreCase) &&
                        f.Password.Equals(password));
                    return(sysAccount);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }