private void save()
        {
            if (u_Validate())
            {
                if (Examinar.IsCurrentCellInEditMode)
                {
                    Examinar.CommitEdit(DataGridViewDataErrorContexts.Commit);
                }
                Tabla.AcceptChanges();
                for (lc_cont = 0; lc_cont <= Tabla.Rows.Count - 1; lc_cont++)
                {
                    Tabla.Rows[lc_cont]["perianio"] = spnperiodo.Value.ToString();
                    Tabla.Rows[lc_cont]["perimes"] = cboMesIni.SelectedValue;
                    Tabla.Rows[lc_cont]["tipoplla"] = cmbtipoplanilla.SelectedValue;
                }
                Tabla.AcceptChanges();

                var BL = new tb_plla_afectacionesvacBL();
                var BE = new tb_plla_afectacionesvac();

                BE.perianio = spnperiodo.Value.ToString();
                BE.perimes = cboMesIni.SelectedValue.ToString();
                BE.tipoplla = cmbtipoplanilla.SelectedValue.ToString();
                if (BL.Insert_Update(VariablesPublicas.EmpresaID, BE, Tabla))
                {
                    U_CancelarEdicion(0);
                }
                else
                {
                    Frm_Class.ShowError(BL.Sql_Error, this);
                }
            }
        }
        private void Accion(int naccion)
        {
            switch (naccion)
            {
                case 1:
                    u_n_opsel = 1;
                    U_RefrescaControles();
                    if ((Examinar.CurrentRow != null))
                    {
                        Examinar.CurrentRow.Selected = false;
                    }
                    break;
                case 2:
                    if (!VariablesPublicas.u_Cerrado(VariablesPublicas.EmpresaID, VariablesPublicas.perianio, cboMesIni.SelectedValue.ToString(), "03", cmbtipoplanilla.SelectedValue.ToString(), ""))
                    {
                        u_n_opsel = 2;
                        U_RefrescaControles();
                        if ((Examinar.CurrentRow != null))
                        {
                            Examinar.CurrentRow.Selected = true;
                        }
                    }
                    break;
                case 3:
                    if (!VariablesPublicas.u_Cerrado(VariablesPublicas.EmpresaID, VariablesPublicas.perianio, cboMesIni.SelectedValue.ToString(), "03", cmbtipoplanilla.SelectedValue.ToString(), "Eliminar"))
                    {
                        xnomcampo = "";
                        if ((Examinar.CurrentRow != null))
                        {
                            if (xnomcampo.Length == 0)
                            {
                                var message = "Desea eliminar Registro  " + Examinar.Rows[Examinar.CurrentRow.Index].Cells["rubroid"].Value.ToString() + " - " + Examinar.Rows[Examinar.CurrentRow.Index].Cells["rubroname"].Value.ToString() + "...?";
                                var caption = "Mensaje del Sistema";
                                var buttons = MessageBoxButtons.YesNo;
                                DialogResult result;
                                result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                                var BL = new tb_plla_afectacionesvacBL();
                                var BE = new tb_plla_afectacionesvac();

                                BE.perianio = spnperiodo.Value.ToString();
                                BE.perimes = cboMesIni.SelectedValue.ToString();
                                BE.tipoplla = cmbtipoplanilla.SelectedValue.ToString();
                                BE.rubroid = Examinar.Rows[Examinar.CurrentRow.Index].Cells["rubroid"].Value.ToString();
                                if (BL.Delete(VariablesPublicas.EmpresaID, BE))
                                {
                                    U_CancelarEdicion(0);
                                }
                                else
                                {
                                    Frm_Class.ShowError(BL.Sql_Error, this);
                                }
                            }
                            else
                            {
                                MessageBox.Show(xnomcampo, "IMPOSIBLE ELIMINAR REGISTRO");
                            }
                        }
                    }
                    break;
            }
        }
        private void CargaDatos()
        {
            var xcodmes = "99";
            var xtipoplanilla = ".";
            var sorted = default(SortOrder);
            var xnomcolumna = string.Empty;
            if ((cboMesIni.SelectedValue != null))
            {
                xcodmes = cboMesIni.SelectedValue.ToString();
            }
            if ((cmbtipoplanilla.SelectedValue != null))
            {
                xtipoplanilla = cmbtipoplanilla.SelectedValue.ToString();
            }
            if ((Examinar.SortedColumn != null))
            {
                xnomcolumna = Examinar.Columns[Examinar.SortedColumn.Index].Name;
                sorted = Examinar.SortOrder;
            }
            var BL = new tb_plla_afectacionesvacBL();
            var BE = new tb_plla_afectacionesvac();

            BE.perianio = spnperiodo.Value.ToString();
            BE.perimes = xcodmes;
            BE.tipoplla = xtipoplanilla;
            Tabla = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0];
            Examinar.AutoGenerateColumns = false;
            Examinar.DataSource = Tabla;
        }