예제 #1
0
        /// <summary>
        /// Procedimiento Listar Siguiente Datos
        /// </summary>
        /// <param name="Listar Siguiente IslrDetalle"></param>
        public DataSet Siguiente(DIslrDetalle IslrDetalle)
        {
            DataSet       DsRpta  = new DataSet();
            SqlConnection SqlConn = new SqlConnection();

            try
            {
                SqlConn.ConnectionString = DConexion.Cn;
                SqlConn.Open();

                SqlCommand Cmd = new SqlCommand
                {
                    Connection  = SqlConn,
                    CommandText = "islr_siguiente",
                    CommandType = CommandType.StoredProcedure,
                };

                SqlParameter Parcod_islr = Getcod_islr(IslrDetalle);
                Cmd.Parameters.Add(Parcod_islr);

                Cmd.ExecuteNonQuery();
                SqlDataAdapter SqlDat = new SqlDataAdapter(Cmd);
                SqlDat.Fill(DsRpta);
            }
            catch (Exception Ex)
            {
                DsRpta = null;
                throw new Exception("Error al Ejecutar el procedimiento almacenado" + Ex.Message, Ex);
            }
            finally
            {
                SqlConn.Close();
            }
            return(DsRpta);
        }
예제 #2
0
        private static SqlParameter Getrengv(DIslrDetalle IslrDetalle)
        {
            SqlParameter Prengv = new SqlParameter
            {
                ParameterName = "@rengv",
                SqlDbType     = SqlDbType.Int,
                Value         = IslrDetalle.Drengv,
            };

            return(Prengv);
        }
예제 #3
0
        private static SqlParameter Getdesc_concepto(DIslrDetalle IslrDetalle)
        {
            SqlParameter Pdesc_concepto = new SqlParameter
            {
                ParameterName = "@desc_concepto",
                SqlDbType     = SqlDbType.NVarChar,
                Size          = 50,
                Value         = IslrDetalle.Ddesc_concepto,
            };

            return(Pdesc_concepto);
        }
예제 #4
0
        private static SqlParameter Getcod_islr(DIslrDetalle IslrDetalle)
        {
            SqlParameter Pcod_islr = new SqlParameter
            {
                ParameterName = "@cod_islr",
                SqlDbType     = SqlDbType.NVarChar,
                Size          = 50,
                Value         = IslrDetalle.Dcod_islr,
            };

            return(Pcod_islr);
        }
예제 #5
0
        private static SqlParameter Getbtipo(DIslrDetalle IslrDetalle)
        {
            SqlParameter Pbtipo = new SqlParameter
            {
                ParameterName = "@btipo",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = IslrDetalle.Dbtipo,
            };

            return(Pbtipo);
        }
예제 #6
0
        private static SqlParameter Getbuscarh(DIslrDetalle IslrDetalle)
        {
            SqlParameter Pbuscarh = new SqlParameter
            {
                ParameterName = "@buscarh",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = IslrDetalle.Dbuscarh,
            };

            return(Pbuscarh);
        }
예제 #7
0
        /// <summary>
        /// Metodo Insertar Datos Recibe 8 Parametros
        /// </summary>
        /// <returns> Recibe Parametros</returns>
        public string Insertar(DIslrDetalle IslrDetalle)
        {
            string        Rpta    = "";
            SqlConnection SqlConn = new SqlConnection();

            try
            {
                SqlConn.ConnectionString = DConexion.Cn;
                SqlConn.Open();

                SqlCommand Cmd = new SqlCommand()
                {
                    Connection  = SqlConn,
                    CommandText = "islr_insertar",
                    CommandType = CommandType.StoredProcedure,
                };

                SqlParameter Parcod_islr = Getcod_islr(IslrDetalle);
                Cmd.Parameters.Add(Parcod_islr);


                Cmd.ExecuteNonQuery();
                Rpta = "Y";
            }
            catch (SqlException Exc)
            {
                if (Exc.Number == 8152)
                {
                    Rpta = "Ha introducido demasiados caracteres en uno de los campos.";
                }
                else if (Exc.Number == 2627)
                {
                    Rpta = "El Codigo Ya Existe. No se Permiten Registros Duplicados.";
                }
                else if (Exc.Number == 2812)
                {
                    Rpta = "No Existe el Procedimiento Almacenado";
                }
                else
                {
                    Rpta = "Error al intentar ejecutar el procedimiento almacenado " + Exc.Message;
                }
            }
            finally
            {
                if (SqlConn.State == ConnectionState.Open)
                {
                    SqlConn.Close();
                }
            }
            return(Rpta);
        }
예제 #8
0
        private static SqlParameter Getsustraendo(DIslrDetalle IslrDetalle)
        {
            SqlParameter Psustraendo = new SqlParameter
            {
                ParameterName = "@sustraendo",
                SqlDbType     = SqlDbType.Decimal,
                Precision     = 18,
                Scale         = 3,
                Value         = IslrDetalle.Dsustraendo,
            };

            return(Psustraendo);
        }
