예제 #1
0
        public void insertOption(string idQues)
        {
            string queryInsertOption = string.Format("insert into Options values(N'{0}',{1},{2},{3})",
                                                     RgEx.isNullOrEmpty(Contents), RgEx.isNullOrEmpty(idQues), RgEx.isNullOrEmpty(isImages), RgEx.isNullOrEmpty(isCorrect));

            ReturnClass.ExcuteNonQuery(queryInsertOption);
        }
예제 #2
0
        public void InsertQuestion()
        {
            string query = string.Format("insert into questions values (N'{0}','{1}',{2},'{3}',{4},'{5}')",
                                         RgEx.isNullOrEmpty(q_title), RgEx.isNullOrEmpty(q_addeddate), RgEx.isNullOrEmpty(q_fk_ex),
                                         RgEx.isNullOrEmpty(ad_add), RgEx.isNullOrEmpty(isImage), this.explain);

            ReturnClass.ExcuteNonQuery(query, ReturnClass.Status.insert);

            query = string.Format("select top 1 q_id from questions order by q_id desc");
            string id_Ques = ReturnClass.scalarReturn(query);

            options.ForEach
            (
                x => x.insertOption(id_Ques)
            );
        }
예제 #3
0
        public void updateOption()
        {
            if (string.IsNullOrEmpty(this.id))
            {
                insertOption(id_Qus); return;
            }
            if (RgEx.isEmpty(Contents))
            {
                DeleteOption(); return;
            }
            string queryInsertOption = string.Format("update Options set Contents = N'{0}', isImages = {1},isCorrect = {2} where id_Qus = {3} and id ={4}",
                                                     RgEx.isNullOrEmpty(Contents), RgEx.isNullOrEmpty(isImages), RgEx.isNullOrEmpty(isCorrect),
                                                     RgEx.isNullOrEmpty(id_Qus), RgEx.isNullOrEmpty(id));

            ReturnClass.ExcuteNonQuery(queryInsertOption);
        }