private void btnCancelarTienda_Click(object sender, EventArgs e)
        {
            PortadaMantenedorTienda ProductoView = new PortadaMantenedorTienda();

            ProductoView.cargaTiendas();
            this.Visible = false;
        }
Exemple #2
0
        private void btnCancelarTienda_Click(object sender, EventArgs e)
        {
            PortadaMantenedorTienda TiendaView = new PortadaMantenedorTienda();

            limpiarCampos();
            TiendaView.Refresh();
            this.Visible = false;
        }
Exemple #3
0
        private void btnCrearTienda_Click(object sender, EventArgs e)
        {
            TiendaDAO tiendaPorNombre = new TiendaDAO();
            Tienda    ti = tiendaPorNombre.buscaTiendaPorNombre(txtNombreTienda.Text.Trim().ToUpper());

            if (validaCampos() == true)
            {
                if (ti != null)
                {
                    MessageBox.Show("Error: La tienda ya se encuentra ingresada.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtNombreTienda.Text = "";
                    txtNombreTienda.Focus();
                    return;
                }
                else
                {
                    try
                    {
                        TiendaDAO lstTienda         = new TiendaDAO();
                        String    nombre            = txtNombreTienda.Text.Trim().ToUpper();
                        String    direccion         = txtDireccionTienda.Text;
                        String    telefono          = txtTelefonoTienda.Text;
                        sbyte     activo            = 1;
                        DateTime  fechaCreacion     = dtFechaIngresoTienda.Value;
                        DateTime  fechaModificacion = DateTime.Now;
                        String    empresa           = txtNombreEmpresa.Text;
                        Int16     Ciudad            = Int16.Parse(cmbCiudad.SelectedValue.ToString());
                        TiendaDAO insertarTienda    = new TiendaDAO();
                        insertarTienda.InsertaTienda(nombre, direccion, telefono, activo, fechaCreacion, fechaModificacion, empresa, Ciudad);
                        MessageBox.Show("Tienda registrada exitosamente.");
                        limpiarCampos();
                        PortadaMantenedorTienda TiendaView = new PortadaMantenedorTienda();
                        TiendaView.cargaTiendas();
                        this.Visible = false;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Error: se ha generado un error en el sistema. Por favor intenta mas tarde o contacta al Administrador.");
                    }
                }
            }
        }
 private void btnCrearTienda_Click(object sender, EventArgs e)
 {
     try
     {
         TiendaDAO tiendaPorNombre = new TiendaDAO();
         Tienda    ti = tiendaPorNombre.buscaTiendaPorNombre(txtNombreTienda.Text.Trim().ToUpper());
         if (validaCampos() == true)
         {
             if (ti != null)
             {
                 MessageBox.Show("Error: La tienda ya se encuentra ingresada.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 txtNombreTienda.Text = "";
                 txtNombreTienda.Focus();
                 return;
             }
             else
             {
                 try
                 {
                     long      x           = long.Parse(objetoPaso.paso0);         //id
                     TiendaDAO editaTienda = new TiendaDAO();
                     editaTienda.EditarTienda(x, txtNombreTienda.Text.Trim().ToUpper(), txtDireccionTienda.Text, txtTelefonoTienda.Text, dtFechaIngresoTienda.Value, txtNombreEmpresa.Text, Int16.Parse(cmbCiudad.SelectedValue.ToString()));
                     MessageBox.Show("Modificación de tienda exitosa.");
                     objetoPaso.paso0 = (String)(0.ToString());
                     PortadaMantenedorTienda tiendaView = new PortadaMantenedorTienda();
                     tiendaView.cargaTiendas();
                     this.Visible = false;
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show("Error al modificar la tienda.");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error de sistema al editar la tienda.");
     }
 }