Exemple #1
0
 private void AssignDataObjectToEntity(tbl_Users dbUser, ref User entUser)
 {
     entUser.IdUser = dbUser.IdUser;
     entUser.UserName = dbUser.UserName;
     entUser.EntRole = new RoleService().GetRoleByUserID(entUser.IdUser);
     entUser.UserCompleteName = String.Format("{0} {1}", dbUser.FirstName, dbUser.LastName);
     entUser.Company = new DataAccessLibrary.Services.CompanyService().GetByID(dbUser.IdCompany);
     entUser.IdApplication = dbUser.IdApplication;
     entUser.Application = dbUser.tbl_Applications.Name;
 }
Exemple #2
0
        public override bool ValidateUser(string UserName, string Password)
        {
            TCRepositoryDataContext context = DataBaseUtils.GetContext();
            tbl_Users dbUser = context.tbl_Users.Where(u => u.UserName == UserName && u.Password == Password).FirstOrDefault();
            User entUser = new User();
            if (dbUser!=null)
            {
                AssignDataObjectToEntity(dbUser, ref entUser);
            }
            else
            {
                //if ((UserName == "Administrador") && (Password == "SuperAdmin"))
                //{

                //}
                return false;
            }

            HttpContext.Current.Session["CurrentUser"] = entUser;
            return true;
        }