private void btnAdd_Click(object sender, EventArgs e) { if (txtNombreArchivo.Text.Trim().Equals("") || txtDirectorio.Text.Trim().Equals("")) { MessageBox.Show("El nombre es obligatorio."); return; } byte[] file = null; Stream myStream = opdBrowse.OpenFile(); using (MemoryStream ms = new MemoryStream()) { myStream.CopyTo(ms); file = ms.ToArray(); } this.res = new Respaldos(); this.res.Nombre = this.txtNombreArchivo.Text; this.res.Directorio = this.txtDirectorio.Text; this.res.Doc = file; this.res.opc = 1; this.resh = new RespaldosHelper(res); ///LOG PARA USUARIOS // LogMovimientos(); this.resh.Guardar(); listar(); MessageBox.Show("REsplado Almacenado"); }
private void listar() { try { this.res = new Respaldos(); this.res.opc = 2; this.resh = new RespaldosHelper(res); this.table = new DataTable(); this.table = this.resh.Listar(); if (this.table.Rows.Count > 0) { this.dgvListar.DataSource = this.table; this.dgvListar.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void guardar() { try { //AGREGAR NUEVO USUARIO this.res = new Respaldos(); this.res.Nombre = this.txtNombreArchivo.Text; this.res.Directorio = this.txtDirectorio.Text; this.res.opc = 1; this.resh = new RespaldosHelper(res); ///LOG PARA USUARIOS // LogMovimientos(); this.resh.Guardar(); MessageBox.Show("REsplado Almacenado"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }