コード例 #1
0
 public ActionResult Index()
 {
     if (Session["UserProfile"] != null)
     {
         objUProfile                       = (login_table)Session["UserProfile"];
         objExamCompletion                 = new UserExamCompletion();
         objFinalTest                      = new FinalTestBLL();
         objExamCompletion.CandidateId     = Convert.ToInt32(objUProfile.Id);
         objExamCompletion.IsExamCompleted = true;
         objExamCompletion.CreatedBy       = objUProfile.email;
         objFinalTest.IsExamCompletion(objExamCompletion);
         Session["UserProfile"] = null;
         return(View());
     }
     else
     {
         return(RedirectToAction("Login", "IPTSELogin"));
     }
 }
コード例 #2
0
        public ActionResult SchoolTest()
        {
            try
            {
                if (Session["EndDate"] == null)
                {
                    Session["EndDate"] = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow.AddMinutes(45), TimeZoneInfo.FindSystemTimeZoneById("India Standard Time")).ToString("dd-MM-yyyy h:mm:ss tt");
                    //Session["EndDate"] = DateTime.Now.AddMinutes(10).ToString("dd-MM-yyyy h:mm:ss tt").ToString(CultureInfo.InvariantCulture);
                }
                ViewBag.EndTime = Session["EndDate"];

                FinalTestBLL objFinalTest = new FinalTestBLL();
                if (Session["Next"] == null && Session["isTimeOut"] == null && Session["isSkip"] == null && Session["isPrev"] == null)
                {
                    lstQuestions = new List <Questions>();
                    objQusetion  = new Questions();
                    lstQuestions = objFinalTest.GenerateFinalQuestionsSchool(Convert.ToInt32(Session["TestId"]));
                    if (lstQuestions.Count > 0)
                    {
                        Session["Questions"]      = lstQuestions.OrderBy(t2 => t2.QuestNo).ToList();
                        objQusetion               = lstQuestions.Select(t => t).FirstOrDefault();
                        ViewBag.questionNo        = objQusetion.QuestNo;
                        Session["questNo"]        = ViewBag.questionNo;
                        ViewBag.remainingTime     = 60;
                        objQusetion.remainingTime = 60;
                        objQusetion.TotalTime     = "9:59";
                        ViewBag.TotalTime         = "9:59";
                        ViewBag.isSkip            = false;
                        return(View(objQusetion));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "School"));
                    }
                }
                else
                {
                    Questions a = (Questions)Session["qData"];
                    ViewBag.questionNo = a.QuestNo;
                    lstQuestions       = (List <Questions>)Session["Questions"];
                    var lstQuestionsNew = lstQuestions.Where(t => t.skipQuestions == true).Select(t1 => t1).ToList();
                    if (lstQuestionsNew.Count > 0)
                    {
                        ViewBag.isSkip = true;
                    }
                    else
                    {
                        ViewBag.isSkip = false;
                    }
                    if (Session["remainTime"] != null)
                    {
                        ViewBag.remainingTime = Session["remainTime"];
                        Session["remainTime"] = null;
                    }
                    return(View(a));
                }
            }
            catch (Exception ex)
            {
                Session["ErrorMessage"] = ex;
                return(RedirectToAction("Index", "Error"));
            }
        }
