//**************************************************************************************************** //************** R E S P O N S I V A S *************************************************************** //**************************************************************************************************** private void nuevaToolStripMenuItem_Click(object sender, EventArgs e) { try { frmResponsivas child = new frmResponsivas(); this.validaFormsDuplicados(child.GetType()); child.MdiParent = this; child.Show(); } catch (Exception Ex) { MessageBox.Show(Ex.Message, "Activos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { // validaciones combos if (this.cmbTipo.SelectedIndex == -1) { throw new Exception("Seleccione un tipo"); } if (this.cmbArea.SelectedIndex == -1) { throw new Exception("Seleccione un área"); } // valida nombre if (string.IsNullOrEmpty(this.tbNombre.Text)) { throw new Exception("Llene el campo nombre"); } // validaciones segun el tipo bool resultado = validaciones(); if (!resultado) { throw new Exception("Campos incompletos o valores inválidos.\nPor favor verifique."); } // guardar informacion string nombre = this.tbNombre.Text; int idTipo = (int)this.cmbTipo.SelectedValue; string fechaCompra = this.dtpFecha.Value.ToString("yyyy-MM-dd"); string descripcion = this.tbMarca.Text + "&" + this.tbModelo.Text + "&" + this.tbNumSerie.Text + "&" + this.tbColor.Text + "&" + this.tbCosto.Text + "&" + this.tbFactura.Text + "&" + fechaCompra + "&" + this.tbDescripcion.Text; int idArea = (int)this.cmbArea.SelectedValue; long result = this._activosNegocio.guardaActivo(nombre, descripcion, idArea, idTipo, this._idUsuario, string.Empty); if (result > 0) { MessageBox.Show("Activo guardado correctamente", "Activos", MessageBoxButtons.OK, MessageBoxIcon.Information); // bitacora this._catalogosNegocio.generaBitacora( "Nuevo activo agregado: " + nombre + "/" + descripcion + "/area: " + idArea + "/tipo: " + idTipo, "ACTIVOS"); this.tbMarca.Text = string.Empty; this.tbModelo.Text = string.Empty; this.tbNumSerie.Text = string.Empty; this.tbColor.Text = string.Empty; this.tbDescripcion.Text = string.Empty; this.tbCosto.Text = string.Empty; this.tbFactura.Text = string.Empty; this.cmbArea.DataSource = null; this.cmbSucursal.SelectedIndex = -1; this.cmbTipo.SelectedIndex = -1; this.tbNombre.Text = string.Empty; // CREACION DE RESPONSIVAS if (this.cbCreaResp.Checked) { List <Modelos.Activos> activos = this._activosNegocio.getActivo(result); frmResponsivas form = new frmResponsivas(activos); form.ShowDialog(); } this.cbCreaResp.Checked = false; } } catch (Exception Ex) { MessageBox.Show(Ex.Message, "Activos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }