예제 #1
0
 private void userQnAtable_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (add_status == false && update_status == false)
     {
         try
         {
             txtQtitle.Text       = userQnAtable.Rows[userQnAtable.CurrentRow.Index].Cells[1].Value.ToString();
             txtQcontent.Text     = userQnAtable.Rows[userQnAtable.CurrentRow.Index].Cells[2].Value.ToString();
             txtQtitle.ReadOnly   = true;
             txtQcontent.ReadOnly = true;
             qnaIdx = userQnAtable.Rows[userQnAtable.CurrentRow.Index].Cells[4].Value.ToString();
             if (userQnAtable.Rows[userQnAtable.CurrentRow.Index].Cells[3].Value.ToString() == "답변 완료")
             {
                 AdminAnswerDTO adminAnswerDTO = userQADAO.getAnswerInfo(Convert.ToInt32(userQnAtable.Rows[userQnAtable.CurrentRow.Index].Cells[4].Value));
                 txtAnsTitle.Text   = adminAnswerDTO.Ans_title;
                 txtAnsContent.Text = adminAnswerDTO.Ans_content;
                 button7.Visible    = false;
                 button9.Visible    = false;
             }
             else
             {
                 button7.Visible    = true;
                 txtAnsTitle.Text   = "";
                 txtAnsContent.Text = "";
             }
         }
         catch (Exception a)
         {
         }
     }
 }
예제 #2
0
        public AdminAnswerDTO getAnswerInfo(int idx)
        {
            MySqlConnection mySqlConnection = new MySqlConnection(dbInfo);
            AdminAnswerDTO  info            = null;

            try
            {
                mySqlConnection.Open();
                string          sql          = "SELECT * FROM adminanswar WHERE ans_q_idx = " + idx;
                MySqlCommand    mysqlCommand = new MySqlCommand(sql, mySqlConnection);
                MySqlDataReader rdr          = mysqlCommand.ExecuteReader();
                rdr.Read();
                info = new AdminAnswerDTO(
                    Convert.ToInt32(rdr[0]),
                    rdr[1].ToString(),
                    rdr[2].ToString(),
                    rdr[3].ToString()
                    );
                mySqlConnection.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            return(info);
        }