コード例 #3
0
 public ActionResult Login(login_table login_table)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (var db = new LoginDataModel())
             {
                 Session["TestId"] = "";
                 byte[] encode = new byte[login_table.password.Length];
                 encode = System.Text.Encoding.UTF8.GetBytes(login_table.password);
                 login_table.password = Convert.ToBase64String(encode);
                 bool allDigits = login_table.email.All(char.IsDigit);
                 if (allDigits)
                 {
                     var loginId = Decimal.Parse(login_table.email);
                     var obj     = db.login_table.Where(a => a.Id.Equals(loginId) && a.password.Equals(login_table.password)).FirstOrDefault();
                     if (obj != null)
                     {
                         FinalTestBLL objFinalTest = new FinalTestBLL();
                         bool         isExamGiven  = objFinalTest.IsExamGiven(obj);
                         if (isExamGiven)
                         {
                             ViewBag.ErrorMessage = "You have already completed your exam!";
                             return(View());
                         }
                         else
                         {
                             Session["id"]          = obj.Id.ToString();
                             Session["UserProfile"] = obj;
                             ViewBag.UID            = HttpUtility.UrlEncode(Encrypt(obj.Id.ToString()));
                             Session["Type"]        = obj.Login_type;
                             payment_details payment_Details = new payment_details();
                             payment_Details.Id = Decimal.Parse(Session["id"].ToString());
                             var objPayment = pDB.payment_details.Where(a => a.Id.Equals(payment_Details.Id)).FirstOrDefault();
                             if (objPayment == null)
                             {
                                 ViewBag.PaymentMessage = "Payment";
                                 return(View());
                             }
                             else
                             {
                                 var insType = rDB.IPTSE_Reg_table.Where(t => t.Id.Equals(obj.Id)).Select(t1 => t1.InstitutionType).FirstOrDefault();
                                 if (insType == "School")
                                 {
                                     Session["TestId"] = 2;
                                     return(RedirectToAction("Index", "School"));
                                 }
                                 else if (insType == "College")
                                 {
                                     Session["TestId"] = 2; return(RedirectToAction("Index", "College"));
                                 }
                                 else
                                 {
                                     Session["TestId"] = 1; return(RedirectToAction("Index", "Mock"));
                                 }
                             }
                         }
                     }
                     else
                     {
                         if (loginId == Decimal.Parse("91620195"))
                         {
                             //if (login_table.password == "YWJjQDEyMw==") //"SVBUU0VfQURNSU5fTE9HSU4 =")
                             //{
                             Session["admin_login"] = "******";
                             return(RedirectToAction("Index", "Admin"));
                             //}
                         }
                         ViewBag.ErrorMessage = "Invalid Credentials....";
                         return(View());
                     }
                 }
                 else
                 {
                     var obj1 = db.login_table.Where(a => a.email.Equals(login_table.email) && a.password.Equals(login_table.password)).FirstOrDefault();
                     if (obj1 != null)
                     {
                         FinalTestBLL objFinalTest = new FinalTestBLL();
                         bool         isExamGiven  = objFinalTest.IsExamGiven(obj1);
                         if (isExamGiven)
                         {
                             ViewBag.ErrorMessage = "You have already completed your exam!";
                             return(View());
                         }
                         else
                         {
                             Session["id"]          = obj1.Id.ToString();
                             ViewBag.UID            = HttpUtility.UrlEncode(Encrypt(obj1.Id.ToString()));
                             Session["UserProfile"] = obj1;
                             Session["Type"]        = obj1.Login_type;
                             obj1.LastLoginDateTime = DateTime.Now;
                             payment_details payment_Details = new payment_details();
                             payment_Details.Id = Decimal.Parse(Session["id"].ToString());
                             var objPayment = pDB.payment_details.Where(a => a.Id.Equals(payment_Details.Id)).FirstOrDefault();
                             if (objPayment == null)
                             {
                                 ViewBag.PaymentMessage = "Payment";
                                 return(View());
                             }
                             else
                             {
                                 var insType = rDB.IPTSE_Reg_table.Where(t => t.Id.Equals(obj1.Id)).Select(t1 => t1.InstitutionType).FirstOrDefault();
                                 if (insType == "School")
                                 {
                                     Session["TestId"] = 2; return(RedirectToAction("Index", "School"));
                                 }
                                 else if (insType == "College")
                                 {
                                     Session["TestId"] = 2; return(RedirectToAction("Index", "College"));
                                 }
                                 else
                                 {
                                     Session["TestId"] = 1; return(RedirectToAction("Index", "Mock"));
                                 }
                             }
                         }
                     }
                     else
                     {
                         if (login_table.Id == Decimal.Parse("91620195"))
                         {
                             if (login_table.password == "SVBUU0VfQURNSU5fTE9HSU4=")
                             {
                                 Session["admin_login"] = "******";
                                 return(RedirectToAction("Index", "Admin"));
                             }
                         }
                         ViewBag.ErrorMessage = "Invalid Credentials....";
                         return(View());
                     }
                 }
             }
         }
         return(View(login_table));
     }
     catch (Exception ex)
     {
         Session["ErrorMessage"] = ex;
         return(RedirectToAction("Index", "Error"));
     }
 }