Example #1
0
 public DataTable FindAnswer(AnswerBO oAnswerBO)
 {
     try
     {
         query = @"SELECT question, answer FROM Answer
                     INNER JOIN Question
                     ON Answer.questionID = Question.questionID
                     INNER JOIN UserDetail
                     ON Answer.userID = UserDetail.userID
                     WHERE DATEADD(D, 0, DATEDIFF(D, 0, date)) = DATEADD(D, 0, DATEDIFF(D, 0, @date))
                     AND Answer.userID = @userID
                     ORDER BY answerID";
         dad = new SqlDataAdapter(query, con);
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         dad.SelectCommand.Parameters.AddWithValue("@userID", oAnswerBO.userID);
         dad.SelectCommand.Parameters.AddWithValue("@date", oAnswerBO.date);
         dt = new DataTable();
         dad.Fill(dt);
         return dt;
     }
     catch
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Example #2
0
    public DataTable SelectAnswer(AnswerBO oAnswerBO)
    {
        try
        {
            return oAnswerDAL.SelectAnswer(oAnswerBO);
        }
        catch
        {
            throw;
        }
        finally
        {

        }
    }
Example #3
0
    public string InsertAnswer(AnswerBO oAnswerBO)
    {
        try
        {
            return oAnswerDAL.InsertAnswer(oAnswerBO);
        }
        catch
        {
            throw;
        }
        finally
        {

        }
    }
Example #4
0
    public DataTable FindAnswer(AnswerBO oAnswerBO)
    {
        try
        {
            return oAnswerDAL.FindAnswer(oAnswerBO);
        }
        catch
        {
            throw;
        }
        finally
        {

        }
    }
Example #5
0
    public void DeleteAnswer(AnswerBO oAnswerBO)
    {
        try
        {
            oAnswerDAL.DeleteAnswer(oAnswerBO);
        }
        catch
        {
            throw;
        }
        finally
        {

        }
    }
Example #6
0
 public void DeleteAnswer(AnswerBO oAnswerBO)
 {
     try
     {
         query = "DELETE FROM Answer WHERE answerID=@answerID";
         cmd = new SqlCommand(query, con);
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd.Parameters.AddWithValue("@answerID", oAnswerBO.answerID);
         cmd.ExecuteNonQuery();
     }
     catch
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Example #7
0
 public string InsertAnswer(AnswerBO oAnswerBO)
 {
     try
     {
         cmd = new SqlCommand("InsertAnswer", con);
         cmd.CommandType = CommandType.StoredProcedure;
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd.Parameters.AddWithValue("@answer", oAnswerBO.answer);
         cmd.Parameters.AddWithValue("@questionID", oAnswerBO.questionID);
         cmd.Parameters.AddWithValue("@userID", oAnswerBO.userID);
         SqlParameter message = cmd.Parameters.Add("@message", SqlDbType.VarChar, 500);
         message.Direction = ParameterDirection.Output;
         cmd.ExecuteNonQuery();
         return message.Value.ToString();
     }
     catch
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Example #8
0
 public void UpdateAnswer(AnswerBO oAnswerBO)
 {
     try
     {
         query = "UPDATE Answer set answer=@answer, date=GETDATE() WHERE answerID=@answerID";
         cmd = new SqlCommand(query, con);
         if (con.State == ConnectionState.Closed)
         {
             con.Open();
         }
         cmd.Parameters.AddWithValue("@answer", oAnswerBO.answer);
         cmd.Parameters.AddWithValue("@answerID", oAnswerBO.answerID);
         cmd.ExecuteNonQuery();
     }
     catch
     {
         throw;
     }
     finally
     {
         con.Close();
     }
 }
Example #9
0
    public void UpdateAnswer(AnswerBO oAnswerBO)
    {
        try
        {
            oAnswerDAL.UpdateAnswer(oAnswerBO);
        }
        catch
        {
            throw;
        }
        finally
        {

        }
    }