Пример #1
0
        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;
            }
        }
Пример #2
0
        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;
            }
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
 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;
     }
 }
Пример #5
0
 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;
     }
 }
Пример #6
0
 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();
     }
 }
Пример #7
0
        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;
            }
        }
Пример #8
0
        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;
            }
        }
Пример #9
0
        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;
            }
        }
Пример #10
0
        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;
            }
        }
Пример #11
0
        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;
            }
        }
Пример #12
0
        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();
            }
        }
Пример #13
0
        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;
            }
        }
Пример #14
0
        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;
            }
        }
Пример #15
0
        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();
            }
        }
Пример #16
0
 private void modificoRubro()
 {
     Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros();
     entRubros.modificarRubro(txtCodigo.Text, txtDescripcion.Text.Trim());
 }
Пример #17
0
 private void modificoRubro()
 {
     Entidades.Rubros entRubros = new ADBISYS.Entidades.Rubros();
     entRubros.modificarRubro(txtCodigo.Text, txtDescripcion.Text);
 }
Пример #18
0
 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();
     }
 }
Пример #19
0
        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();
            }
        }