internal BOExamManage SelectExamQestionAnswer(string txtevent, int examid) { using (SqlConnection _sqlcon = ConnectionInfo.GetConnection()) { _sqlcommond = new SqlCommand(); _sqlcommond.CommandText = "SP_GetExamQuestionAnswerForOffLineSimultor"; _sqlcommond.Connection = _sqlcon; _sqlcommond.CommandType = CommandType.StoredProcedure; _sqlcommond.Parameters.AddWithValue("@ExamCodeId", examid); _sqlcommond.Parameters.AddWithValue("@Event", txtevent); _sqlcon.Open(); _sqldataadapter = new SqlDataAdapter(_sqlcommond); _datatable = new DataTable(); _sqldataadapter.Fill(_datatable); BOExamManage _boexmmnglist = (from li in _datatable.AsEnumerable() select new BOExamManage { ExamCodeId = li.Field <int>("ExamCodeId"), ExamCode = li.Field <string>("ExamCode"), ExamTitle = li.Field <string>("ExamTitle"), PassingPercentage = li.Field <decimal>("PassingPercentage"), TestTime = li.Field <int>("TestTime"), SecondCategoryId = li.Field <int>("SecondCategoryId"), SecondCategory = li.Field <string>("SecondCategoryName"), TestOption = li.Field <string>("TestOption"), QuestionList = GetQuestionList() }).FirstOrDefault(); _sqlcon.Close(); return(_boexmmnglist); } }
public List <BOExamManage> SelectMerchantExam(BOExamManage _boexmmng) { using (SqlConnection _sqlcon = ConnectionInfo.GetConnection()) { _sqlcommond = new SqlCommand(); _sqlcommond.CommandText = "SP_GetExamManage"; _sqlcommond.Connection = _sqlcon; _sqlcommond.CommandType = CommandType.StoredProcedure; _sqlcommond.Parameters.AddWithValue("@MerchantId", _boexmmng.MerchantId); _sqlcommond.Parameters.AddWithValue("@Event", _boexmmng.Event); _sqlcon.Open(); _sqldataadapter = new SqlDataAdapter(_sqlcommond); DataTable _datatable = new DataTable(); _sqldataadapter.Fill(_datatable); _sqlcon.Close(); List <BOExamManage> _merfr = (from cu in _datatable.AsEnumerable() select new BOExamManage { ExamCodeId = cu.Field <int>("ExamCodeId"), ExamCode = cu.Field <string>("ExamCode"), SecondCategory = cu.Field <string>("SecondCategoryName"), TestTime = cu.Field <int>("TestTime"), ValidDate = cu.Field <DateTime>("ValidDate") }).ToList(); return(_merfr); } }
private void GetExamDetail(BOExamManage _exmlist) { if (_exmlist != null) { lblExamName.Text = _exmlist.SecondCategory + " " + _exmlist.ExamCode; if (flagMark) { lblTotalQuestion.Text = Convert.ToString(_exmlist.QuestionList.Where(q => q.Mark.Equals(true)).Count()); dlquesanswer.DataSource = _exmlist.QuestionList.Where(q => q.Mark.Equals(true)).Skip(currentQuestionIndex).Take(1); dlquesanswer.DataBind(); dlmark.DataSource = _exmlist.QuestionList.Where(q => q.Mark.Equals(true)).Skip(currentQuestionIndex).Take(1); dlmark.DataBind(); showQuestionNo(currentQuestionIndex + 1); } else { lblTotalQuestion.Text = Convert.ToString(_exmlist.QuestionList.Count); dlquesanswer.DataSource = _exmlist.QuestionList.Skip(currentQuestionIndex).Take(1); dlquesanswer.DataBind(); dlmark.DataSource = _exmlist.QuestionList.Skip(currentQuestionIndex).Take(1); dlmark.DataBind(); showQuestionNo(currentQuestionIndex + 1); } } else { lblExamName.Text = "No question found!"; lblExamName.ForeColor = System.Drawing.Color.Red; btnprevious.Enabled = false; btnnext.Enabled = false; } }
public List <BOExamManage> SelectExamManageList(BOExamManage _boexmmng) { SqlCommand _sqlcommand; SqlDataAdapter _sqldataadapter; using (SqlConnection _sqlcon = ConnectionInfo.GetConnection()) { _sqlcommand = new SqlCommand(); _sqlcommand.CommandText = "SP_GetExamManage"; _sqlcommand.CommandType = CommandType.StoredProcedure; _sqlcommand.Connection = _sqlcon; _sqlcon.Open(); _sqlcommand.Parameters.AddWithValue("@Event", _boexmmng.Event); _sqldataadapter = new SqlDataAdapter(_sqlcommand); DataTable _datatable = new DataTable(); _sqldataadapter.Fill(_datatable); List <BOExamManage> _boexmmnglist = (from li in _datatable.AsEnumerable() select new BOExamManage { ExamCodeId = li.Field <int>("ExamCodeId"), ExamCode = li.Field <string>("ExamCode"), SecondCategory = li.Field <string>("SecondCategoryName"), MerchantName = li.Field <string>("MerchantName"), Level = li.Field <string>("MerchantLevel"), IsActive = li.Field <bool>("IsActive") }).ToList(); _sqlcon.Close(); return(_boexmmnglist); } }
internal int IUD(BOExamManage _boexmmng) { int returnvalue = default(int); using (SqlConnection _sqlcon = ConnectionInfo.GetConnection()) { _sqlcommond = new SqlCommand(); _sqlcommond.CommandText = "SP_IUDExamManage"; _sqlcommond.CommandType = CommandType.StoredProcedure; _sqlcommond.Connection = _sqlcon; _sqlcon.Open(); _sqlcommond.Parameters.AddWithValue("@ExamCodeId", _boexmmng.ExamCodeId); _sqlcommond.Parameters.AddWithValue("@ExamCode", _boexmmng.ExamCode); _sqlcommond.Parameters.AddWithValue("@ExamTitle", _boexmmng.ExamTitle); _sqlcommond.Parameters.AddWithValue("@SecondCategoryId", _boexmmng.SecondCategoryId); _sqlcommond.Parameters.AddWithValue("@PassingPercentage", _boexmmng.PassingPercentage); _sqlcommond.Parameters.AddWithValue("@TestTime", _boexmmng.TestTime); _sqlcommond.Parameters.AddWithValue("@TestOption", _boexmmng.TestOption); _sqlcommond.Parameters.AddWithValue("@ValidDate", _boexmmng.ValidDate); _sqlcommond.Parameters.AddWithValue("@MerchantId", _boexmmng.MerchantId); _sqlcommond.Parameters.AddWithValue("@IsActive", _boexmmng.IsActive); _sqlcommond.Parameters.AddWithValue("@IsDelete", _boexmmng.IsDelete); _sqlcommond.Parameters.AddWithValue("@CreatedBy", _boexmmng.CreatedBy); _sqlcommond.Parameters.AddWithValue("@CreatedDate", _boexmmng.CreatedDate); _sqlcommond.Parameters.AddWithValue("@UpdatedBy", _boexmmng.UpdatedBy); _sqlcommond.Parameters.AddWithValue("@UpdatedDate", _boexmmng.UpdatedDate); _sqlcommond.Parameters.AddWithValue("@OnlyTestOnce", _boexmmng.OnlyTestOnce); _sqlcommond.Parameters.AddWithValue("@AllowPrint", _boexmmng.AllowPrint); _sqlcommond.Parameters.AddWithValue("@AllowSales", _boexmmng.AllowSales); _sqlcommond.Parameters.AddWithValue("@Event", _boexmmng.Event); _sqlcommond.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput; try { _sqlcommond.ExecuteNonQuery(); returnvalue = Convert.ToInt32(_sqlcommond.Parameters["@returnValue"].Value); } catch (SqlException sqlex) { Common.LogError(sqlex); } catch (StackOverflowException stackex) { Common.LogError(stackex); } catch (Exception ex) { Common.LogError(ex); } finally { _sqlcon.Close(); _sqlcommond.Dispose(); } } return(returnvalue); }
protected void Page_Load(object sender, EventArgs e) { if (Session["UserDetail"] != null) { _bouserDetail = (BOUser)Session["UserDetail"]; if (Session["ExamList"] != null) { _examqueanslist = (BOExamManage)Session["ExamList"]; lblExamCode.Text = _examqueanslist.SecondCategory + " " + _examqueanslist.ExamCode; lblExamName.Text = _examqueanslist.SecondCategory + " " + _examqueanslist.ExamCode; passingSocre = ((_examqueanslist.QuestionList.Count() * 100) * Convert.ToDouble(_examqueanslist.PassingPercentage)) / 100; resultScore = _examqueanslist.QuestionList.Where(ur => ur.UserResult == true).Count() * 100; totalScore = _examqueanslist.QuestionList.Count() * 100; lblpassingscore.Text = Convert.ToString(passingSocre) + "/" + (totalScore); lblyourscore.Text = Convert.ToString(resultScore) + " / " + (totalScore); //lblpbpassingvalue.Text = Convert.ToString(passingSocre); // lblpbresultvalue.Text = Convert.ToString(_examqueanslist.QuestionList.Where(ur => ur.UserResult == true).Count() * 100); string htmlpassingvalue = "<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='" + Convert.ToString(passingSocre / (totalScore / 100)) + "' aria-valuemin='0' aria-valuemax='100'><span class='skill'><i class='val'>" + Convert.ToString(passingSocre) + "</i></span></div>"; pbpassingvalue.InnerHtml = htmlpassingvalue; string htmlresultvalue = string.Empty; if (resultScore >= passingSocre) { lblResultMsg.Text = "Congratulation!! You has passed the " + _examqueanslist.SecondCategory + " " + _examqueanslist.ExamCode + " exam"; lblResultMsg.ForeColor = System.Drawing.Color.Green; htmlresultvalue = "<div class='progress-bar progress-bar-success' role='progressbar' aria-valuenow='" + Convert.ToString(resultScore / (totalScore / 100)) + "' aria-valuemin='0' aria-valuemax='100'><span class='skill'><i class='val'>" + Convert.ToString(resultScore) + "</i></span></div>"; } else { lblResultMsg.Text = "Sorry!! You has failed the " + _examqueanslist.SecondCategory + " " + _examqueanslist.ExamCode + " exam"; lblResultMsg.ForeColor = System.Drawing.Color.Red; if (resultScore != 0) { htmlresultvalue = "<div class='progress-bar progress-bar-danger' role='progressbar' aria-valuenow='" + Convert.ToString(resultScore / (totalScore / 100)) + "' aria-valuemin='0' aria-valuemax='100'><span class='skill'><i class='val'>" + Convert.ToString(resultScore) + "</i></span></div>"; } else { htmlresultvalue = "<div class='progress-bar progress-bar-danger' role='progressbar' aria-valuenow='" + 1 + "' aria-valuemin='0' aria-valuemax='100'><span class='skill'><i class='val'>" + Convert.ToString(resultScore) + "</i></span></div>"; } } pbresultvalue.InnerHtml = htmlresultvalue; DateTime now = DateTime.Now; lbldate.Text = now.ToShortDateString(); lbltime.Text = now.ToLongTimeString(); Session.Remove("ExamList"); if (_examqueanslist.QuestionList.FirstOrDefault().Event == "TO") { UpdateExamManage(_examqueanslist); InserExamReport(_examqueanslist); } } else { Response.Redirect("UserLogin.aspx"); } } }
private void Page_Loaded(object sender, RoutedEventArgs e) { try { _list = bindQuestionListboxToList(); BindQuestionlist(_list); btnPrevious.IsEnabled = false; } catch { } }
public static BOExamManage Shuffle(BOExamManage list) { var random = new Random(); for (int index = list.QuestionList.Count - 1; index >= 1; index--) { int other = random.Next(0, index + 1); var temp = list.QuestionList[index]; list.QuestionList[index] = list.QuestionList[other]; list.QuestionList[other] = temp; } return(list); }
protected void lnkbtnresultdelete_Click(object sender, EventArgs e) { BOExamManage _boexmnge = new BOExamManage(); BAExamManage _baexmmng = new BAExamManage(); LinkButton lnkbtn = sender as LinkButton; int id = Convert.ToInt32(lnkbtn.CommandArgument); //_boexmnge.ExamCodeId = _boexammanage.ExamCodeId; //_boexmnge.OnlyTestOnce = false; //_boexmnge.UpdatedBy = _bouserDetail.UserId; //_boexmnge.UpdatedDate = DateTime.UtcNow; //_boexmnge.Event = "UpdateByUser"; //_baexmmng.IUD(_boexmnge); }
private BOExamManage bindQuestionListboxToList() { BOExamManage _examqueanslist = new BOExamManage(); try { if (filelist != null) { string fileName = Path.GetFileNameWithoutExtension(filelist.Path); string fileExtension = ".json"; string input = filelist.Path; string output = fileName + fileExtension; if (!Directory.Exists(Common.UserDataFolder)) { File.Delete(Common.UserDataFolder + output); } Common.Decrypt(input, Common.UserDataFolder + output); var json = File.ReadAllText(Common.UserDataFolder + output); _examqueanslist = JsonConvert.DeserializeObject <BOExamManage>(json); if (filelist.Mode == "SM") { btnCorrectAnswer.Visibility = Visibility.Visible; _examqueanslist.QuestionList.ForEach(e => e.ExamMode = false); // _examqueanslist.QuestionList.Where(q => q.IsActive.Equals(false)).ToList().ForEach(b => b.AnswerList.Where(a => a.RightAnswer.Equals(true)).ToList().ForEach(r => r.UserAnswer = true)); } else { stpnlTimer.Visibility = Visibility.Visible; _examqueanslist.QuestionList.ForEach(e => e.ExamMode = true); _examqueanslist = Shuffle(_examqueanslist); if (!string.IsNullOrEmpty(_examqueanslist.TestOption)) { var questinlist = _examqueanslist.QuestionList.Take(Convert.ToInt32(_examqueanslist.TestOption)).ToList(); _examqueanslist.QuestionList.Clear(); _examqueanslist.QuestionList = questinlist; } } //Delete the original (input) and the encrypted (output) file. File.Delete(Common.UserDataFolder + output); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(_examqueanslist); }
private void BindQuestionlist(BOExamManage _qestlist) { if (flagMark) { listQuestion.ItemsSource = _qestlist.QuestionList.Where(f => f.Mark).Skip(currentQuestionIndex).Take(1); listQuestionMark.ItemsSource = _qestlist.QuestionList.Where(f => f.Mark).Skip(currentQuestionIndex).Take(1); showQuestionNo(currentQuestionIndex + 1, _qestlist.QuestionList.Where(f => f.Mark).ToList().Count); } else { listQuestion.ItemsSource = _qestlist.QuestionList.Skip(currentQuestionIndex).Take(1); listQuestionMark.ItemsSource = _qestlist.QuestionList.Skip(currentQuestionIndex).Take(1); showQuestionNo(currentQuestionIndex + 1, _qestlist.QuestionList.Count); } }
internal int IUD(BOExamManage _boexmmng) { int returnvalue = default(int); using (SqlConnection _sqlcon = ConnectionInfo.GetConnection()) { _sqlcommond = new SqlCommand(); _sqlcommond.CommandText = "SP_IUDExamManage"; _sqlcommond.CommandType = CommandType.StoredProcedure; _sqlcommond.Connection = _sqlcon; _sqlcon.Open(); _sqlcommond.Parameters.AddWithValue("@ExamCodeId", _boexmmng.ExamCodeId); _sqlcommond.Parameters.AddWithValue("@UpdatedBy", _boexmmng.UpdatedBy); _sqlcommond.Parameters.AddWithValue("@UpdatedDate", _boexmmng.UpdatedDate); _sqlcommond.Parameters.AddWithValue("@OnlyTestOnce", _boexmmng.OnlyTestOnce); _sqlcommond.Parameters.AddWithValue("@Event", _boexmmng.Event); _sqlcommond.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput; try { _sqlcommond.ExecuteNonQuery(); returnvalue = Convert.ToInt32(_sqlcommond.Parameters["@returnValue"].Value); } catch (SqlException sqlex) { Common.LogError(sqlex); } catch (StackOverflowException stackex) { Common.LogError(stackex); } catch (Exception ex) { Common.LogError(ex); } finally { _sqlcon.Close(); _sqlcommond.Dispose(); } } return(returnvalue); }
private void InserExamReport(BOExamManage _boexammanage) { try { if (_boexammanage != null) { BOExamReports _boexrport = new BOExamReports(); BAExamReports _baexrport = new BAExamReports(); _boexrport.UserId = _bouserDetail.UserId; _boexrport.CategoryId = _boexammanage.SecondCategoryId; _boexrport.ExamId = _boexammanage.ExamCodeId; if (resultScore >= passingSocre) { _boexrport.Result = true; } else { _boexrport.Result = false; } _boexrport.Score = Convert.ToDecimal(resultScore); _boexrport.OutofScore = Convert.ToDecimal(totalScore); _boexrport.AllowPrint = true; _boexrport.DigitalCertificateId = 1; var rnd = new Random(DateTime.Now.Millisecond); int ticks = rnd.Next(0, 3000); _boexrport.CertificationNo = ticks; _boexrport.ExamGivenDate = DateTime.UtcNow; _boexrport.MerchantId = _bouserDetail.MerchantId; _boexrport.IsActive = true; _boexrport.IsDelete = false; _boexrport.CreatedBy = _bouserDetail.UserId; _boexrport.CreatedDate = DateTime.UtcNow; _boexrport.UpdatedBy = _bouserDetail.UserId; _boexrport.UpdatedDate = DateTime.UtcNow; _boexrport.Event = "Insert"; _baexrport.Insert(_boexrport); } } catch (Exception ex) { Common.LogError(ex); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["UserDetail"] != null) { if (!IsPostBack) { BOUser _bouserDetail = (BOUser)Session["UserDetail"]; if (Request.QueryString["exmid"] != null && Request.QueryString["tstmd"] != null) { if (Request.QueryString["tstmd"].ToString().Equals("SM")) { Timer1.Enabled = false; pnltimer.Visible = false; } if (Request.QueryString["tstmd"].ToString().Equals("SM")) { btnCorrectAnswer.Visible = true; } string examid = Common.Decrypt(HttpUtility.UrlDecode(Request.QueryString["exmid"])); _examqueanslist = GetEQAList(examid, Request.QueryString["tstmd"]); GetExamDetail(_examqueanslist); TimeAllSecondes = Convert.ToDouble(_examqueanslist.TestTime) * 60; } else { Response.Redirect("UserLogin.aspx"); } } } else { Response.Redirect("Default.aspx", false); } } catch (Exception ex) { Common.LogError(ex); } }
public int IUD_ExamManage(BOExamManage _boexmmng) { int returnValue = default(int); SqlCommand _sqlcommnd; using (SqlConnection _sqlconnection = ConnectionInfo.GetConnection()) { _sqlcommnd = new SqlCommand(); _sqlcommnd.Connection = _sqlconnection; _sqlcommnd.CommandText = "SP_IUDExamManage"; _sqlcommnd.CommandType = CommandType.StoredProcedure; _sqlconnection.Open(); _sqlcommnd.Parameters.AddWithValue("@ExamCodeId", _boexmmng.ExamCodeId); _sqlcommnd.Parameters.AddWithValue("@IsActive", _boexmmng.IsActive); _sqlcommnd.Parameters.AddWithValue("@UpdatedBy", _boexmmng.UpdatedBy); _sqlcommnd.Parameters.AddWithValue("@UpdatedDate", _boexmmng.UpdatedDate); _sqlcommnd.Parameters.AddWithValue("@Event", _boexmmng.Event); _sqlcommnd.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput; try { _sqlcommnd.ExecuteNonQuery(); returnValue = Convert.ToInt32(_sqlcommnd.Parameters["@returnValue"].Value); } catch { returnValue = 100; } finally { _sqlconnection.Close(); _sqlcommnd.Dispose(); } } return(returnValue); }
private void UpdateExamManage(BOExamManage _boexammanage) { //BOExamManage _boexmnge = new BOExamManage(); //BAExamManage _baexmmng = new BAExamManage(); //_boexmnge.ExamCodeId = _boexammanage.ExamCodeId; //_boexmnge.OnlyTestOnce = false; //_boexmnge.UpdatedBy = _bouserDetail.UserId; //_boexmnge.UpdatedDate = DateTime.UtcNow; //_boexmnge.Event = "UpdateByUser"; //_baexmmng.IUD(_boexmnge); ///6June2018 New table for TestOnce permission BOAssignExamUser _boaeu = new BOAssignExamUser(); BAAssignExamUser _baaeu = new BAAssignExamUser(); _boaeu.ExamId = _boexammanage.ExamCodeId; _boaeu.UserId = _bouserDetail.UserId; _boaeu.TestOnce = false; _boaeu.UpdatedBy = _bouserDetail.UserId; _boaeu.UpdatedDate = DateTime.UtcNow; _boaeu.Event = "UpdateByUser"; _baaeu.IUD(_boaeu); }
public List <BOExamManage> SelectMerchantExamDetail(BOExamManage _boexmmng) { return(_daexmmng.SelectMerchantExam(_boexmmng)); }
internal int IUD(BOExamManage _boexammanage) { return(_daexmange.IUD(_boexammanage)); }
public int Update(BOExamManage _boexmmng) { return(_daexmmng.IUD_ExamManage(_boexmmng)); }
public List <BOExamManage> SelectExamManageList(BOExamManage _boexmmng) { return(_daexmmng.SelectExamManageList(_boexmmng)); }
internal int Delete(BOExamManage _boexmmng) { return(_daexmmng.IUD(_boexmmng)); }
internal int Insert(BOExamManage _boexmmng) { return(_daexmmng.IUD(_boexmmng)); }