예제 #9
0
        private static SqlParameter Getretencion(DIslrDetalle IslrDetalle)
        {
            SqlParameter Pretencion = new SqlParameter
            {
                ParameterName = "@retencion",
                SqlDbType     = SqlDbType.Decimal,
                Precision     = 18,
                Scale         = 3,
                Value         = IslrDetalle.Dretencion,
            };

            return(Pretencion);
        }
예제 #10
0
        private static SqlParameter Getbasep(DIslrDetalle IslrDetalle)
        {
            SqlParameter Pbasep = new SqlParameter
            {
                ParameterName = "@basep",
                SqlDbType     = SqlDbType.Decimal,
                Precision     = 18,
                Scale         = 3,
                Value         = IslrDetalle.Dbasep,
            };

            return(Pbasep);
        }
예제 #11
0
        /// <summary>
        /// Metodo Eliminar Datos Recibe 1 Parametro
        /// </summary>
        /// <returns> Recibe Parametros</returns>
        public string Eliminar(DIslrDetalle IslrDetalle)
        {
            string        Rpta    = "";
            SqlConnection SqlConn = new SqlConnection();

            try
            {
                SqlConn.ConnectionString = DConexion.Cn;
                SqlConn.Open();

                SqlCommand Cmd = new SqlCommand()
                {
                    Connection  = SqlConn,
                    CommandText = "islr_eliminar",
                    CommandType = CommandType.StoredProcedure,
                };

                SqlParameter Parcod_islr = Getcod_islr(IslrDetalle);
                Cmd.Parameters.Add(Parcod_islr);

                Cmd.ExecuteNonQuery();
                Rpta = "Y";
            }
            catch (SqlException Exc)
            {
                if (Exc.Number == 2812)
                {
                    Rpta = "No Existe el Procedimiento Almacenado";
                }
                else if (Exc.Number == 547)
                {
                    Rpta = "No se Pueden Eliminar Registros Relacionados!  " + Exc.Message;
                }
                else
                {
                    Rpta = "Error al intentar ejecutar el procedimiento almacenado! " + Exc.Message;
                }
            }
            finally
            {
                if (SqlConn.State == ConnectionState.Open)
                {
                    SqlConn.Close();
                }
            }
            return(Rpta);
        }
예제 #12
0
        /// <summary>
        /// Procedimiento Buscar Datos Recibe 3 Parametros
        /// </summary>
        public DataTable RepBuscar(DIslrDetalle IslrDetalle)
        {
            DataTable     DtRpta  = new DataTable("TbIslr");
            SqlConnection SqlConn = new SqlConnection();

            try
            {
                SqlConn.ConnectionString = DConexion.Cn;
                SqlConn.Open();

                SqlCommand Cmd = new SqlCommand
                {
                    Connection  = SqlConn,
                    CommandText = "islr_rptlistar",
                    CommandType = CommandType.StoredProcedure,
                };

                SqlParameter Parbuscard = Getbuscard(IslrDetalle);
                Cmd.Parameters.Add(Parbuscard);

                SqlParameter Parbuscarh = Getbuscarh(IslrDetalle);
                Cmd.Parameters.Add(Parbuscarh);

                SqlParameter Parbtipo = Getbtipo(IslrDetalle);
                Cmd.Parameters.Add(Parbtipo);

                Cmd.ExecuteNonQuery();
                SqlDataAdapter SqlDat = new SqlDataAdapter(Cmd);
                SqlDat.Fill(DtRpta);
            }
            catch (Exception Ex)
            {
                DtRpta = null;
                throw new Exception("Error al Ejecutar el procedimiento almacenado" + Ex.Message, Ex);
            }
            finally
            {
                SqlConn.Close();
            }
            return(DtRpta);
        }
예제 #13
0
        /// <summary>
        /// Tabla Listar No Recibe parametros y Muestra un DataSet
        /// </summary>
        /// <returns> No Recibe Parametros</returns>
        public DataSet Listar(DIslrDetalle IslrDetalle)
        {
            DataSet       DsRpta  = new DataSet();
            SqlConnection SqlConn = new SqlConnection();

            try
            {
                SqlConn.ConnectionString = DConexion.Cn;
                SqlConn.Open();

                SqlCommand Cmd = new SqlCommand
                {
                    Connection  = SqlConn,
                    CommandText = "islr_listar",
                    CommandType = CommandType.StoredProcedure,
                };


                SqlParameter Parcod_islr = Getcod_islr(IslrDetalle);
                Cmd.Parameters.Add(Parcod_islr);

                SqlDataAdapter Dat = new SqlDataAdapter(Cmd);
                Dat.Fill(DsRpta);
            }
            catch (Exception Exc)
            {
                DsRpta = null;
                throw new Exception("Error al Ejecutar el procedimiento almacenado  " + Exc.Message);
            }
            finally
            {
                if (SqlConn.State == ConnectionState.Open)
                {
                    SqlConn.Close();
                }
            }
            return(DsRpta);
        }