private bool verificarRubroExistente() { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.verificarRubro(txtCodigo.Text,txtDescripcion.Text); if (ds.Tables[0].Rows.Count > 0) { if (int.Parse(ds.Tables[0].Rows[0]["RESULTADO"].ToString()) == 1) { MessageBox.Show("El rubro " + txtDescripcion.Text + " ya existe.", "Alta de Rubro.", MessageBoxButtons.OK, MessageBoxIcon.Information); txtDescripcion.Focus(); return false; } else { return true; } } else { return false; } } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } }
private void cargarComboCampo() { try { string campoSelec = cboCampo.Text; cboCampo.Items.Clear(); Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); Ds = entRubros.obtenerCamposRubros(); foreach (DataRow dataRow in Ds.Tables[0].Rows) { cboCampo.Items.Add(dataRow["CAMPO"]); switch (dataRow["CAMPO"].ToString()) { case "CÓDIGO": campos_tabla.Add("Id_Rubro", (dataRow["CAMPO"].ToString())); break; case "DESCRIPCIÓN": campos_tabla.Add("Descripcion", (dataRow["CAMPO"].ToString())); break; default: campos_tabla.Add((dataRow["CAMPO"].ToString()), dataRow["CAMPO"].ToString()); break; } } cboCampo.Text = campoSelec; } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private bool verificarRubroExistente() { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.verificarRubro(txtCodigo.Text, txtDescripcion.Text); if (ds.Tables[0].Rows.Count > 0) { if (int.Parse(ds.Tables[0].Rows[0]["RESULTADO"].ToString()) == 1) { MessageBox.Show("El rubro " + txtDescripcion.Text + " ya existe.", "Alta de Rubro.", MessageBoxButtons.OK, MessageBoxIcon.Information); txtDescripcion.Focus(); return(false); } else { return(true); } } else { return(false); } } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void altaDeRubro() { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); entRubros.nuevoRubro(txtDescripcion.Text); this.Hide(); } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void altaDeRubro() { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); entRubros.nuevoRubro(txtDescripcion.Text.Trim()); this.Hide(); } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void buscarRubro() { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.obtenerRubros(); if (ds.Tables[0].Rows.Count > 0) { mostrarFormularioBusquedaRubros(); llenarGrilla(); grdRubros = fg.formatoGrilla(grdRubros, 1); grdRubros.Focus(); } else { MessageBox.Show("No existen Rubros.", "Información.", MessageBoxButtons.OK, MessageBoxIcon.Information); btnBuscar.Focus(); } }
private void llenarGrilla() { try { if (EstoyBuscando == false) { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.obtenerRubros(); if (ds.Tables[0].Rows.Count > 0) { grdRubros.DataSource = ds.Tables[0]; } else { grdRubros.DataSource = null; } } else { cadenaSql = "EXEC adp_busqueda_rubros"; cadenaSql = cadenaSql + " @tabla = " + fg.fcSql("RUBROS", "String"); cadenaSql = cadenaSql + ",@campo_tabla = " + fg.fcSql(obtenerCampoTabla().ToString(), "String"); cadenaSql = cadenaSql + ",@texto = " + fg.fcSql(textoAnterior, "String"); ds = objConect.ejecutarQuerySelect(cadenaSql); if (ds.Tables[0].Rows.Count > 0) { grdRubros.DataSource = ds.Tables[0]; } } if ((filaSeleccionada > 0) && (celdaSeleccionada > 0) &&(filaSeleccionada <= grdRubros.Rows.Count - 1)) { grdRubros[celdaSeleccionada, filaSeleccionada].Selected = true; } } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void llenarGrilla() { try { if (EstoyBuscando == false) { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.obtenerRubros(); if (ds.Tables[0].Rows.Count > 0) { grdRubros.DataSource = ds.Tables[0]; } else { grdRubros.DataSource = null; } } else { cadenaSql = "EXEC adp_busqueda_rubros"; cadenaSql = cadenaSql + " @tabla = " + fg.fcSql("RUBROS", "String"); cadenaSql = cadenaSql + ",@campo_tabla = " + fg.fcSql(obtenerCampoTabla().ToString(), "String"); cadenaSql = cadenaSql + ",@texto = " + fg.fcSql(textoAnterior, "String"); ds = objConect.ejecutarQuerySelect(cadenaSql); if (ds.Tables[0].Rows.Count > 0) { grdRubros.DataSource = ds.Tables[0]; } } if ((filaSeleccionada > 0) && (celdaSeleccionada > 0) && (filaSeleccionada <= grdRubros.Rows.Count - 1)) { grdRubros[celdaSeleccionada, filaSeleccionada].Selected = true; } } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void cargarCodigoRubro() { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.obtenerMaximoRubro(); if (ds.Tables[0].Rows.Count > 0) { txtCodigo.Text = ds.Tables[0].Rows[0]["maximo"].ToString(); } else { return; } } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void eliminarRubro() { celdaSeleccionada = grdRubros.CurrentCellAddress.X; filaSeleccionada = grdRubros.CurrentCellAddress.Y; string descripcion_rubro = grdRubros.Rows[filaSeleccionada].Cells["DESCRIPCIÓN"].Value.ToString(); string id_Rubro = grdRubros.Rows[filaSeleccionada].Cells["CÓDIGO"].Value.ToString(); if (MessageBox.Show("¿Está seguro que desea eliminar el Rubro " + id_Rubro + "-" + descripcion_rubro + "?", "Eliminar Rubro.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.verificoRubroDelProveedor(id_Rubro); if (ds.Tables[0].Rows.Count == 1) { MessageBox.Show("No se puede eliminar el Rubro " + id_Rubro + "-" + descripcion_rubro + " porque existe un proveedor que lo tiene asignado.", "Información.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } else { entRubros.eliminarRubro(id_Rubro); grdRubros.Focus(); } } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { btnEliminar.Focus(); } }
private void cargarComboCampo() { try { DataSet ds = new DataSet(); string campoSelec = cboCampo.Text; cboCampo.Items.Clear(); Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); ds = entRubros.obtenerCamposRubros(); foreach (DataRow dataRow in ds.Tables[0].Rows) { cboCampo.Items.Add(dataRow["CAMPO"]); } cboCampo.Text = campoSelec; } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void modificoRubro() { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); entRubros.modificarRubro(txtCodigo.Text, txtDescripcion.Text.Trim()); }
private void modificoRubro() { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); entRubros.modificarRubro(txtCodigo.Text, txtDescripcion.Text); }
private void eliminarRubro() { celdaSeleccionada = grdRubros.CurrentCellAddress.X; filaSeleccionada = grdRubros.CurrentCellAddress.Y; string descripcion_rubro = grdRubros.Rows[filaSeleccionada].Cells["DESCRIPCIÓN"].Value.ToString(); string id_Rubro = grdRubros.Rows[filaSeleccionada].Cells["CÓDIGO"].Value.ToString(); if (MessageBox.Show("¿Está seguro que desea eliminar el Rubro " + id_Rubro + "-" + descripcion_rubro + "?", "Eliminar Rubro.", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros(); entRubros.eliminarRubro(id_Rubro); grdRubros.Focus(); } catch (Exception e) { MessageBox.Show(e.Message.ToString(), "Atención.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { btnEliminar.Focus(); } }