コード例 #1
0
        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");
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Respaldos respaldos = db.Respaldos.Find(id);

            db.Respaldos.Remove(respaldos);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "RespaldoID,Secuencia,FechaInicio,FechaFin,Ubicacion,AplicaPolitica,Comentario")] Respaldos respaldos)
 {
     if (ModelState.IsValid)
     {
         db.Entry(respaldos).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(respaldos));
 }
コード例 #4
0
        public ActionResult Create([Bind(Include = "RespaldoID,Secuencia,FechaInicio,FechaFin,Ubicacion,AplicaPolitica,Comentario")] Respaldos respaldos)
        {
            if (ModelState.IsValid)
            {
                db.Respaldos.Add(respaldos);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(respaldos));
        }
コード例 #5
0
        // GET: Respaldos/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Respaldos respaldos = db.Respaldos.Find(id);

            if (respaldos == null)
            {
                return(HttpNotFound());
            }
            return(View(respaldos));
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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);
            }
        }