Ejemplo n.º 1
0
        //--------------------
        // Insert DocVigencia
        //--------------------
        public bool Ins_DocVigencia(BE_ReqDocVigencia 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_DocVigencia]";
                        cm.CommandType = CommandType.StoredProcedure;
                        cm.Parameters.AddWithValue("cDocCodigo", Request.cDocCodigo);
                        cm.Parameters.AddWithValue("dFechaIni", Request.dFechaIni);
                        cm.Parameters.AddWithValue("dFechaFin", Request.dFechaFin);

                        cm.Connection = cn;

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

            }
            catch (Exception)
            {
                throw;
            }
            return exito;
        }
Ejemplo n.º 2
0
        //----------------------
        // Insert DocVigencia
        //----------------------
        public bool Ins_DocVigencia(string cDocCodigo, DateTime dFechaIni, DateTime dFechaFin)
        {
            bool exito = false;

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

                ReqConAsiento.cDocCodigo = cDocCodigo;
                ReqConAsiento.dFechaIni = dFechaIni;
                ReqConAsiento.dFechaFin = dFechaFin;

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

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