Exemplo n.º 1
0
 public ActionResult CareerData(int id)
 {
     if (Request.IsAuthenticated)
     {
         string UserName            = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;
         tblQuestionnaireLogin temp = db.tblQuestionnaireLogins.Where(x => x.UserName == UserName).FirstOrDefault();
         if (temp.IsAdmin != "1")
         {
             FormsAuthentication.SignOut();
             Session.Abandon();
             return(RedirectToAction("Login", "LoginQuestionnaire"));
         }
         ViewBag.CareerFields  = db.tblQuestionnaireFieldLogics.Where(x => x.Id == id).FirstOrDefault();
         ViewBag.Description   = db.tblQuestionnaireCareerDescriptions.Where(x => x.Id == id).FirstOrDefault();
         ViewBag.CourseWork    = db.tblQuestionnaireCourseWorks.Where(x => x.Id == id).FirstOrDefault();
         ViewBag.Videos        = db.tblQuestionnaireVideos.Where(x => x.CareerId == id).ToList();
         ViewBag.Reading       = db.tblQuestionnaireReadings.Where(x => x.CareerId == id).ToList();
         ViewBag.OnlineCourses = db.tblQuestionnaireOnlineCourses.Where(x => x.CareerId == id).ToList();
         return(View());
     }
     else
     {
         return(RedirectToAction("Login", "LoginQuestionnaire"));
     }
 }
        public ActionResult QuestionSelect()
        {
            if (Request.IsAuthenticated)
            {
                string UserName = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;

                tblQuestionnaireSubStrengthResult temp = db.tblQuestionnaireSubStrengthResults.Where(x => x.UserName == UserName).FirstOrDefault();

                tblQuestionnaireLogin login = db.tblQuestionnaireLogins.Where(x => x.UserName == UserName).FirstOrDefault();
                if (login.IsAdmin == "1")
                {
                    return(RedirectToAction("Career", "AdminQuestionnaire"));
                }

                if (temp == null)
                {
                    List <Sp_QuestionList_Result> list = db.Sp_QuestionList().ToList();
                    return(View(list));
                }
                else
                {
                    return(RedirectToAction("DashBoard", "DashBoardQuestionnaire"));
                }
            }
            else
            {
                return(RedirectToAction("Login", "LoginQuestionnaire"));
            }
        }
Exemplo n.º 3
0
        public JsonResult Login([Bind(Include = "UserName,Password")] Login tblQuesrionnaireLogin)
        {
            tblQuestionnaireLogin temp = db.tblQuestionnaireLogins.Where(x => x.UserName == tblQuesrionnaireLogin.UserName && x.Password == tblQuesrionnaireLogin.Password).FirstOrDefault();

            if (temp == null)
            {
                return(Json(new { Status = false }));
            }
            else
            {
                tblQuestionnaireStudentRegister regis = db.tblQuestionnaireStudentRegisters.Where(x => x.Email == tblQuesrionnaireLogin.UserName).FirstOrDefault();
                FormsAuthentication.SetAuthCookie(tblQuesrionnaireLogin.UserName.Trim(), false);
                return(Json(new { Status = true, IsAdmin = temp.IsAdmin }));
            }
        }
Exemplo n.º 4
0
        public JsonResult Register([Bind(Include = "Id,Name,Email,Age,Gender,Mobile,Address")] Register register)
        {
            if (ModelState.IsValid)
            {
                tblQuestionnaireStudentRegister tblQuestionnaireStudentRegister = new tblQuestionnaireStudentRegister();
                tblQuestionnaireStudentRegister.Name     = register.Name;
                tblQuestionnaireStudentRegister.Email    = register.Email;
                tblQuestionnaireStudentRegister.Age      = register.Age;
                tblQuestionnaireStudentRegister.Gender   = register.Gender;
                tblQuestionnaireStudentRegister.Mobile   = register.Mobile;
                tblQuestionnaireStudentRegister.Address  = register.Address;
                tblQuestionnaireStudentRegister.IsActive = "1";

                bool status = CheckEmail(tblQuestionnaireStudentRegister);

                if (status == true)
                {
                    return(Json(new { Status = false, Error = "Email Already Exists." }));
                }
                else
                {
                    db.tblQuestionnaireStudentRegisters.Add(tblQuestionnaireStudentRegister);

                    tblQuestionnaireLogin tblQuesrionnaireLogin = new tblQuestionnaireLogin();
                    tblQuesrionnaireLogin.UserName = tblQuestionnaireStudentRegister.Email;
                    tblQuesrionnaireLogin.Password = Membership.GeneratePassword(12, 2);
                    tblQuesrionnaireLogin.IsAdmin  = "0";
                    db.tblQuestionnaireLogins.Add(tblQuesrionnaireLogin);

                    db.SaveChanges();

                    BackgroundJob.Enqueue(() => SendMail(tblQuesrionnaireLogin.UserName, tblQuesrionnaireLogin.UserName, tblQuesrionnaireLogin.Password, tblQuestionnaireStudentRegister.Name));

                    return(Json(new { Status = true }));
                }
            }
            else
            {
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        return(Json(new { Status = false, Error = error.ErrorMessage }));
                    }
                }
                return(Json(new { Status = false }));
            }
        }
