예제 #1
0
        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  = "";
            }
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     Questions.DeleteQuestion(int.Parse(question.q_id));
 }
예제 #4
0
 public Questions getQuestion(int index)
 {
     return(Questions.GetQuestions(IdQuestions[index]));
 }