public ActionResult CareerReport(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         SimpleAES            aes   = new SimpleAES();
         string               email = aes.DecryptFromBase64String(id);
         LockedModeUserClient lmu   = new LockedModeUserClient();
         LockedModeUser       user  = lmu.GetByPartitionAndRowKey(LockedModeUserClient.GetPartitionKeyForEmail(email), email);
         if (user != null)
         {
             Response.Cookies["attitude"].Value         = user.Attitude;
             Response.Cookies["attitude"].Expires       = DateTime.UtcNow.AddDays(7);
             Response.Cookies["endurance"].Value        = user.Endurance;
             Response.Cookies["endurance"].Expires      = DateTime.UtcNow.AddDays(7);
             Response.Cookies["action"].Value           = user.Action;
             Response.Cookies["action"].Expires         = DateTime.UtcNow.AddDays(7);
             Response.Cookies["concentration"].Value    = user.Concentration;
             Response.Cookies["concentration"].Expires  = DateTime.UtcNow.AddDays(7);
             Response.Cookies["information"].Value      = user.Information;
             Response.Cookies["information"].Expires    = DateTime.UtcNow.AddDays(7);
             Response.Cookies["processing"].Value       = user.Processing;
             Response.Cookies["processing"].Expires     = DateTime.UtcNow.AddDays(7);
             Response.Cookies["presence"].Value         = user.Presence;
             Response.Cookies["presence"].Expires       = DateTime.UtcNow.AddDays(7);
             Response.Cookies["patterns"].Value         = user.Patterns;
             Response.Cookies["patterns"].Expires       = DateTime.UtcNow.AddDays(7);
             Response.Cookies["compensation"].Value     = user.Compensation;
             Response.Cookies["compensation"].Expires   = DateTime.UtcNow.AddDays(7);
             Response.Cookies["resultsEmailed"].Value   = "yes";
             Response.Cookies["resultsEmailed"].Expires = DateTime.UtcNow.AddDays(7);
             return(View());
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
 public ActionResult InterestReport(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         SimpleAES            aes       = new SimpleAES();
         string               email     = aes.DecryptFromBase64String(id);
         LockedModeUserClient lmu       = new LockedModeUserClient();
         LockedModeUser       user      = lmu.GetByPartitionAndRowKey(LockedModeUserClient.GetPartitionKeyForEmail(email), email);
         List <string>        interests = new List <string>();
         if (user != null)
         {
             Type userType = user.GetType();
             foreach (var key in userType.GetProperties())
             {
                 if (key.CanRead)
                 {
                     object value = key.GetValue(user, null);
                     if (value.ToString() == "1")
                     {
                         interests.Add(key.Name);
                     }
                 }
             }
             ViewBag.Interests = interests;
             return(View());
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
Ejemplo n.º 3
0
        //report with roles
        public ActionResult CareerReport(string id)
        {
            if (Request.Cookies["locked"] != null)
            {
                Response.Cookies["locked"].Expires = DateTime.Now.AddDays(-1);
            }
            if (!string.IsNullOrEmpty(id))
            {
                SimpleAES            aes   = new SimpleAES();
                string               email = aes.DecryptFromBase64String(id);
                LockedModeUserClient lmu   = new LockedModeUserClient();
                LockedModeUser       user  = lmu.GetByPartitionAndRowKey(LockedModeUserClient.GetPartitionKeyForEmail(email), email);
                if (user != null)
                {
                    Response.Cookies["attitude"].Value         = user.Attitude;
                    Response.Cookies["attitude"].Expires       = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["endurance"].Value        = user.Endurance;
                    Response.Cookies["endurance"].Expires      = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["action"].Value           = user.Action;
                    Response.Cookies["action"].Expires         = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["concentration"].Value    = user.Concentration;
                    Response.Cookies["concentration"].Expires  = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["information"].Value      = user.Information;
                    Response.Cookies["information"].Expires    = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["processing"].Value       = user.Processing;
                    Response.Cookies["processing"].Expires     = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["presence"].Value         = user.Presence;
                    Response.Cookies["presence"].Expires       = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["patterns"].Value         = user.Patterns;
                    Response.Cookies["patterns"].Expires       = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["compensation"].Value     = user.Compensation;
                    Response.Cookies["compensation"].Expires   = DateTime.UtcNow.AddDays(7);
                    Response.Cookies["resultsEmailed"].Value   = "yes";
                    Response.Cookies["resultsEmailed"].Expires = DateTime.UtcNow.AddDays(7);

                    if (!string.IsNullOrEmpty(user.Color))
                    {
                        Response.Cookies["color"].Value   = user.Color;
                        Response.Cookies["color"].Expires = DateTime.UtcNow.AddDays(7);
                    }
                    if (!string.IsNullOrEmpty(user.Shape))
                    {
                        Response.Cookies["shape"].Value   = user.Shape;
                        Response.Cookies["shape"].Expires = DateTime.UtcNow.AddDays(7);
                    }
                    if (!string.IsNullOrEmpty(user.Sport))
                    {
                        Response.Cookies["sport"].Value   = user.Sport;
                        Response.Cookies["sport"].Expires = DateTime.UtcNow.AddDays(7);
                    }
                    if (!string.IsNullOrEmpty(user.School))
                    {
                        Response.Cookies["school"].Value   = user.School;
                        Response.Cookies["school"].Expires = DateTime.UtcNow.AddDays(7);
                    }
                    if (!string.IsNullOrEmpty(user.EduLevel))
                    {
                        Response.Cookies["educationSelected"].Value   = user.EduLevel;
                        Response.Cookies["educationSelected"].Expires = DateTime.UtcNow.AddDays(7);
                    }
                    string str = getInterestsJson(user);
                    ViewBag.Interests = str;
                    if (str != "[]")
                    {
                        Response.Cookies["question10"].Value   = "1";
                        Response.Cookies["question10"].Expires = DateTime.UtcNow.AddDays(7);
                    }
                }
            }
            return(View());
        }