Exemplo n.º 5
0
        public JsonResult ForgotPassword(string Username)
        {
            tblQuestionnaireLogin tblQuesrionnaireLogin = db.tblQuestionnaireLogins.Where(x => x.UserName == Username).FirstOrDefault();

            if (tblQuesrionnaireLogin != null)
            {
                tblQuestionnaireStudentRegister tblQuestionnaireStudentRegister = db.tblQuestionnaireStudentRegisters.Where(x => x.Email == Username).FirstOrDefault();
                BackgroundJob.Enqueue(() => SendMail(tblQuesrionnaireLogin.UserName, tblQuesrionnaireLogin.UserName, tblQuesrionnaireLogin.Password, tblQuestionnaireStudentRegister.Name));

                return(Json(new { Status = true }));
            }
            else
            {
                return(Json(new { Status = false }));
            }
        }
Exemplo n.º 6
0
        // GET: Admin

        public ActionResult Career()
        {
            if (Request.IsAuthenticated)
            {
                string UserName            = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;
                tblQuestionnaireLogin temp = db.tblQuestionnaireLogins.Where(x => x.UserName == UserName).FirstOrDefault();
                if (temp.IsAdmin != "1")
                {
                    FormsAuthentication.SignOut();
                    Session.Abandon();
                    return(RedirectToAction("Login", "LoginQuestionnaire"));
                }
                List <tblQuestionnaireFieldLogic> list = db.tblQuestionnaireFieldLogics.ToList();

                return(View(list));
            }
            else
            {
                return(RedirectToAction("Login", "LoginQuestionnaire"));
            }
        }
        // GET: DashBoard
        public ActionResult DashBoard()
        {
            if (Request.IsAuthenticated)
            {
                string UserName = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name;

                tblQuestionnaireSubStrengthResult temp = db.tblQuestionnaireSubStrengthResults.Where(x => x.UserName == UserName).FirstOrDefault();

                tblQuestionnaireLogin login = db.tblQuestionnaireLogins.Where(x => x.UserName == UserName).FirstOrDefault();
                if (login.IsAdmin == "1")
                {
                    return(RedirectToAction("Career", "AdminQuestionnaire"));
                }

                if (temp == null)
                {
                    return(RedirectToAction("TermsAndConditions", "HomeQuestionnaire"));
                }
                else
                {
                    tblQuestionnaireFieldLogicResult tblQuestionnaireFieldLogicResult = db.tblQuestionnaireFieldLogicResults.Where(x => x.UserName == UserName).FirstOrDefault();

                    if (tblQuestionnaireFieldLogicResult == null)
                    {
                        List <SubStrengthValue> list = new List <SubStrengthValue>();

                        SubStrengthValue Artistic = new SubStrengthValue();
                        Artistic.Name  = 1;
                        Artistic.Value = temp.Artistic;
                        list.Add(Artistic);

                        SubStrengthValue Aesthetic = new SubStrengthValue();
                        Aesthetic.Name  = 2;
                        Aesthetic.Value = temp.Aesthetic;
                        list.Add(Aesthetic);

                        SubStrengthValue Idea_Generator = new SubStrengthValue();
                        Idea_Generator.Name  = 3;
                        Idea_Generator.Value = temp.Idea_Generator;
                        list.Add(Idea_Generator);

                        SubStrengthValue Team_Player = new SubStrengthValue();
                        Team_Player.Name  = 4;
                        Team_Player.Value = temp.Team_Player;
                        list.Add(Team_Player);

                        SubStrengthValue Independent = new SubStrengthValue();
                        Independent.Name  = 5;
                        Independent.Value = temp.Independent;
                        list.Add(Independent);

                        SubStrengthValue Mentor = new SubStrengthValue();
                        Mentor.Name  = 6;
                        Mentor.Value = temp.Mentor;
                        list.Add(Mentor);

                        SubStrengthValue Analytics = new SubStrengthValue();
                        Analytics.Name  = 7;
                        Analytics.Value = temp.Analytics;
                        list.Add(Analytics);

                        SubStrengthValue Social_Philosophical = new SubStrengthValue();
                        Social_Philosophical.Name  = 8;
                        Social_Philosophical.Value = temp.Social_Philosophical;
                        list.Add(Social_Philosophical);

                        SubStrengthValue Practical = new SubStrengthValue();
                        Practical.Name  = 9;
                        Practical.Value = temp.Practical;
                        list.Add(Practical);

                        list = list.Where(x => x.Value > temp.Average).OrderByDescending(x => x.Value).ToList();

                        List <tblQuestionnaireFieldLogic> fieldLogic = db.tblQuestionnaireFieldLogics.ToList();

                        foreach (var item in fieldLogic)
                        {
                            tblQuestionnaireFieldLogicResult result = new tblQuestionnaireFieldLogicResult();
                            result.CareerId  = item.Id;
                            result.UserName  = UserName;
                            result.MainField = item.MainField;
                            result.SubField  = item.SubField;
                            result.Critical1 = list.Where(x => x.Name == item.Critical1).Select(x => x.Value).FirstOrDefault();
                            result.Critical2 = list.Where(x => x.Name == item.Critical2).Select(x => x.Value).FirstOrDefault();
                            result.Critical3 = list.Where(x => x.Name == item.Critical3).Select(x => x.Value).FirstOrDefault();

                            if (item.HygieneFactor == 0)
                            {
                                result.HygieneFactor = 1;
                            }
                            else if (item.HygieneFactor == 1)
                            {
                                if (temp.Artistic > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 2)
                            {
                                if (temp.Aesthetic > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 3)
                            {
                                if (temp.Idea_Generator > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 4)
                            {
                                if (temp.Team_Player > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 5)
                            {
                                if (temp.Independent > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 6)
                            {
                                if (temp.Mentor > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 7)
                            {
                                if (temp.Analytics > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else if (item.HygieneFactor == 8)
                            {
                                if (temp.Social_Philosophical > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }
                            else
                            {
                                if (temp.Practical > temp.Average)
                                {
                                    result.HygieneFactor = 1;
                                }
                                else
                                {
                                    result.HygieneFactor = 0;
                                }
                            }

                            result.Contra1 = list.Where(x => x.Name == item.Contra1).Select(x => x.Value).FirstOrDefault();
                            result.Contra2 = list.Where(x => x.Name == item.Contra2).Select(x => x.Value).FirstOrDefault();

                            if (item.HowItWorks == 1)
                            {
                                if (result.HygieneFactor == 1 && result.Contra1 == 0 && result.Contra2 == 0)
                                {
                                    if (result.Critical1 == 0)
                                    {
                                        result.Result = 25;
                                    }
                                    else
                                    {
                                        if (item.Critical2 != 0 && result.Critical2 == 0)
                                        {
                                            result.Result = 75;
                                        }
                                        else
                                        {
                                            if (item.Critical3 != 0 && result.Critical3 == 0)
                                            {
                                                result.Result = 90;
                                            }
                                            else
                                            {
                                                result.Result = 100;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (result.Critical1 > 0)
                                    {
                                        result.Result = 25;
                                    }
                                    else
                                    {
                                        result.Result = 0;
                                    }
                                }
                            }
                            else if (item.HowItWorks == 2)
                            {
                                if (result.HygieneFactor == 1 && result.Contra1 == 0 && result.Contra2 == 0)
                                {
                                    if (result.Critical1 == 0 && result.Critical2 == 0)
                                    {
                                        result.Result = 25;
                                    }
                                    else
                                    {
                                        if (result.Critical1 == 0 || result.Critical2 == 0)
                                        {
                                            result.Result = 50;
                                        }
                                        else
                                        {
                                            if (item.Critical3 != 0 && result.Critical3 == 0)
                                            {
                                                result.Result = 90;
                                            }
                                            else
                                            {
                                                result.Result = 100;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (result.Critical1 == 0 && result.Critical2 == 0)
                                    {
                                        result.Result = 0;
                                    }
                                    else
                                    {
                                        result.Result = 25;
                                    }
                                }
                            }
                            else if (item.HowItWorks == 3)
                            {
                                if (result.HygieneFactor == 1 && result.Contra1 == 0 && result.Contra2 == 0)
                                {
                                    if (result.Critical1 == 0)
                                    {
                                        if (result.Critical2 == 0)
                                        {
                                            if (result.Critical3 == 0)
                                            {
                                                result.Result = 0;
                                            }
                                            else
                                            {
                                                result.Result = 25;
                                            }
                                        }
                                        else
                                        {
                                            if (result.Critical3 == 0)
                                            {
                                                result.Result = 25;
                                            }
                                            else
                                            {
                                                result.Result = 50;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (result.Critical2 == 0)
                                        {
                                            if (result.Critical3 == 0)
                                            {
                                                result.Result = 25;
                                            }
                                            else
                                            {
                                                result.Result = 50;
                                            }
                                        }
                                        else
                                        {
                                            result.Result = 100;
                                        }
                                    }
                                }
                                else
                                {
                                    if (result.Critical1 == 0 && result.Critical2 == 0 && result.Critical3 == 0)
                                    {
                                        result.Result = 0;
                                    }
                                    else
                                    {
                                        result.Result = 25;
                                    }
                                }
                            }
                            else
                            {
                                if (result.HygieneFactor == 1 && result.Contra1 == 0 && result.Contra2 == 0)
                                {
                                    if (result.Critical1 == 0 && result.Critical2 == 0 && result.Critical3 == 0)
                                    {
                                        result.Result = 25;
                                    }
                                    else
                                    {
                                        if (result.Critical1 > 0 || result.Critical2 > 0 || result.Critical3 > 0)
                                        {
                                            result.Result = 75;
                                        }
                                        else
                                        {
                                            result.Result = 100;
                                        }
                                    }
                                }
                                else
                                {
                                    if (result.Critical1 > 0 || result.Critical2 > 0 || result.Critical3 > 0)
                                    {
                                        result.Result = 25;
                                    }
                                    else
                                    {
                                        result.Result = 0;
                                    }
                                }
                            }

                            db.tblQuestionnaireFieldLogicResults.Add(result);
                            db.SaveChanges();
                        }
                    }

                    List <tblQuestionnaireFieldLogicResult> carrerlist = db.tblQuestionnaireFieldLogicResults.Where(x => x.UserName == UserName).OrderByDescending(x => x.Result).ToList();

                    ViewBag.CarrerList = carrerlist;

                    List <SubStrengthValue> list1 = new List <SubStrengthValue>();

                    SubStrengthValue Artistic1 = new SubStrengthValue();
                    Artistic1.Name  = 1;
                    Artistic1.Value = temp.Artistic;
                    list1.Add(Artistic1);

                    SubStrengthValue Aesthetic1 = new SubStrengthValue();
                    Aesthetic1.Name  = 2;
                    Aesthetic1.Value = temp.Aesthetic;
                    list1.Add(Aesthetic1);

                    SubStrengthValue Idea_Generator1 = new SubStrengthValue();
                    Idea_Generator1.Name  = 3;
                    Idea_Generator1.Value = temp.Idea_Generator;
                    list1.Add(Idea_Generator1);

                    SubStrengthValue Team_Player1 = new SubStrengthValue();
                    Team_Player1.Name  = 4;
                    Team_Player1.Value = temp.Team_Player;
                    list1.Add(Team_Player1);

                    SubStrengthValue Independent1 = new SubStrengthValue();
                    Independent1.Name  = 5;
                    Independent1.Value = temp.Independent;
                    list1.Add(Independent1);

                    SubStrengthValue Mentor1 = new SubStrengthValue();
                    Mentor1.Name  = 6;
                    Mentor1.Value = temp.Mentor;
                    list1.Add(Mentor1);

                    SubStrengthValue Analytics1 = new SubStrengthValue();
                    Analytics1.Name  = 7;
                    Analytics1.Value = temp.Analytics;
                    list1.Add(Analytics1);

                    SubStrengthValue Social_Philosophical1 = new SubStrengthValue();
                    Social_Philosophical1.Name  = 8;
                    Social_Philosophical1.Value = temp.Social_Philosophical;
                    list1.Add(Social_Philosophical1);

                    SubStrengthValue Practical1 = new SubStrengthValue();
                    Practical1.Name  = 9;
                    Practical1.Value = temp.Practical;
                    list1.Add(Practical1);

                    list1 = list1.OrderByDescending(x => x.Value).ToList();

                    List <SubStrengthDescription> listdesc = new List <SubStrengthDescription>();
                    var t = list1.Take(3);
                    foreach (var temmp in t)
                    {
                        SubStrengthDescription sub = new SubStrengthDescription();
                        sub.Name  = temmp.Name;
                        sub.Value = db.tblQuestionnaireSubStrengths.Where(x => x.Id == temmp.Name).Select(x => x.Description).FirstOrDefault();
                        listdesc.Add(sub);
                    }

                    ViewBag.Description = listdesc;
                    return(View());
                }
            }
            else
            {
                return(RedirectToAction("Login", "LoginQuestionnaire"));
            }
        }