private void cmbDepartamentos_SelectedIndexChanged(object sender, EventArgs e) { try { App_Code.Inventario.Departamentos oDepartamentos = new App_Code.Inventario.Departamentos(int.Parse(this.cmbDepartamentos.SelectedValue.ToString())); if (this.chkUtilidadDepartamento.Checked) { this.txtUtilidadMaxima.Text = oDepartamentos.PrecioMaximo.ToString(); this.txtUtilidadMayor.Text = oDepartamentos.PrecioMayor.ToString(); this.txtUtilidadMinimo.Text = oDepartamentos.PrecioMinimo.ToString(); this.txtUtilidadOferta.Text = oDepartamentos.PrecioOferta.ToString(); this.txtUtilidadMaxima.ReadOnly = true; this.txtUtilidadMayor.ReadOnly = true; this.txtUtilidadMinimo.ReadOnly = true; this.txtUtilidadOferta.ReadOnly = true; } else { this.txtUtilidadMaxima.Text = oDepartamentos.PrecioMaximo.ToString(); this.txtUtilidadMayor.Text = oDepartamentos.PrecioMayor.ToString(); this.txtUtilidadMinimo.Text = oDepartamentos.PrecioMinimo.ToString(); this.txtUtilidadOferta.Text = oDepartamentos.PrecioOferta.ToString(); this.txtUtilidadMaxima.ReadOnly = false; this.txtUtilidadMayor.ReadOnly = false; this.txtUtilidadMinimo.ReadOnly = false; this.txtUtilidadOferta.ReadOnly = false; } } catch (Exception) { //throw; } }
private void Borrar() { try { oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300204"); if (oFuncion.Err) { MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { if (MessageBox.Show("Esta seguro de Borrar este Registro", "Atencion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { App_Code.Inventario.Departamentos oRegistro = new App_Code.Inventario.Departamentos(int.Parse(this.lblFicha.Text.ToString())); oRegistro.Borrado = true; oRegistro.Actualizar(); this.Nuevo(); this.Consulta(); MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception) { } }
public void Presentar(int id) { App_Code.Inventario.Departamentos oRegistro = new App_Code.Inventario.Departamentos(id); this.lblFicha.Text = oRegistro.Id.ToString("0"); this.txtCodigo.Text = oRegistro.Codigo; this.txtNombre.Text = oRegistro.Nombre; this.txtPrecioMaximo.Text = oRegistro.PrecioMaximo.ToString("#,##0.00"); this.txtPrecioOferta.Text = oRegistro.PrecioOferta.ToString("#,##0.00"); this.txtPrecioMayor.Text = oRegistro.PrecioMayor.ToString("#,##0.00"); this.txtPrecioMinimo.Text = oRegistro.PrecioMinimo.ToString("#,##0.00"); this.txtCCPrecioMaximo.Text = oRegistro.ComisionCobranzaPrecioMaximo.ToString("#,##0.00"); this.txtCCPrecioOferta.Text = oRegistro.ComisionCobranzaPrecioOferta.ToString("#,##0.00"); this.txtCCPrecioMayor.Text = oRegistro.ComisionCobranzaPrecioMayor.ToString("#,##0.00"); this.txtCCPrecioMinimo.Text = oRegistro.ComisionCobranzaPrecioMinimo.ToString("#,##0.00"); this.txtCVPrecioMaximo.Text = oRegistro.ComisionVentaPrecioMaximo.ToString("#,##0.00"); this.txtCVPrecioOferta.Text = oRegistro.ComisionVentaPrecioOferta.ToString("#,##0.00"); this.txtCVPrecioMayor.Text = oRegistro.ComisionVentaPrecioMayor.ToString("#,##0.00"); this.txtCVPrecioMinimo.Text = oRegistro.ComisionVentaPrecioMinimo.ToString("#,##0.00"); if (oRegistro.Imagen == "Ninguna" || oRegistro.Imagen == null) { this.campoFoto.Image = Properties.Resources.Factory; } else { try { this.campoFoto.Image = Image.FromFile(dest + oRegistro.Imagen); this.lblNombreFoto.Text = oRegistro.Imagen; } catch (Exception) { this.campoFoto.Image = Properties.Resources.Factory; this.lblNombreFoto.Text = "Ninguna"; } } this.txtCodigo.BackColor = Color.White; this.txtNombre.BackColor = Color.White; oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300204"); if (!oFuncion.Err) { this.btnEliminar.Enabled = true; } }
public void Guardar() { App_Code.Inventario.Departamentos oRegistro = new App_Code.Inventario.Departamentos(int.Parse(this.lblFicha.Text)); oRegistro.Codigo = this.txtCodigo.Text.ToString().ToUpper(); oRegistro.Nombre = this.txtNombre.Text.ToString().ToUpper(); oRegistro.PrecioMayor = double.Parse(this.txtPrecioMayor.Text.ToString()); oRegistro.PrecioOferta = double.Parse(this.txtPrecioOferta.Text.ToString()); oRegistro.PrecioMaximo = double.Parse(this.txtPrecioMaximo.Text.ToString()); oRegistro.PrecioMinimo = double.Parse(this.txtPrecioMinimo.Text.ToString()); oRegistro.ComisionVentaPrecioMayor = double.Parse(this.txtCVPrecioMayor.Text.ToString()); oRegistro.ComisionVentaPrecioOferta = double.Parse(this.txtCVPrecioOferta.Text.ToString()); oRegistro.ComisionVentaPrecioMaximo = double.Parse(this.txtCVPrecioMaximo.Text.ToString()); oRegistro.ComisionVentaPrecioMinimo = double.Parse(this.txtCVPrecioMinimo.Text.ToString()); oRegistro.ComisionCobranzaPrecioMayor = double.Parse(this.txtCCPrecioMayor.Text.ToString()); oRegistro.ComisionCobranzaPrecioOferta = double.Parse(this.txtCCPrecioOferta.Text.ToString()); oRegistro.ComisionCobranzaPrecioMaximo = double.Parse(this.txtCCPrecioMaximo.Text.ToString()); oRegistro.ComisionCobranzaPrecioMinimo = double.Parse(this.txtCCPrecioMinimo.Text.ToString()); if (this.lblNombreFoto.Text == "Nombre") { oRegistro.Imagen = "Ninguna"; } else { oRegistro.Imagen = this.lblNombreFoto.Text; } oRegistro.Borrado = false; oRegistro.UserLogId = frmPrincipal.id_usuario; try { if (!Validar()) { if (oRegistro.Err) { oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300202"); if (oFuncion.Err) { MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { oRegistro.Creado = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy hh:mm tt")); oRegistro.Modificado = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy hh:mm tt")); oRegistro.Insertar(); } } else { oFuncion.Leer(panterasoftware.Formularios.frmPrincipal.id_grupo_usuario, "0300203"); if (oFuncion.Err) { MessageBox.Show("Disculpe Usted No Tiene Acceso a Esta Accion", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } else { oRegistro.Modificado = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy hh:mm tt")); oRegistro.Actualizar(); } } MessageBox.Show(oRegistro.Msg, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Consulta(); this.Presentar(oRegistro.Id); } } catch (Exception) { } }