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"));
 }
 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 JsonResult EmailMeMyResults(string name, string email, string attitude, string action, string information, string processing, string endurance, string patterns, string presence, string compensation, string concentration)
        {
            AddresseeClient      adc = new AddresseeClient();
            LockedModeUserClient lmu = new LockedModeUserClient();
            string    emailpartition = AddresseeClient.GetPartitionKeyForEmail(email);
            Addressee a = adc.GetByPartitionAndRowKey(emailpartition, email);

            if (a == null)
            {
                adc.AddNewItem(new Addressee(email.ToLower())
                {
                    Name = name, Email = email.ToLower()
                });
            }
            LockedModeUser user = lmu.GetByPartitionAndRowKey(emailpartition, email);

            if (user == null)
            {
                lmu.AddNewItem(new LockedModeUser
                {
                    PartitionKey = emailpartition,
                    RowKey       = email.ToLower(),
                    Name         = name,
                    Email        = email.ToLower(),
                    Referer      = "general",

                    Attitude      = attitude == null ? "" : attitude,
                    Action        = action == null ? "" : action,
                    Information   = information == null ? "" : information,
                    Processing    = processing == null ? "" : processing,
                    Endurance     = endurance == null ? "" : endurance,
                    Patterns      = patterns == null ? "" : patterns,
                    Presence      = presence == null ? "" : presence,
                    Compensation  = compensation == null ? "" : compensation,
                    Concentration = concentration == null ? "" : concentration
                });
            }
            else
            {
                user.Attitude      = attitude == null ? "" : attitude;
                user.Action        = action == null ? "" : action;
                user.Information   = information == null ? "" : information;
                user.Processing    = processing == null ? "" : processing;
                user.Endurance     = endurance == null ? "" : endurance;
                user.Patterns      = patterns == null ? "" : patterns;
                user.Presence      = presence == null ? "" : presence;
                user.Compensation  = compensation == null ? "" : compensation;
                user.Concentration = concentration == null ? "" : concentration;
                lmu.Update(user);
            }
            sendResultEmail(name, email);
            return(new JsonResult {
                Data = new { result = "ok" }
            });
        }
Ejemplo n.º 4
0
        public JsonResult EmailMeMyResults(string name, string email)
        {
            AddresseeClient      adc = new AddresseeClient();
            LockedModeUserClient lmu = new LockedModeUserClient();
            string    emailpartition = AddresseeClient.GetPartitionKeyForEmail(email);
            Addressee a = adc.GetByPartitionAndRowKey(emailpartition, email);

            if (a == null)
            {
                adc.AddNewItem(new Addressee(email.ToLower())
                {
                    Name = name, Email = email.ToLower()
                });
            }
            LockedModeUser user = lmu.GetByPartitionAndRowKey(emailpartition, email);

            if (user == null)
            {
                lmu.AddNewItem(new LockedModeUser
                {
                    PartitionKey = emailpartition,
                    RowKey       = email.ToLower(),
                    Name         = name,
                    Email        = email.ToLower(),
                    Referer      = "lm",

                    Attitude      = Request.Cookies["attitude"] != null ? Request.Cookies["attitude"].Value : "",
                    Action        = Request.Cookies["action"] != null ? Request.Cookies["action"].Value : "",
                    Information   = Request.Cookies["information"] != null ? Request.Cookies["information"].Value : "",
                    Processing    = Request.Cookies["processing"] != null ? Request.Cookies["processing"].Value : "",
                    Endurance     = Request.Cookies["endurance"] != null ? Request.Cookies["endurance"].Value : "",
                    Patterns      = Request.Cookies["patterns"] != null ? Request.Cookies["patterns"].Value : "",
                    Presence      = Request.Cookies["presence"] != null ? Request.Cookies["presence"].Value : "",
                    Compensation  = Request.Cookies["compensation"] != null ? Request.Cookies["compensation"].Value : "",
                    Concentration = Request.Cookies["concentration"] != null ? Request.Cookies["concentration"].Value : ""
                });
            }
            sendResultEmail(name, email);
            return(new JsonResult {
                Data = new { result = "ok" }
            });
        }
        public JsonResult EmailMeMyInterestResults(string name, string email, int admiration, int adventure, int animals, int beauty, int competition, int coordinating, int creativity, int critical, int drafting, int duty, int handlabor, int helping, int machinery, int numbers, int people, int politics, int safety, int salesy, int science, int strength, int technology)
        {
            AddresseeClient      adc = new AddresseeClient();
            LockedModeUserClient lmu = new LockedModeUserClient();
            string    emailpartition = AddresseeClient.GetPartitionKeyForEmail(email);
            Addressee a = adc.GetByPartitionAndRowKey(emailpartition, email);

            if (a == null)
            {
                adc.AddNewItem(new Addressee(email.ToLower())
                {
                    Name = name, Email = email.ToLower()
                });
            }
            LockedModeUser user = lmu.GetByPartitionAndRowKey(emailpartition, email);

            if (user == null)
            {
                lmu.AddNewItem(new LockedModeUser
                {
                    PartitionKey = emailpartition,
                    RowKey       = email.ToLower(),
                    Name         = name,
                    Email        = email.ToLower(),
                    Referer      = "general",
                    admiration   = admiration,
                    adventure    = adventure,
                    animals      = animals,
                    beauty       = beauty,
                    competition  = competition,
                    coordinating = coordinating,
                    creativity   = creativity,
                    critical     = critical,
                    drafting     = drafting,
                    duty         = duty,
                    handlabor    = handlabor,
                    helping      = helping,
                    machinery    = machinery,
                    numbers      = numbers,
                    people       = people,
                    politics     = politics,
                    safety       = safety,
                    salesy       = salesy,
                    science      = science,
                    strength     = strength,
                    technology   = technology
                });
            }
            else
            {
                user.admiration   = admiration;
                user.adventure    = adventure;
                user.animals      = animals;
                user.beauty       = beauty;
                user.competition  = competition;
                user.coordinating = coordinating;
                user.creativity   = creativity;
                user.critical     = critical;
                user.drafting     = drafting;
                user.duty         = duty;
                user.handlabor    = handlabor;
                user.helping      = helping;
                user.machinery    = machinery;
                user.numbers      = numbers;
                user.people       = people;
                user.politics     = politics;
                user.safety       = safety;
                user.salesy       = salesy;
                user.science      = science;
                user.strength     = strength;
                user.technology   = technology;
                lmu.Update(user);
            }
            sendInterestResultEmail(name, email);
            return(new JsonResult {
                Data = new { result = "ok" }
            });
        }
