예제 #1
0
        // fn fn = new Fn();

        //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        public void Insertar(BitacoraEnvioEC BitacoraEnvioEC, bool Tran = false)
        {
            object[] ObjParameter = new object[9];
            ObjParameter[0] = BitacoraEnvioEC.Empresa;
            ObjParameter[1] = BitacoraEnvioEC.MailTo;
            ObjParameter[2] = BitacoraEnvioEC.Asunto;
            ObjParameter[3] = BitacoraEnvioEC.Cliente;
            ObjParameter[4] = BitacoraEnvioEC.AlCorte;
            ObjParameter[5] = BitacoraEnvioEC.Sucursal;
            ObjParameter[6] = BitacoraEnvioEC.Adjunto;
            ObjParameter[7] = BitacoraEnvioEC.ErrorMsg;
            ObjParameter[8] = BitacoraEnvioEC.Enviado;

            try
            {
                this.InicializarMensajeError();
                this.OpenSqlBD();

                SqlCommand cmd = new SqlCommand();
                cmd = this.ConfigurarComando(TieneTransaccion.Si, "sp_ins_BitacoraEnvioEC", ObjParameter);
                cmd.ExecuteNonQuery();

                if (Tran == false)
                {
                    Commit();
                }
            }
            catch (Exception ex)
            {
                this.CodigoError = -1;
                if (Tran == false)
                {
                    Rollback();
                }
                fn.XtraMsg(ex.Message, MessageBoxIcon.Error);
            }
            finally
            {
                if (Tran == false)
                {
                    CloseSqlBD();
                }
            }
        }
예제 #2
0
        ////-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        //public void Borrar(BitacoraEnvioEC BitacoraEnvioEC, bool Tran = false)
        //{
        //    object[] ObjParameter = new object[2];
        //    ObjParameter[0] = BitacoraEnvioEC.IdBitacora;
        //    try
        //    {
        //        this.InicializarMensajeError();
        //        this.OpenSqlBD();

        //        SqlCommand cmd = new SqlCommand();
        //        cmd = this.ConfigurarComando(TieneTransaccion.Si, "sp_del_BitacoraEnvioEC", ObjParameter);
        //        cmd.ExecuteNonQuery();

        //        if (Tran == false)
        //        {
        //            Commit();
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        this.CodigoError = -1;
        //        if (Tran == false)
        //        {
        //            Rollback();
        //        }
        //        fn.XtraMsg(ex.Message, MessageBoxIcon.Error);
        //    }
        //    finally
        //    {
        //        if (Tran == false)
        //        {
        //            CloseSqlBD();
        //        }
        //    }
        //}

        //-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
        public BitacoraEnvioEC Detalles(int Empresa)
        {
            DataTable       dt  = fn.ObtieneDatos("sp_sel_BitacoraEnvioEC", DateTime.Now.Date, DateTime.Now.Date, Empresa);
            BitacoraEnvioEC det = new BitacoraEnvioEC();

            if (dt.Rows.Count > 0)
            {
                det.IdBitacora  = (int)dt.Rows[0]["IdBitacora"];
                det.Empresa     = (int)dt.Rows[0]["Empresa"];
                det.MailTo      = dt.Rows[0]["MailTo"].ToString();
                det.Asunto      = dt.Rows[0]["Asunto"].ToString();
                det.Cliente     = dt.Rows[0]["Cliente"].ToString();
                det.AlCorte     = dt.Rows[0]["AlCorte"].ToString();
                det.Sucursal    = dt.Rows[0]["Sucursal"].ToString();
                det.Adjunto     = dt.Rows[0]["Adjunto"].ToString();
                det.ErrorMsg    = dt.Rows[0]["ErrorMsg"].ToString();
                det.Enviado     = (int)dt.Rows[0]["Enviado"];
                det.Usuario     = dt.Rows[0]["Usuario"].ToString();
                det.Fecha_Envio = dt.Rows[0]["Fecha_Envio"].ToString();
            }
            return(det);
        }