public bool AlterarResposta(TRespostaDOMINIO dadosResposta)
        {
            try
            {
                StringBuilder queryTabelaResposta = new StringBuilder();

                queryTabelaResposta.Append(@" UPDATE TResposta SET                                           ");
                queryTabelaResposta.Append(@"     CodigoOpcao = " + dadosResposta.CodigoOpcao + "            ");
                queryTabelaResposta.Append(@"   , CodigoSeqResposta = " + dadosResposta.CodigoSeqPergunta + " ");
                queryTabelaResposta.Append(@"   , TextoResposta = '" + dadosResposta.TextoResposta + "'      ");
                queryTabelaResposta.Append(@"   , TextoSubResposta = '" + dadosResposta.TextoSubResposta + "'");

                queryTabelaResposta.Append(@"  WHERE CodigoEntrevista = " + dadosResposta.CodigoEntrevista);
                queryTabelaResposta.Append(@"  AND   CodigoPergunta = " + dadosResposta.CodigoPergunta);


                using (SqlCeConnection conn = new SqlCeConnection(ConnectionString))
                {
                    conn.Open();

                    SqlCeCommand command = new SqlCeCommand(queryTabelaResposta.ToString(), conn);
                    command.ExecuteNonQuery();
                }

                return(true);
            }
            catch (Exception ex)
            {
                Util.LogErro.GravaLog("Alterar registro TResposta", ex.Message);
                return(false);
            }
        }
Beispiel #2
0
        private void MapearCamposTResposta()
        {
            try
            {
                if (Program.CodigoEntrevista > 0)
                {
                    DadosTResposta.Clear();

                    int    idABA1       = 0;
                    string respostaABA1 = string.Empty;

                    VerficaABA1(ref idABA1, ref respostaABA1);

                    TRespostaDOMINIO dadosFeedBack1 = new TRespostaDOMINIO();
                    dadosFeedBack1.CodigoEntrevista = Program.CodigoEntrevista;
                    dadosFeedBack1.CodigoPergunta   = (int)CodigoPergunta.FEEDBACKABA1;
                    dadosFeedBack1.CodigoOpcao      = idABA1;
                    dadosFeedBack1.TextoResposta    = respostaABA1;

                    DadosTResposta.Add(dadosFeedBack1);

                    int    idABA5SUB2            = 0;
                    string respostaABA5SUB2      = string.Empty;
                    int    idABA5SUB2Opcao       = 0;
                    string respostaABA5SUB2Opcao = string.Empty;

                    VerficaABA2(ref idABA5SUB2, ref respostaABA5SUB2, ref idABA5SUB2Opcao, ref respostaABA5SUB2Opcao);

                    TRespostaDOMINIO dadosFeedBack2 = new TRespostaDOMINIO();
                    dadosFeedBack2.CodigoEntrevista  = Program.CodigoEntrevista;
                    dadosFeedBack2.CodigoPergunta    = (int)CodigoPergunta.FEEDBACKABA2;
                    dadosFeedBack2.CodigoOpcao       = idABA5SUB2;
                    dadosFeedBack2.TextoResposta     = respostaABA5SUB2;
                    dadosFeedBack2.CodigoSeqPergunta = idABA5SUB2Opcao;
                    dadosFeedBack2.TextoSubResposta  = respostaABA5SUB2Opcao;

                    DadosTResposta.Add(dadosFeedBack2);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public bool IncluirResposta(TRespostaDOMINIO dadosResposta)
        {
            try
            {
                StringBuilder queryTabelaResposta = new StringBuilder();

                queryTabelaResposta.Append(@" INSERT INTO TResposta                                         ");
                queryTabelaResposta.Append(@"     (  CodigoEntrevista                                       ");
                queryTabelaResposta.Append(@"     ,  CodigoPergunta                                         ");
                queryTabelaResposta.Append(@"     ,  CodigoOpcao                                            ");
                queryTabelaResposta.Append(@"     ,  CodigoSeqResposta                                      ");
                queryTabelaResposta.Append(@"     ,  TextoResposta                                          ");
                queryTabelaResposta.Append(@"     ,  TextoSubResposta    )                                  ");
                queryTabelaResposta.Append(@"     VALUES  ( " + dadosResposta.CodigoEntrevista + "          ");
                queryTabelaResposta.Append(@"             , " + dadosResposta.CodigoPergunta + "            ");
                queryTabelaResposta.Append(@"             , " + dadosResposta.CodigoOpcao + "               ");
                queryTabelaResposta.Append(@"             , " + dadosResposta.CodigoSeqPergunta + "         ");
                queryTabelaResposta.Append(@"             , '" + dadosResposta.TextoResposta + "'           ");
                queryTabelaResposta.Append(@"             , '" + dadosResposta.TextoSubResposta + "' )      ");

                using (SqlCeConnection conn = new SqlCeConnection(ConnectionString))
                {
                    conn.Open();

                    SqlCeCommand command = new SqlCeCommand(queryTabelaResposta.ToString(), conn);
                    command.ExecuteNonQuery();
                }

                return(true);
            }
            catch (Exception ex)
            {
                Util.LogErro.GravaLog("Incluir registro TResposta", ex.Message);
                return(false);
            }
        }