private void btnLogin_Click(object sender, EventArgs e) { if (tbxUserName.Text == "" || tbxSurname.Text == "") { MessageBox.Show("Please fill the gaps..."); } else { User user = new User(); user.Username = tbxUserName.Text; user.Surname = tbxSurname.Text; Questions questions = new Questions(); questions.Show(); db.Users.Add(user); db.SaveChanges(); tbxUserName.Text = ""; tbxSurname.Text = ""; } }
public static Questions GetQuestions(string idQues) { Questions question = new Questions(); try { string query = string.Format("select q_title,isImage from questions where q_id = {0}", idQues); using (SqlDataReader reader = ReturnClass.readerReturn(query)) if (reader.Read()) { question.q_id = idQues; question.q_title = DataReader.GetDataReader(reader, 0) as string; question.isImage = DataReader.getStringBitDb((bool)DataReader.GetDataReader(reader, 1)); } //question.getOption(); return(question); }catch { return(null); } }
private void btnDel_Click(object sender, EventArgs e) { Questions.DeleteQuestion(int.Parse(question.q_id)); }
public Questions getQuestion(int index) { return(Questions.GetQuestions(IdQuestions[index])); }