Ejemplo n.º 1
0
        //---------------
        // Insert DocRef
        //---------------
        public bool Ins_DocRef(BE_ReqDocRef Request)
        {
            bool exito = false;
            try
            {
                clsConection Obj = new clsConection();
                string Cadena = Obj.GetConexionString("Naylamp");

                using (SqlConnection cn = new SqlConnection(Cadena))
                {
                    cn.Open();

                    using (SqlCommand cm = new SqlCommand())
                    {
                        cm.CommandText = "[usp_Ins_DocRef]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cDocCodigo", Request.cDocCodigo);
                        cm.Parameters.AddWithValue("cDocRefCodigo", Request.cDocRefCodigo);
                        cm.Parameters.AddWithValue("dDocRefFecReg", Request.dDocRefFecReg);

                        cm.Connection = cn;

                        if (cm.ExecuteNonQuery() > 0)
                        {
                            exito = true;
                        }
                        else throw new ApplicationException("se ha producido un error procedimiento almacenado: [usp_Ins_DocRef]; Consulte al administrador del sistema");
                    }
                }

            }
            catch (Exception)
            {
                throw;
            }
            return exito;
        }
Ejemplo n.º 2
0
        //----------------------
        // Insert DocRef
        //----------------------
        public bool Ins_DocRef(string cDocCodigo, string cDocRefCodigo, DateTime dDocRefFecReg)
        {
            bool exito = false;

            try
            {
                BE_ReqDocRef ReqConAsiento = new BE_ReqDocRef();
                DA_ConAsiento ObjConAsiento = new DA_ConAsiento();

                ReqConAsiento.cDocCodigo = cDocCodigo;
                ReqConAsiento.cDocRefCodigo = cDocRefCodigo;
                ReqConAsiento.dDocRefFecReg = dDocRefFecReg;

                if (!ObjConAsiento.Ins_DocRef(ReqConAsiento))
                {
                    throw new ApplicationException("Se encontraron errores en la transaccion: [Ins_DocRef].!");
                }
                else
                {
                    exito = true;
                }

            }
            catch (Exception)
            {
                throw;
            }
            return exito;
        }