Esempio n. 1
0
        //----------------------
        // Insert DocInterface
        //---------------------
        public bool Ins_DocInterface(string cDocCodigo, int nIntCodigo, int nIntClase, DateTime dDocIntReg)
        {
            bool exito = false;

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

                ReqConAsiento.cDocCodigo = cDocCodigo;
                ReqConAsiento.nIntCodigo = nIntCodigo;
                ReqConAsiento.nIntClase  = nIntClase;
                ReqConAsiento.dDocIntReg = dDocIntReg;

                if (!ObjConAsiento.Ins_DocInterface(ReqConAsiento))
                {
                    throw new ApplicationException("Se encontraron errores en la transaccion: [Ins_DocInterface].!");
                }
                else
                {
                    exito = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(exito);
        }
        //--------------------
        // Insert DocInterface
        //--------------------
        public bool Ins_DocInterface(BE_ReqDocInterface 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_DocInterface]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cDocCodigo", Request.cDocCodigo);
                        cm.Parameters.AddWithValue("nIntCodigo", Request.nIntCodigo);
                        cm.Parameters.AddWithValue("nIntClase", Request.nIntClase);
                        cm.Parameters.AddWithValue("dDocIntReg", Request.dDocIntReg);

                        cm.Connection = cn;

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