コード例 #1
0
ファイル: QuestionsDao.cs プロジェクト: DevopsRizwan/Home
        public QuestionsEntity Read(int questionID)
        {
            Parameters = new List<SqlParameter>();

            Parameters.Add(new SqlParameter("@QuestionID", questionID));
            QuestionsEntity entity = null;
            SqlDataReader reader = null;
            try
            {
                Parameters.Add(new SqlParameter("@Action", "R"));
                reader = ExecDataReader(DBCommands.Question);
                if (reader.Read())
                {
                    entity = new QuestionsEntity();
                    entity.Sno = reader["Sno"].ToInt32();
                    entity.Question = reader["Question"].ToStr();
                    entity.AnswerType = reader["AnswerType"].ToStr();

                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }

            return entity;
        }
コード例 #2
0
ファイル: QuestionsDao.cs プロジェクト: DevopsRizwan/Home
 public void InsertQuestion(QuestionsEntity entity)
 {
     Parameters = new List<SqlParameter>();
     Parameters.Add(new SqlParameter("@QuestionID", entity.QuestionID));
     Parameters.Add(new SqlParameter("@Sno", entity.Sno));
     Parameters.Add(new SqlParameter("@Question", entity.Question));
     Parameters.Add(new SqlParameter("@AnswerType", entity.AnswerType));
     if (entity.QuestionID == 0)
     {
         Parameters.Add(new SqlParameter("@Action", "C"));
         ExecCommand(DBCommands.Question);
     }
     else
     {
         Parameters.Add(new SqlParameter("@Action", "U"));
         ExecCommand(DBCommands.Question);
     }
 }
コード例 #3
0
ファイル: QuestionsBI.cs プロジェクト: DevopsRizwan/Home
 public void InsertQuestion(QuestionsEntity entity)
 {
     QuestionsDao questionsDao = new QuestionsDao();
     questionsDao.InsertQuestion(entity);
 }
コード例 #4
0
ファイル: QuestionsDao.cs プロジェクト: DevopsRizwan/Home
        public List<QuestionsEntity> ReadList()
        {
            List<QuestionsEntity> list = new List<QuestionsEntity>();
            Parameters = new List<SqlParameter>();
            SqlDataReader reader = null;
            try
            {
                Parameters.Add(new SqlParameter("@Action", "RL"));
                reader = ExecDataReader(DBCommands.Question);
                while (reader.Read())
                {
                    QuestionsEntity entity = new QuestionsEntity();
                    entity.QuestionID = reader["QuestionID"].ToInt32();
                    entity.Sno = reader["Sno"].ToInt32();
                    entity.Question = reader["Question"].ToStr();
                    entity.AnswerType = reader["AnswerType"].ToStr();
                    list.Add(entity);
                }

            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                    reader.Dispose();
                }
            }
            return list;
        }
コード例 #5
0
ファイル: Questions.aspx.cs プロジェクト: DevopsRizwan/Home
        private void SaveQuestion()
        {
            QuestionsEntity entity = new QuestionsEntity();
            if (SessionManager.QuestionID != null)
            {
                entity.QuestionID = SessionManager.QuestionID;
            }
            entity.Sno = Convert.ToInt32(txtSrNo.Text);
            entity.Question = txtQuestion.Text;
            entity.AnswerType = rdoAnswerType.SelectedValue;

            QuestionsBI questionsBI = new QuestionsBI();
            questionsBI.InsertQuestion(entity);

            //txtSrNo.Text = entity.Sno;
            //txtQuestion = entity.Question;
            //rdoAnswerType.SelectedValue = entity.
        }