コード例 #1
0
        /// <summary>
        /// Procedimiento Listar Siguiente Datos
        /// </summary>
        /// <param name="Listar Siguiente ChequeraDetalle"></param>
        public DataSet Siguiente(DChequeraDetalle ChequeraDetalle)
        {
            DataSet       DsRpta  = new DataSet();
            SqlConnection SqlConn = new SqlConnection();

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

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

                SqlParameter Parcod_chequera = Getcod_chequera(ChequeraDetalle);
                Cmd.Parameters.Add(Parcod_chequera);

                Cmd.ExecuteNonQuery();
                SqlDataAdapter SqlDat = new SqlDataAdapter(Cmd);
                SqlDat.Fill(DsRpta, "TbChequeraDetalle");
            }
            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 Getrengchequera(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Prengchequera = new SqlParameter
            {
                ParameterName = "@rengchequera",
                SqlDbType     = SqlDbType.Int,
                Value         = ChequeraDetalle.Drengchequera,
            };

            return(Prengchequera);
        }
コード例 #3
0
        private static SqlParameter Getmonto(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pmonto = new SqlParameter
            {
                ParameterName = "@monto",
                SqlDbType     = SqlDbType.Money,
                Value         = ChequeraDetalle.Dmonto,
            };

            return(Pmonto);
        }
コード例 #4
0
        private static SqlParameter Getfechaemision(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pfechaemision = new SqlParameter
            {
                ParameterName = "@fechaemision",
                SqlDbType     = SqlDbType.DateTime,
                Value         = ChequeraDetalle.Dfechaemision,
            };

            return(Pfechaemision);
        }
コード例 #5
0
        private static SqlParameter Getnumcheque(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pnumcheque = new SqlParameter
            {
                ParameterName = "@numcheque",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = ChequeraDetalle.Dnumcheque,
            };

            return(Pnumcheque);
        }
コード例 #6
0
        private static SqlParameter Getcod_cuenta(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pcod_cuenta = new SqlParameter
            {
                ParameterName = "@cod_cuenta",
                SqlDbType     = SqlDbType.NVarChar,
                Size          = 50,
                Value         = ChequeraDetalle.Dcod_cuenta,
            };

            return(Pcod_cuenta);
        }
コード例 #7
0
        private static SqlParameter Getbtipo(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pbtipo = new SqlParameter
            {
                ParameterName = "@btipo",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = ChequeraDetalle.Dbtipo,
            };

            return(Pbtipo);
        }
コード例 #8
0
        private static SqlParameter Getbuscarh(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pbuscarh = new SqlParameter
            {
                ParameterName = "@buscarh",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = ChequeraDetalle.Dbuscarh,
            };

            return(Pbuscarh);
        }
コード例 #9
0
        private static SqlParameter Getdescripcion(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pdescripcion = new SqlParameter
            {
                ParameterName = "@descripcion",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = ChequeraDetalle.Ddescripcion,
            };

            return(Pdescripcion);
        }
コード例 #10
0
        private static SqlParameter Getestatus(DChequeraDetalle ChequeraDetalle)
        {
            SqlParameter Pestatus = new SqlParameter
            {
                ParameterName = "@estatus",
                SqlDbType     = SqlDbType.VarChar,
                Size          = 50,
                Value         = ChequeraDetalle.Destatus,
            };

            return(Pestatus);
        }
