コード例 #1
0
ファイル: DAL_instrumento.cs プロジェクト: esnfile/SisMusica
        /// <summary>
        /// Função que faz DELETE na Tabela Instrumentos
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool excluir(MOD_instrumento objEnt)
        {
            try
            {
                //Varivel boleana que retorna se foi executado ou não no Banco
                //Tabela Instrumentos
                bool blnRetorno = true;
                //Declara a lista de parametros da tabela
                List <SqlParameter> objParam = new List <SqlParameter>();
                //parametros da tabela principal
                objParam.Add(new SqlParameter("@CodInstrumento", Convert.ToInt32(objEnt.CodInstrumento)));
                blnRetorno = objAcessa.executar(strDelete, objParam);

                //retorna o blnRetorno da tabela principal
                return(blnRetorno);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
ファイル: frmInstrBusca.cs プロジェクト: esnfile/SisMusica
        /// <summary>
        /// Função que transfere os dados para as Entidades
        /// </summary>
        /// <returns></returns>
        private MOD_instrumento criarTabela()
        {
            try
            {
                //preenche o objeto da tabela Logs
                objEnt = new MOD_instrumento();
                objEnt.CodInstrumento  = Codigo;
                objEnt.DescInstrumento = Descricao;

                //retorna o objeto preenchido
                return(objEnt);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
ファイル: DAL_instrumento.cs プロジェクト: esnfile/SisMusica
        /// <summary>
        /// Função que faz UPDATE na Tabela Instrumentos
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool salvar(MOD_instrumento objEnt)
        {
            try
            {
                //Varivel boleana que retorna se foi executado ou não no Banco
                //Tabela Instrumentos
                bool blnRetorno = true;
                //Declara a lista de parametros da tabela
                List <SqlParameter> objParam = new List <SqlParameter>();
                //parametros da tabela principal
                objParam.Add(new SqlParameter("@CodInstrumento", Convert.ToInt16(objEnt.CodInstrumento)));
                objParam.Add(new SqlParameter("@DescInstrumento", string.IsNullOrEmpty(objEnt.DescInstrumento) ? DBNull.Value as object : objEnt.DescInstrumento as object));
                objParam.Add(new SqlParameter("@CodFamilia", string.IsNullOrEmpty(objEnt.CodFamilia) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodFamilia) as object));
                objParam.Add(new SqlParameter("@NotaAfina", string.IsNullOrEmpty(objEnt.NotaAfina) ? DBNull.Value as object : objEnt.NotaAfina as object));
                objParam.Add(new SqlParameter("@PosAfina", string.IsNullOrEmpty(objEnt.PosAfina) ? DBNull.Value as object : objEnt.PosAfina as object));
                objParam.Add(new SqlParameter("@NotaEfeito", string.IsNullOrEmpty(objEnt.NotaEfeito) ? DBNull.Value as object : objEnt.NotaEfeito as object));
                objParam.Add(new SqlParameter("@PosEfeito", string.IsNullOrEmpty(objEnt.PosEfeito) ? DBNull.Value as object : objEnt.PosEfeito as object));
                objParam.Add(new SqlParameter("@Obs", string.IsNullOrEmpty(objEnt.Obs) ? DBNull.Value as object : objEnt.Obs as object));
                objParam.Add(new SqlParameter("@TesNotaGrave", string.IsNullOrEmpty(objEnt.TesNotaGrave) ? DBNull.Value as object : objEnt.TesNotaGrave as object));
                objParam.Add(new SqlParameter("@TesNotaAguda", string.IsNullOrEmpty(objEnt.TesNotaAguda) ? DBNull.Value as object : objEnt.TesNotaAguda as object));
                objParam.Add(new SqlParameter("@Situacao", string.IsNullOrEmpty(objEnt.Situacao) ? DBNull.Value as object : objEnt.Situacao as object));
                objParam.Add(new SqlParameter("@Ordem", string.IsNullOrEmpty(objEnt.Ordem) ? DBNull.Value as object : Convert.ToInt16(objEnt.Ordem) as object));

                blnRetorno = objAcessa.executar(strUpdate, objParam);

                //retorna o blnRetorno da tabela principal
                return(blnRetorno);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }