private void data_Tablatipodocserie()
        {
            try
            {
                if (Tablatipodocserie != null)
                {
                    Tablatipodocserie.Rows.Clear();
                }
                var BL = new modulo_local_tipodocseriesBL();
                var BE = new tb_modulo_local_tipodocseries();

                BE.dominioid = txt_dominioid.Text.Trim();
                BE.moduloid = txt_moduloid.Text.Trim();
                BE.local = txt_local.Text.Trim();
                BE.tipodoc = txt_tipodoc.Text.Trim();

                Tablatipodocserie = BL.GetAll(EmpresaID, BE).Tables[0];
                if (Tablatipodocserie.Rows.Count > 0)
                {
                    gridtipodocserie.DataSource = Tablatipodocserie;
                    gridtipodocserie.Rows[0].Selected = false;
                    gridtipodocserie.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ValidaTipodoc_nuevo_serdoc()
        {
            var BL = new modulo_local_tipodocseriesBL();
            var BE = new tb_modulo_local_tipodocseries();
            var dt = new DataTable();

            BE.dominioid = txt_dominioid.Text.Trim();
            BE.moduloid = txt_moduloid.Text.Trim();
            BE.local = txt_local.Text.Trim();
            BE.tipodoc = txt_tipodoc.Text.Trim();
            BE.serdoc = tipodocserie.Text.Trim();
            dt = BL.GetAll(EmpresaID, BE).Tables[0];

            if (dt.Rows.Count == 0 && Convert.ToInt16(tipodocserie.Text.Trim().PadLeft(1, '0')) > 0)
            {
                mensajesd.Text = "VALIDO";
                mensajesd.ForeColor = Color.Green;
                tipodocserienumero.Enabled = true;
                tipodocserienumero.Focus();

                btn_nuevosd.Enabled = false;
                btn_grabarsd.Enabled = true;
                btn_eliminarsd.Enabled = false;
                btn_editarsd.Enabled = false;
                btn_calcelarsd.Enabled = true;
            }
            else
            {
                mensajesd.Text = "YA EXISTE";
                mensajesd.ForeColor = Color.Red;
                tipodocserie.Focus();

                btn_nuevosd.Enabled = false;
                btn_grabarsd.Enabled = false;
                btn_eliminarsd.Enabled = false;
                btn_editarsd.Enabled = false;
                btn_calcelarsd.Enabled = true;
            }
        }