Ejemplo n.º 6
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());
        }
Ejemplo n.º 7
0
        public ActionResult EmailResults(string name, string email, string phone, string interests, string selectedschool, string otherschools, string originpage)
        {
            AddresseeClient      adc = new AddresseeClient();
            LockedModeUserClient lmu = new LockedModeUserClient();
            string emailpartition    = AddresseeClient.GetPartitionKeyForEmail(email);

            interests = interests == null ? "" : interests;
            Addressee a = adc.GetByPartitionAndRowKey(emailpartition, email.ToLower());

            if (a == null)
            {
                adc.AddNewItem(new Addressee(email.ToLower())
                {
                    Name = name, Email = email.ToLower()
                });
            }
            LockedModeUser user = lmu.GetByPartitionAndRowKey(emailpartition, email);

            if (user == null)
            {
                lmu.AddNewItem(new LockedModeUser
                {
                    PartitionKey = emailpartition,
                    RowKey       = email.ToLower(),
                    Name         = name,
                    Email        = email.ToLower(),
                    Phone        = phone,
                    Referer      = "lm",

                    Attitude      = Request.Cookies["attitude"] != null ? Request.Cookies["attitude"].Value : "",
                    Action        = Request.Cookies["action"] != null ? Request.Cookies["action"].Value : "",
                    Information   = Request.Cookies["information"] != null ? Request.Cookies["information"].Value : "",
                    Processing    = Request.Cookies["processing"] != null ? Request.Cookies["processing"].Value : "",
                    Endurance     = Request.Cookies["endurance"] != null ? Request.Cookies["endurance"].Value : "",
                    Patterns      = Request.Cookies["patterns"] != null ? Request.Cookies["patterns"].Value : "",
                    Presence      = Request.Cookies["presence"] != null ? Request.Cookies["presence"].Value : "",
                    Compensation  = Request.Cookies["compensation"] != null ? Request.Cookies["compensation"].Value : "",
                    Concentration = Request.Cookies["concentration"] != null ? Request.Cookies["concentration"].Value : "",
                    admiration    = interests.Contains("admiration") ? 1 : 0,
                    adventure     = interests.Contains("adventure") ? 1 : 0,
                    animals       = interests.Contains("animals") ? 1 : 0,
                    beauty        = interests.Contains("beauty") ? 1 : 0,
                    competition   = interests.Contains("competition") ? 1 : 0,
                    coordinating  = interests.Contains("coordinating") ? 1 : 0,
                    creativity    = interests.Contains("creativity") ? 1 : 0,
                    critical      = interests.Contains("critical") ? 1 : 0,
                    drafting      = interests.Contains("drafting") ? 1 : 0,
                    duty          = interests.Contains("duty") ? 1 : 0,
                    handlabor     = interests.Contains("handlabor") ? 1 : 0,
                    helping       = interests.Contains("helping") ? 1 : 0,
                    machinery     = interests.Contains("machinery") ? 1 : 0,
                    numbers       = interests.Contains("numbers") ? 1 : 0,
                    people        = interests.Contains("people") ? 1 : 0,
                    politics      = interests.Contains("politics") ? 1 : 0,
                    safety        = interests.Contains("safety") ? 1 : 0,
                    salesy        = interests.Contains("salesy") ? 1 : 0,
                    science       = interests.Contains("science") ? 1 : 0,
                    strength      = interests.Contains("strength") ? 1 : 0,
                    technology    = interests.Contains("technology") ? 1 : 0,

                    Color    = Request.Cookies["color"] != null ? Request.Cookies["color"].Value : "",
                    Shape    = Request.Cookies["shape"] != null ? Request.Cookies["shape"].Value : "",
                    Sport    = Request.Cookies["sport"] != null ? Request.Cookies["sport"].Value : "",
                    School   = Request.Cookies["school"] != null ? Request.Cookies["school"].Value : "",
                    EduLevel = Request.Cookies["educationSelected"] != null ? Request.Cookies["educationSelected"].Value : ""
                });
            }
            else
            {
                user.Name          = name;
                user.Phone         = phone;
                user.Attitude      = Request.Cookies["attitude"] != null ? Request.Cookies["attitude"].Value : "";
                user.Action        = Request.Cookies["action"] != null ? Request.Cookies["action"].Value : "";
                user.Information   = Request.Cookies["information"] != null ? Request.Cookies["information"].Value : "";
                user.Processing    = Request.Cookies["processing"] != null ? Request.Cookies["processing"].Value : "";
                user.Endurance     = Request.Cookies["endurance"] != null ? Request.Cookies["endurance"].Value : "";
                user.Patterns      = Request.Cookies["patterns"] != null ? Request.Cookies["patterns"].Value : "";
                user.Presence      = Request.Cookies["presence"] != null ? Request.Cookies["presence"].Value : "";
                user.Compensation  = Request.Cookies["compensation"] != null ? Request.Cookies["compensation"].Value : "";
                user.Concentration = Request.Cookies["concentration"] != null ? Request.Cookies["concentration"].Value : "";
                user.admiration    = interests.Contains("admiration") ? 1 : 0;
                user.adventure     = interests.Contains("adventure") ? 1 : 0;
                user.animals       = interests.Contains("animals") ? 1 : 0;
                user.beauty        = interests.Contains("beauty") ? 1 : 0;
                user.competition   = interests.Contains("competition") ? 1 : 0;
                user.coordinating  = interests.Contains("coordinating") ? 1 : 0;
                user.creativity    = interests.Contains("creativity") ? 1 : 0;
                user.critical      = interests.Contains("critical") ? 1 : 0;
                user.drafting      = interests.Contains("drafting") ? 1 : 0;
                user.duty          = interests.Contains("duty") ? 1 : 0;
                user.handlabor     = interests.Contains("handlabor") ? 1 : 0;
                user.helping       = interests.Contains("helping") ? 1 : 0;
                user.machinery     = interests.Contains("machinery") ? 1 : 0;
                user.numbers       = interests.Contains("numbers") ? 1 : 0;
                user.people        = interests.Contains("people") ? 1 : 0;
                user.politics      = interests.Contains("politics") ? 1 : 0;
                user.safety        = interests.Contains("safety") ? 1 : 0;
                user.salesy        = interests.Contains("salesy") ? 1 : 0;
                user.science       = interests.Contains("science") ? 1 : 0;
                user.strength      = interests.Contains("strength") ? 1 : 0;
                user.technology    = interests.Contains("technology") ? 1 : 0;

                user.Color    = Request.Cookies["color"] != null ? Request.Cookies["color"].Value : "";
                user.Shape    = Request.Cookies["shape"] != null ? Request.Cookies["shape"].Value : "";
                user.Sport    = Request.Cookies["sport"] != null ? Request.Cookies["sport"].Value : "";
                user.School   = Request.Cookies["school"] != null ? Request.Cookies["school"].Value : "";
                user.EduLevel = Request.Cookies["educationSelected"] != null ? Request.Cookies["educationSelected"].Value : "";
                lmu.Update(user);
            }
            if (!string.IsNullOrEmpty(selectedschool) && !string.IsNullOrEmpty(otherschools))
            {
                sendResultEmailWithSchool(name, email, selectedschool, otherschools);
            }
            else
            {
                sendResultEmail(name, email);
            }

            if (originpage == "testresults")
            {
                TempData["resultsEmailed"] = true;
                return(RedirectToAction("TestResults", "TakeTest"));
            }
            else
            {
                TempData["resultsEmailed"] = true;
                return(RedirectToAction("Thankyou", "TakeTest"));
            }
        }