public static bool answerCheck(int question_id, string answer) { SoruDBDataContext sorudb = new SoruDBDataContext(); var correnctAnswer = sorudb.dt_questionOS.Where(p => p.id == question_id).Select(p => p.answer).FirstOrDefault(); return(correnctAnswer == answer); }
protected void btn_kaydet_Click(object sender, EventArgs e) { SoruDBDataContext ohamg = new SoruDBDataContext(); var a = ohamg.lu_topicOS; lu_topicOS topik = new lu_topicOS { text = txt_konu.Text }; ohamg.lu_topicOS.InsertOnSubmit(topik); ohamg.SubmitChanges(); //GridView1.DataSource = a; }
public static void saveAnswer(int member_id, int question_id, DateTime date, bool correct, TimeSpan?time) //soru işareti nullable demek oluyor { SoruDBDataContext sorudb = new SoruDBDataContext(); tx_answeredQuestionOS taq = new tx_answeredQuestionOS(); taq.member_id = member_id; taq.question_id = question_id; taq.date = date; taq.correct = correct; taq.time = time; sorudb.tx_answeredQuestionOS.InsertOnSubmit(taq); sorudb.SubmitChanges(); }
protected void kenanİsik(int diff) { SoruDBDataContext x = new SoruDBDataContext(); var complate = (from c in x.tx_answeredQuestionOS where c.member_id == Member_id select c.question_id); DogruSay = 0; var sorular = dbQueries.dif(Member_id, Topic_id, diff); Question_id = (int)sorular.Rows[Iterator][0]; if (!complate.Contains(Question_id)) { if (DogruSay >= 4) { kenanİsik(diff + 1); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { RadioButtonList1.Items.Add(('A').ToString()); RadioButtonList1.Items.Add(('B').ToString()); RadioButtonList1.Items.Add(('C').ToString()); RadioButtonList1.Items.Add(('D').ToString()); RadioButtonList1.Items.Add(('E').ToString()); SoruDBDataContext x = new SoruDBDataContext(); var puan = x.dt_memberTopicOS.Where(p => p.member_id == Member_id && p.topic_id == Topic_id).Select(p => p.puan).FirstOrDefault(); if (puan == null) { sorular = dbQueries.first9Questions(Topic_id); flag = true; DogruSay = 0; Iterator = 0; Question_id = (int)sorular.Rows[Iterator][0]; soruYukle(Question_id); } else { double puan1 = Convert.ToDouble(puan); //dif = 1 var complate = (from c in x.tx_answeredQuestionOS where c.member_id == Member_id select c.question_id); //hangi soruları sordum //abi burda her soruyu tek nasıl sorcam şimdilik olesine bunu yazdım senle bidaha bakak sonra // bıraktığı dif den devam etsin if (puan1 <= (0.6666) && puan1 > 0) { kenanİsik(1); } if (puan1 <= 1.33333 && puan1 > 0.6666) { kenanİsik(2); if (DogruSay < 4) { kenanİsik(1); } } if (puan1 <= 2 && puan1 > 1.3333) { kenanİsik(3); if (DogruSay < 4) { kenanİsik(2); } } } } }