当前位置: 首页>>代码示例>>C#>>正文


C# DbHelper.AddParameter方法代码示例

本文整理汇总了C#中DbHelper.AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C# DbHelper.AddParameter方法的具体用法?C# DbHelper.AddParameter怎么用?C# DbHelper.AddParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DbHelper的用法示例。


在下文中一共展示了DbHelper.AddParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ObterItemAESPorNumeroAES

        public List<DadosAES> ObterItemAESPorNumeroAES(string numeroAES)
        {
            List<DadosAES> listaAES = new List<DadosAES>();

            DbHelper db = new DbHelper();

            string cmdText = @"select b.Numero_AES, b.Item_AES
                                 from Frequencia4Edicao a, [dbo].[vw_mantida_curso_turma]  b
                                where 1=1
                                  and a.idCursoTurnoTurma = b.idCursoTurnoTurma
                                  and b.Numero_AES = @Numero_AES
                             group by b.Numero_AES, b.Item_AES
                             order by 2";

            db.AddParameter(new System.Data.SqlClient.SqlParameter("@Numero_AES", numeroAES));

            SqlDataReader dr = db.GetDataReader(cmdText);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    listaAES.Add(new DadosAES
                    {
                        NumeroAES = dr["Numero_AES"].ToString(),
                        ItemAES = Convert.ToInt32(dr["Item_AES"])
                    });

                }
            }

            db.CloseDbConnection();

            return listaAES;
        }
开发者ID:felipeviola,项目名称:vence4edicao,代码行数:35,代码来源:RelatAcompMensalController.cs

示例2: ObterListagemObjetos

        public List<VwAcompMensal> ObterListagemObjetos(string numeroAES, int itemAES)
        {
            var acompList = new List<VwAcompMensal>();
            DbHelper db = new DbHelper();

            db.AddParameter(new System.Data.SqlClient.SqlParameter("@numeroAES", numeroAES));
            db.AddParameter(new System.Data.SqlClient.SqlParameter("@itemAES", itemAES));

            string cmdText = @"select b.Numero_AES, b.Item_AES, count(distinct idMatricula) qtdAlunos, a.MesReferencia
                                 from Frequencia4Edicao a, [dbo].[vw_mantida_curso_turma]  b
                                where 1=1
                                  and a.idCursoTurnoTurma = b.idCursoTurnoTurma
                                  and b.Numero_AES = @numeroAES
                                  and b.Item_AES   = @itemAES
                                  --and staPLCV = 'P'
                             group by b.Numero_AES, b.Item_AES, a.MesReferencia
                             order by 1,2";

            SqlDataReader dr = db.GetDataReader(cmdText);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    acompList.Add(new VwAcompMensal
                    {
                        NumeroAES = dr["Numero_AES"].ToString(),
                        ItemAES = Convert.ToInt32(dr["Item_AES"]),
                        QtdAlunos = Convert.ToInt32(dr["qtdAlunos"]),
                        MesReferencia = dr["MesReferencia"].ToString()
                    });
                }
            }

            db.CloseDbConnection();

            return acompList;
        }
开发者ID:felipeviola,项目名称:vence4edicao,代码行数:38,代码来源:RelatAcompMensalController.cs

示例3: ObterAES

        private List<DadosAES> ObterAES(int codDe, bool somentePlanoContigencia)
        {
            var lista = new List<DadosAES>();
            DbHelper db = new DbHelper();

            db.AddParameter(new System.Data.SqlClient.SqlParameter("@codDe", codDe));

            string cmdText = string.Format(@"SELECT wmc.Cod_DE,
                                                    mant.edicao,
                                                    mant.NM_Credenciamento,
                                                    mant.Numero_AES,
                                                    mant.Mantida,
                                                    dt.Diretoria,
                                                    mant.Item_AES,
                                                    mant.Cod_Mantida,
                                                    format(parc.mesInicial,'MM/yyyy') as mes_ref,
                                                    parc.tipoparcela,
                                                    CASE parc.tipoparcela
                                                      WHEN 'F' THEN 'SIM' ELSE 'NÃO'
                                                    END AS PARCELA_FINAL,
                                                    parc.staPLCV
                                              from [dbo].vw_mantida           mant,
                                                   [VENCE].[dbo].[MtdParcela] parc,
                                                   [dbo].[vw_mantida_curso]   wmc,
                                                   DiretoriaTokenContigencia  dt
                                             where {0}
                                               and wmc.cod_de         = @codDe
                                               and wmc.Cod_DE         = dt.CD_DE
                                               and wmc.Cod_Mantida    = mant.Cod_Mantida
                                               and mant.idContratoMtd = PARC.idContratoMtd
                                          group by wmc.Cod_DE,
                                                   mant.edicao,
                                                   mant.NM_Credenciamento,
                                                   mant.Numero_AES,
                                                   mant.Mantida,
                                                   dt.Diretoria,
                                                   mant.Item_AES,
                                                   mant.Cod_Mantida,
                                                   parc.staPLCV,
                                                   parc.mesInicial,
                                                   parc.tipoparcela
                                          order by mant.Cod_Mantida,
              	                                           mant.Item_AES,
                                                   parc.mesInicial", (somentePlanoContigencia == true ? "parc.staPLCV is not null" : "1=1"));

            SqlDataReader dr = db.GetDataReader(cmdText);

            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    lista.Add(new DadosAES
                    {
                        CodMantida = Convert.ToInt32(dr["Cod_Mantida"]),
                        Mantida = dr["Mantida"].ToString(),
                        CodDE = dr["Cod_DE"] != DBNull.Value ? Convert.ToInt32(dr["Cod_DE"]) : 0,
                        NumeroAES = dr["Numero_AES"].ToString(),
                        Diretoria = dr["Diretoria"].ToString(),
                        ItemAES = Convert.ToInt32(dr["Item_AES"]),
                        MesReferencia = dr["mes_ref"].ToString(),
                        TipoParcela = dr["tipoparcela"].ToString(),
                        EhParcelaFinal = dr["PARCELA_FINAL"].ToString(),
                        staPLCV = dr["Cod_DE"] != DBNull.Value ? dr["staPLCV"].ToString() : ""
                    });
                }
            }

            db.CloseDbConnection();

            return lista;
        }
开发者ID:felipeviola,项目名称:vence4edicao,代码行数:71,代码来源:RelatParcelaFinalController.cs

示例4: ObterDeApartirDoToken

 private int ObterDeApartirDoToken(string chave)
 {
     DbHelper db = new DbHelper();
     db.AddParameter(new System.Data.SqlClient.SqlParameter("@chave", chave));
     string cmdText = "select cd_de from [dbo].[DiretoriaTokenContigencia] where token = @chave";
     int codDe = db.GetExecuteScalar<int>(cmdText);
     db.CloseDbConnection();
     return codDe;
 }
开发者ID:felipeviola,项目名称:vence4edicao,代码行数:9,代码来源:RelatParcelaFinalController.cs


注:本文中的DbHelper.AddParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。