コード例 #11
0
        /// <summary>
        /// Metodo Eliminar Datos Recibe 1 Parametro
        /// </summary>
        /// <returns> 1 Parametro</returns>
        public string EstatusCheque(DChequeraDetalle ChequeraDetalle)
        {
            string        Rpta    = "";
            SqlConnection SqlConn = new SqlConnection();

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

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

                SqlParameter Parnumcheque = Getnumcheque(ChequeraDetalle);
                Cmd.Parameters.Add(Parnumcheque);

                SqlParameter Parestatus = Getestatus(ChequeraDetalle);
                Cmd.Parameters.Add(Parestatus);

                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>
        /// Tabla Mostrar No Recibe parametros
        /// </summary>
        /// <returns> 0 Parametros</returns>
        public DataTable MostrarCh(DChequeraDetalle ChequeraDetalle)
        {
            DataTable     DtRpta  = new DataTable("TbChequeraDetalle");
            SqlConnection SqlConn = new SqlConnection();

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

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

                SqlParameter Parcod_chequera = Getcod_chequera(ChequeraDetalle);
                Cmd.Parameters.Add(Parcod_chequera);

                SqlParameter Parcod_cuenta = Getcod_cuenta(ChequeraDetalle);
                Cmd.Parameters.Add(Parcod_cuenta);

                SqlParameter Parestatus = Getestatus(ChequeraDetalle);
                Cmd.Parameters.Add(Parestatus);

                Cmd.ExecuteNonQuery();
                SqlDataAdapter Dat = new SqlDataAdapter(Cmd);
                Dat.Fill(DtRpta);
            }
            catch (Exception Exc)
            {
                DtRpta = null;
                throw new Exception("Error al Ejecutar el procedimiento almacenado" + Exc.Message);
            }
            finally
            {
                if (SqlConn.State == ConnectionState.Open)
                {
                    SqlConn.Close();
                }
            }
            return(DtRpta);
        }
コード例 #13
0
        /// <summary>
        /// Procedimiento Buscar Datos Recibe 3 Parametros
        /// </summary>
        public DataTable RepBuscar(DChequeraDetalle ChequeraDetalle)
        {
            DataTable     DtRpta  = new DataTable("TbChequeraDetalle");
            SqlConnection SqlConn = new SqlConnection();

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

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

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

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

                SqlParameter Parbtipo = Getbtipo(ChequeraDetalle);
                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);
        }
コード例 #14
0
        /// <summary>
        /// Procedimiento Generar Codigo
        /// </summary>
        /// <param name="Generar Codigo"></param>
        /// <return>Retorna el Codigo</return>
        public string GenerarCod(DChequeraDetalle ChequeraDetalle)
        {
            SqlConnection SqlConn = new SqlConnection
            {
                ConnectionString = DConexion.Cn
            };

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

            try
            {
                SqlParameter ParCod_chequeradetalle = new SqlParameter("@cod_chequera", SqlDbType.Int)
                {
                    Direction = ParameterDirection.Output,
                    Value     = ChequeraDetalle.Dcod_chequera
                };
                Cmd.Parameters.Add(ParCod_chequeradetalle);

                if (Cmd.ExecuteNonQuery() == 0)
                {
                    return(Cmd.Parameters[ParCod_chequeradetalle.ToString()].Value.ToString());
                }
            }
            catch (Exception ex)
            {
                string Resp = ex.Message;
            }
            finally
            {
                SqlConn.Close();
            }
            return(Cmd.Parameters["@cod_chequera"].Value.ToString());
        }
コード例 #15
0
        /// <summary>
        /// Metodo Editar Datos Recibe 8 Parametros
        /// </summary>
        /// <returns> 8 Parametros</returns>
        public string Editar(DChequeraDetalle ChequeraDetalle)
        {
            string        Rpta    = "";
            SqlConnection SqlConn = new SqlConnection();

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

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

                SqlParameter Parcod_chequera = Getcod_chequera(ChequeraDetalle);
                Cmd.Parameters.Add(Parcod_chequera);

                SqlParameter Parrengchequera = Getrengchequera(ChequeraDetalle);
                Cmd.Parameters.Add(Parrengchequera);

                SqlParameter Parnumcheque = Getnumcheque(ChequeraDetalle);
                Cmd.Parameters.Add(Parnumcheque);

                SqlParameter Parestatus = Getestatus(ChequeraDetalle);
                Cmd.Parameters.Add(Parestatus);

                SqlParameter Parfechaemision = Getfechaemision(ChequeraDetalle);
                Cmd.Parameters.Add(Parfechaemision);

                SqlParameter Parmonto = Getmonto(ChequeraDetalle);
                Cmd.Parameters.Add(Parmonto);

                SqlParameter Pardescripcion = Getdescripcion(ChequeraDetalle);
                Cmd.Parameters.Add(Pardescripcion);

                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);
        }