public static Question LoadById(Guid id) { try { using (SurveyEntities dc = new SurveyEntities()) { tblQuestion row = dc.tblQuestions.FirstOrDefault(q => q.Id == id); Question question = new Question { Id = row.Id, Text = row.Question }; List <Activation> activations = ActivationManager.Load(); question.Activator = activations.FirstOrDefault(a => a.QuestionId == question.Id); if (row != null) { question.Answers = AnswerManager.Load(row.Id); } return(question); } } catch (Exception ex) { throw ex; } }
public int UpdateQuestion() { try { using (SurveyEntities dc = new SurveyEntities()) { //If the Id is set, get the result in the table where it matches if (this.Id != Guid.Empty) { tblQuestion question = dc.tblQuestions.Where(q => q.Id == this.Id).FirstOrDefault(); //If q row was retrieved, change if (question != null) { question.Text = this.Text; return(dc.SaveChanges()); } else { throw new Exception("Could not find Question row with this ID"); } } else { throw new Exception("Id not set on Question"); } } } catch (Exception ex) { throw ex; } }
public static int Insert(Question question, bool rollback = false) { try { using (SurveyEntities dc = new SurveyEntities()) { DbContextTransaction transaction = null; if (rollback) { transaction = dc.Database.BeginTransaction(); } tblQuestion newrow = new tblQuestion() { Id = Guid.NewGuid(), Question = question.Text, }; dc.tblQuestions.Add(newrow); question.Id = newrow.Id; if (rollback) { transaction.Rollback(); } return(dc.SaveChanges()); } } catch (Exception ex) { throw ex; } }
public int InsertQuestion() { int result = 0; try { using (SurveyEntities dc = new SurveyEntities()) { //Question new question and set properties tblQuestion question = new tblQuestion(); question.Id = Guid.NewGuid(); question.Text = this.Text; this.Id = question.Id; //Add question to the table dc.tblQuestions.Add(question); //Commit the changes result = dc.SaveChanges(); return(result); } } catch (Exception ex) { throw ex; } }
protected void btn_Click(object sender, EventArgs e) { string id = ((Control)sender).ID; int question_id = 0; switch (id) { case "btn_check": int exist_indicator = BusinessLayer.Check_Username_Existence(txt_forgot_password.Text); if (exist_indicator == 0) { question_id = LoadQuestions(txt_forgot_password.Text); pnl_email.Visible = false; pnl_question.Visible = true; pnl_confirm.Visible = false; } else { StringBuilder sb = new StringBuilder(); sb.Append("<p class='error bold'>Your account does not exist. Please check email address again.</p>"); lit_error.Text = sb.ToString(); } break; case "btn_submit": tblQuestion q = ModelLayer.GetQuestion(question_id); tblQuestionAnswer a = ModelLayer.GetQuestionAnswer(q.iQuestionAnswer); if (a.vQuestionAnswer == txt_question_answer.Text) { string result = SendEmail(txt_forgot_password.Text); if (result == "Success") { pnl_email.Visible = false; pnl_question.Visible = false; pnl_confirm.Visible = true; } else { Common.ErrorLog(@"c:\logs\debug.txt", result); } } else { StringBuilder sb = new StringBuilder(); sb.Append("<p class='error bold'>Your security question answer does not match with our records. Please check your answer again.</p>"); lit_error.Text = sb.ToString(); } break; case "btn_confirm": Response.RedirectToRoute("Login"); break; default: break; } }
public static int Delete(Guid id, bool rollback = false) { try { using (SurveyEntities dc = new SurveyEntities()) { DbContextTransaction transaction = null; if (rollback) { transaction = dc.Database.BeginTransaction(); } tblQuestion updaterow = dc.tblQuestions.FirstOrDefault(q => q.Id == id); if (updaterow != null) { dc.tblQuestions.Remove(updaterow); } else { throw new Exception("Row was not found"); } if (rollback) { transaction.Rollback(); } return(dc.SaveChanges()); } } catch (Exception ex) { throw ex; } }
public void DeleteTest() { using (SurveyEntities dc = new SurveyEntities()) { tblQuestion row = dc.tblQuestions.FirstOrDefault(a => a.Question == "???"); dc.tblQuestions.Remove(row); Assert.AreEqual(1, dc.SaveChanges()); } }
public void AddForumQuestion(String Question, int UserID) { var DC = new DataClassesDataContext(); tblQuestion question = new tblQuestion(); question.Question = Question; question.CreatedBy = UserID; question.CreatedOn = DateTime.Now; DC.tblQuestions.InsertOnSubmit(question); DC.SubmitChanges(); }
protected void grvQuestion_RowCommand(object sender, GridViewCommandEventArgs e) { questionID = int.Parse(e.CommandArgument.ToString()); TestOnlineDataContext db = new TestOnlineDataContext(); //Xóa 1 hàng trong gridview if (e.CommandName == "Delete") { tblQuestion doc = db.tblQuestions.SingleOrDefault(d => d.QuestionsID.ToString().Trim() == e.CommandArgument.ToString().Trim()); if (doc != null) { db.tblQuestions.DeleteOnSubmit(doc); db.SubmitChanges(); LoadGrid(); lblThongBao.Visible = true; lblThongBao.Text = "Bạn đã xóa thành công"; Refres(); } } // Chọn hàng muốn sửa if (e.CommandName == "Edit") { tblQuestion doc = db.tblQuestions.SingleOrDefault(d => d.QuestionsID.ToString().Trim() == e.CommandArgument.ToString().Trim()); if (doc != null) { txtContent.Text = doc.Content; txtA.Text = doc.ChocieA; txtB.Text = doc.ChocieB; txtC.Text = doc.ChocieC; txtD.Text = doc.ChocieD; ddlSubject.SelectedValue = doc.SubjectID; ddlLevel.Text = doc.Level.ToString(); if (doc.ChocieA.Trim().ToLower() == doc.Answer.Trim().ToLower()) { ddlAnswer.Text = "A"; } if (doc.ChocieB.Trim().ToLower() == doc.Answer.Trim().ToLower()) { ddlAnswer.Text = "B"; } if (doc.ChocieC.Trim().ToLower() == doc.Answer.Trim().ToLower()) { ddlAnswer.Text = "C"; } if (doc.ChocieD.Trim().ToLower() == doc.Answer.Trim().ToLower()) { ddlAnswer.Text = "D"; } btnCreate.Enabled = false; btnEdit1.Enabled = true; lblThongBao.Text = ""; } } }
public void SaveQuestion(tblQuestion Question) { if (Question.QuestionId == 0) { db.tblQuestions.Add(Question); } else { db.Entry(Question).State = EntityState.Modified; } db.SaveChanges(); }
public void UpdateTest() { using (SurveyEntities dc = new SurveyEntities()) { tblQuestion row = dc.tblQuestions.FirstOrDefault(a => a.Question == "???"); if (row != null) { row.Question = "Hero"; } Assert.AreEqual(1, dc.SaveChanges()); } }
/// <summary> /// Kiểm tra xem câu hỏi này đã tồn tại chưa /// </summary> /// <param name="code"></param> /// <returns></returns> bool TestQuestionCode(string code) { TestOnlineDataContext db = new TestOnlineDataContext(); tblQuestion tbl = db.tblQuestions.SingleOrDefault(c => c.Content.Trim().ToLower() == code.ToLower()); if (tbl != null) { return(true); } else { return(false); } }
public void DeleteTest() { using (SurveyEntities dc = new SurveyEntities()) { tblQuestion question = dc.tblQuestions.FirstOrDefault(q => q.Text == "UpdatedTestQuestion"); dc.tblQuestions.Remove(question); dc.SaveChanges(); tblQuestion retrievedQuestion = dc.tblQuestions.FirstOrDefault(q => q.Text == "UpdatedTestQuestion"); Assert.IsNull(retrievedQuestion); } }
public int DeleteQuestion() { try { using (SurveyEntities dc = new SurveyEntities()) { //If the Id is set, get the result in the table where it matches if (this.Id != Guid.Empty) { tblQuestion question = dc.tblQuestions.Where(q => q.Id == this.Id).FirstOrDefault(); //If q row was retrieved, change if (question != null) { dc.tblQuestions.Remove(question); //Make sure to retrieve any rows from the questionAnswerstable with this questionID and delete them as well /*var questionAnswers = dc.tblQuestionAnswers.Where(qa => qa.QuestionId == this.Id); * foreach (tblQuestionAnswer qa in questionAnswers) * { * dc.tblQuestionAnswers.Remove(qa); * } */ //Use stored procedure to retrieve rows from the questionAnswers table with the questionId and delete them dc.spDeleteQAWithQuestion(question.Id); return(dc.SaveChanges()); } else { throw new Exception("Could not find Question row with this ID"); } } else { throw new Exception("Id not set on Question"); } } } catch (Exception ex) { throw ex; } }
protected void btnCreateNews_Click(object sender, EventArgs e) { if (txtD.Text == "" || txtContent.Text == "" || txtC.Text == "" || txtB.Text == "" || txtA.Text == "" || ddlAnswer.SelectedIndex == 0 || ddlLevel.SelectedIndex == 0 || ddlSubject.SelectedIndex == (ddlSubject.Items.Count - 1)) { lblThongBao.Text = "Bạn chưa nhập đủ thông tin"; lblThongBao.Visible = true; } else { if (TestQuestionCode(txtContent.Text) == false) { tblQuestion tbl = new tblQuestion(); tbl.Content = txtContent.Text; tbl.ChocieA = txtA.Text; tbl.ChocieB = txtB.Text; tbl.ChocieC = txtC.Text; tbl.ChocieD = txtD.Text; if (ddlAnswer.SelectedIndex == 1) { tbl.Answer = txtA.Text; } if (ddlAnswer.SelectedIndex == 2) { tbl.Answer = txtB.Text; } if (ddlAnswer.SelectedIndex == 3) { tbl.Answer = txtC.Text; } if (ddlAnswer.SelectedIndex == 4) { tbl.Answer = txtD.Text; } tbl.SubjectID = ddlSubject.SelectedValue.Trim().ToString(); tbl.Level = int.Parse(ddlLevel.Text); db.tblQuestions.InsertOnSubmit(tbl); db.SubmitChanges(); LoadGrid(); lblThongBao.Text = "Bạn đã nhập thành công"; lblThongBao.Visible = true; } else { lblThongBao.Text = "Câu hỏi này đã tồn tại"; } } }
public void InsertTest() { using (SurveyEntities dc = new SurveyEntities()) { tblQuestion question = new tblQuestion(); question.Id = Guid.NewGuid(); question.Text = "TestQuestion"; dc.tblQuestions.Add(question); dc.SaveChanges(); tblQuestion retrievedQuestion = dc.tblQuestions.FirstOrDefault(q => q.Text == "TestQuestion"); Assert.AreEqual(question.Id, retrievedQuestion.Id); } }
public void DeleteTest() { using (SurveyEntities dc = new SurveyEntities()) { //get a question and answer tblAnswer answer = dc.tblAnswers.FirstOrDefault(a => a.Text == "Michael Scott"); tblQuestion question = dc.tblQuestions.FirstOrDefault(r => r.Text == "Who sprouts mung beans in their desk drawers?"); tblResponse response = dc.tblResponses.FirstOrDefault(r => (r.AnswerId == answer.Id) && (r.QuestionId == question.Id)); dc.tblResponses.Remove(response); int results = dc.SaveChanges(); Assert.IsTrue(results > 0); } }
private int LoadQuestions(string email) { int question_id = 0; tblQuestion q = BusinessLayer.Forgot_Password_Questions(); question_id = q.iQuestion; StringBuilder sb = new StringBuilder(); sb.Append("<label class='f_1 bold lh_1 clear'>"); sb.Append(q.iQuestionIndex + ". " + q.vQuestion + "?"); sb.Append("</label>"); lit_question.Text = sb.ToString(); return(question_id); }
public void DeleteTest() { using (SurveyEntities dc = new SurveyEntities()) { //get a question and answer tblAnswer answer = dc.tblAnswers.FirstOrDefault(a => a.Text == "Kelly Kapoor"); tblQuestion question = dc.tblQuestions.FirstOrDefault(q => q.Text == "Who sprouts mung beans in their desk drawers?"); tblQuestionAnswer questionAnswer = dc.tblQuestionAnswers.FirstOrDefault(q => (q.AnswerId == answer.Id) && (q.QuestionId == question.Id)); dc.tblQuestionAnswers.Remove(questionAnswer); int results = dc.SaveChanges(); Assert.IsTrue(results > 0); } }
protected void btnEdit1_Click(object sender, EventArgs e) { if (txtD.Text == "" || txtContent.Text == "" || txtC.Text == "" || txtB.Text == "" || txtA.Text == "" || ddlAnswer.SelectedIndex == 0 || ddlLevel.SelectedIndex == 0 || ddlSubject.Text.Trim() == "") { lblThongBao.Text = "Bạn chưa nhập đủ thông tin"; lblThongBao.Visible = true; } else { tblQuestion tbl = db.tblQuestions.SingleOrDefault(c => c.QuestionsID == questionID); if (tbl != null) { tbl.Content = txtContent.Text; tbl.ChocieA = txtA.Text; tbl.ChocieB = txtB.Text; tbl.ChocieC = txtC.Text; tbl.ChocieD = txtD.Text; if (ddlAnswer.SelectedIndex == 1) { tbl.Answer = txtA.Text; } if (ddlAnswer.SelectedIndex == 2) { tbl.Answer = txtB.Text; } if (ddlAnswer.SelectedIndex == 3) { tbl.Answer = txtC.Text; } if (ddlAnswer.SelectedIndex == 4) { tbl.Answer = txtD.Text; } tbl.SubjectID = ddlSubject.SelectedValue.Trim().ToString(); tbl.Level = int.Parse(ddlLevel.Text.Trim()); db.SubmitChanges(); LoadGrid(); lblThongBao.Text = "Bạn sửa thành công"; lblThongBao.Visible = true; btnEdit1.Enabled = true; btnCreate.Enabled = false; } } }
public void InsertTest() { using (SurveyEntities dc = new SurveyEntities()) { //get a question and answer tblAnswer answer = dc.tblAnswers.FirstOrDefault(a => a.Text == "Kelly Kapoor"); tblQuestion question = dc.tblQuestions.FirstOrDefault(r => r.Text == "Who sprouts mung beans in their desk drawers?"); //set properties tblResponse response = new tblResponse(); response.Id = Guid.NewGuid(); response.QuestionId = question.Id; response.AnswerId = answer.Id; dc.tblResponses.Add(response); int results = dc.SaveChanges(); Assert.IsTrue(results > 0); } }
public static tblQuestion Forgot_Password_Questions() { tblQuestion q = new tblQuestion(); int question_set_type = 0; List <int> q_ids = new List <int>(); tblQuestionSet qs = ModelLayer.GetQuestionSet(0, question_set_type); List <tblQuestion> questions = ModelLayer.GetQuestions(qs.iQuestionSet); foreach (tblQuestion question in questions) { q_ids.Add(question.iQuestion); } Random ranNum = new Random(); int question_id = q_ids[ranNum.Next(q_ids.Count)]; q = ModelLayer.GetQuestion(question_id); return(q); }
/// <summary> /// Xóa nhiều hàng theo lựa chọn trên gridview /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDeleteAll_Click(object sender, EventArgs e) { int record = 0; TestOnlineDataContext db = new TestOnlineDataContext(); foreach (GridViewRow row in grvQuestion.Rows) { CheckBox chk = (CheckBox)row.FindControl("chkSelect"); if (chk != null) { if (chk.Checked) { LinkButton link = (LinkButton)row.FindControl("btnSua"); tblQuestion at = db.tblQuestions.SingleOrDefault(c => c.QuestionsID.ToString() == link.CommandArgument.ToString()); if (at != null) { // delete file when xoa db.tblQuestions.DeleteOnSubmit(at); db.SubmitChanges(); record++; } } } } if (record > 0) { LoadGrid(); // when will announciment lblThongBao.Text = "Bạn vừa xóa thành công " + record.ToString() + " bản ghi!"; lblThongBao.Visible = true; } else { lblThongBao.Text = "Không có bản ghi nào được chọn !"; lblThongBao.Visible = true; } btnEdit1.Enabled = false; }
public void LoadQuestionById() { try { using (SurveyEntities dc = new SurveyEntities()) { //If the Id is set, get the result in the table where it matches if (this.Id != Guid.Empty) { tblQuestion question = dc.tblQuestions.FirstOrDefault(q => q.Id == this.Id); //If q row was retrieved, change if (question != null) { this.Id = question.Id; this.Text = question.Text; //Load the answers this.LoadAnswers(); } else { throw new Exception("Could not find Question row with this ID"); } } else { throw new Exception("Id not set on Question"); } } } catch (Exception ex) { throw ex; } }
protected void btnEdit1_Click(object sender, EventArgs e) { if (txtMaxScores.Text == "" || txtThreadID.Text == "" || txtThreadName.Text == "" || ddlSubject.SelectedIndex == (ddlSubject.Items.Count - 1)) { lblThongBao.Text = "Bạn chưa nhập đầy đủ thông tin"; lblThongBao.Visible = true; } else { if (cls.KtraNumberFloat(txtMaxScores.Text) == true) { if (fulFile.HasFile) { #region Tạo đề thi tblThread th = db.tblThreads.SingleOrDefault(c => c.ThreadsID == txtThreadID.Text); if (th != null) { UploadFile(fulFile); th.SubjectID = ddlSubject.SelectedValue.ToString().Trim(); th.TheadName = txtThreadName.Text; th.ThreadsID = txtThreadID.Text; th.MaxScores = float.Parse(txtMaxScores.Text); th.Status = 4; //tbl.DateTest = DateTime.Parse(date); th.CreateDate = DateTime.Now; db.SubmitChanges(); lblThongBao.Text = "Bạn đã sửa thành công"; lblThongBao.Visible = true; LoadGrid(); txtThreadID.Text = sinhmatudong(); #endregion #region lấy dữ liệu từ excel vào Gridview // OpenFileDialog openFi = new OpenFileDialog(); // fulFile.filt.Filter = "Kiểu file: (*.xls)|*.xls"; ex.Application excelObj = new Microsoft.Office.Interop.Excel.Application(); // if (openFi.ShowDialog() == DialogResult.OK) // { ex.Workbook myWorkBook = excelObj.Workbooks.Open(Server.MapPath(@"/FileUpload/Question/" + fulFile.FileName), 0, true, 5, "", "", true, ex.XlPlatform.xlWindows, "\t", false, false, 0, true, 0, 0); ex.Sheets sheets = myWorkBook.Worksheets; ex.Worksheet worksheet = (ex.Worksheet)sheets.get_Item(1); object rowIndex = 7; int index = 0; int count = 7; while (((ex.Range)worksheet.Cells[rowIndex, 2]).Value2 != null) { if (Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 1]).Value2) != null && ((Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 3]).Value2) != null))) { string subjectCode = Convert.ToString(((ex.Range)worksheet.Cells[2, 2]).Value2); string content = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 2]).Value2); string daA = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 3]).Value2); string daB = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 4]).Value2); string daC = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 5]).Value2); string daD = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 6]).Value2); string answer = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 7]).Value2); string level = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 8]).Value2); if (ddlSubject.SelectedValue.ToString().ToLower().Trim() == subjectCode.ToLower().Trim()) { if (TestQuestionCode(content) == false) { tblQuestion tbl = new tblQuestion(); tbl.Content = content; tbl.ChocieA = daA; tbl.ChocieB = daB; tbl.ChocieC = daC; tbl.ChocieD = daD; if (answer.Trim().ToLower() == "a") { tbl.Answer = daA; } if (answer.Trim().ToLower() == "b") { tbl.Answer = daB; } if (answer.Trim().ToLower() == "c") { tbl.Answer = daC; } if (answer.Trim().ToLower() == "d") { tbl.Answer = daD; } tbl.SubjectID = subjectCode; tbl.Level = int.Parse(level); db.tblQuestions.InsertOnSubmit(tbl); db.SubmitChanges(); if (TestCodeThreadQuestion(th.ThreadsID, tbl.QuestionsID.ToString()) == false) { tblThreadQuestion thq = new tblThreadQuestion(); thq.QuestionsID = tbl.QuestionsID; thq.ThreadsID = th.ThreadsID; db.tblThreadQuestions.InsertOnSubmit(thq); db.SubmitChanges(); } } else { tblQuestion tbQuestion = db.tblQuestions.SingleOrDefault(c => c.Content.Trim().ToLower() == content.ToLower()); if (tbQuestion != null) { if (TestCodeThreadQuestion(th.ThreadsID, tbQuestion.QuestionsID.ToString()) == false) { tblThreadQuestion thq = new tblThreadQuestion(); thq.QuestionsID = tbQuestion.QuestionsID; thq.ThreadsID = th.ThreadsID; db.tblThreadQuestions.InsertOnSubmit(thq); db.SubmitChanges(); } } } } else { lblThongBao.Text = "Mã môn học và mã file excel bạn chọn không trùng nhau"; lblThongBao.Visible = true; break; } index++; } rowIndex = ++count; } #endregion } } else { lblThongBao.Text = "Chưa chọn file câu hỏi"; lblThongBao.Visible = true; } } else { lblThongBao.Text = "Tổng điểm bạn phải nhập số"; lblThongBao.Visible = true; } } }
/// <summary> /// Nhập dữ liệu bằng excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnLuu_Click(object sender, EventArgs e) { if (fulFile.HasFile) { UploadFile(fulFile); #region lấy dữ liệu từ excel vào Gridview // OpenFileDialog openFi = new OpenFileDialog(); // fulFile.filt.Filter = "Kiểu file: (*.xls)|*.xls"; ex.Application excelObj = new Microsoft.Office.Interop.Excel.Application(); // if (openFi.ShowDialog() == DialogResult.OK) // { ex.Workbook myWorkBook = excelObj.Workbooks.Open(Server.MapPath(@"/FileUpload/Question/" + fulFile.FileName), 0, true, 5, "", "", true, ex.XlPlatform.xlWindows, "\t", false, false, 0, true, 0, 0); ex.Sheets sheets = myWorkBook.Worksheets; ex.Worksheet worksheet = (ex.Worksheet)sheets.get_Item(1); object rowIndex = 7; int index = 0; int count = 7; while (((ex.Range)worksheet.Cells[rowIndex, 2]).Value2 != null) { if (Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 1]).Value2) != null && ((Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 3]).Value2) != null))) { string subjectCode = Convert.ToString(((ex.Range)worksheet.Cells[2, 2]).Value2); string content = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 2]).Value2); string daA = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 3]).Value2); string daB = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 4]).Value2); string daC = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 5]).Value2); string daD = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 6]).Value2); string answer = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 7]).Value2); string level = Convert.ToString(((ex.Range)worksheet.Cells[rowIndex, 8]).Value2); if (TestCodeSubject(subjectCode) == true) { if (TestQuestionCode(content) == false) { tblQuestion tbl = new tblQuestion(); tbl.Content = content; tbl.ChocieA = daA; tbl.ChocieB = daB; tbl.ChocieC = daC; tbl.ChocieD = daD; if (answer.Trim().ToLower() == "a") { tbl.Answer = daA; } if (answer.Trim().ToLower() == "b") { tbl.Answer = daB; } if (answer.Trim().ToLower() == "c") { tbl.Answer = daC; } if (answer.Trim().ToLower() == "d") { tbl.Answer = daD; } tbl.SubjectID = subjectCode; tbl.Level = int.Parse(level); db.tblQuestions.InsertOnSubmit(tbl); db.SubmitChanges(); } lblThongBao.Text = "Imput thành công"; lblThongBao.Visible = true; } else { lblThongBao.Text = "Không tồn tại mã môn học nhập từ file excel"; lblThongBao.Visible = true; break; } index++; } rowIndex = ++count; } LoadGrid(); #endregion } else { lblThongBao.Text = "Chưa chọn file câu hỏi"; lblThongBao.Visible = true; } }
public static tblQuestion GetQuestion(int iQuestion) { tblQuestion q = new tblQuestion(); return(q); }