public bool Delete(string empresaid, tb_plla_rubrospllacab BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllarubrospllacab_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = BE.rubrocod;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Insert_Update(string empresaid, tb_plla_rubrospllacab BE, DataTable Cabaecera, DataTable Detalle)
 {
     //return tablaDA.Insert(empresaid, BE);
     bool zreturn = tablaDA.Insert_Update(empresaid, BE, Cabaecera, Detalle);
     Sql_Error = tablaDA.Sql_Error;
     return zreturn;
 }
 public bool Insert(string empresaid, tb_plla_rubrospllacab BE)
 {
     //return tablaDA.Insert(empresaid, BE);
     bool zreturn = tablaDA.Insert(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return zreturn;
 }
 public DataSet GetOne(string empresaid, tb_plla_rubrospllacab BE)
 {
     //return tablaDA.GetOne(empresaid, tipoplla);
     DataSet xreturn = null;
     xreturn = tablaDA.GetOne(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetAll_CONSULTA(string empresaid, tb_plla_rubrospllacab BE)
 {
     //return tablaDA.GetAll_CONSULTA(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAll_CONSULTA(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 //public bool cabRubrosPlanilla_UPDATE(DataTable cabecera, DataTable detalle)
 //{
 //    int lc_contcab = 0;
 //    int lccontdetalle = 0;
 //    int retorno = -1;
 //    if (SQL_CONNECT(true))
 //    {
 //        try
 //        {
 //            retorno = 0;
 //            for (lc_contcab = 0; lc_contcab <= cabecera.Rows.Count - 1; lc_contcab++)
 //            {
 //                if ((detalle != null))
 //                {
 //                    AddStore("detRubrosPlanilla_delete");
 //                    AddParametro("@codigo", SqlDbType.Char, cabecera.Rows[lc_contcab]["codrubro"]);
 //                    retorno = COMANDOSQL.ExecuteNonQuery;
 //                    COMANDOSQL.Parameters.Clear();
 //                }
 //                AddStore("cabRubrosPlanilla_update");
 //                AddParametro("@codrubro", SqlDbType.Char, cabecera.Rows[lc_contcab]["codrubro"]);
 //                AddParametro("@tipoplanilla", SqlDbType.Char, cabecera.Rows[lc_contcab]["tipoplanilla"]);
 //                AddParametro("@tipo", SqlDbType.Char, cabecera.Rows[lc_contcab]["tipo"]);
 //                AddParametro("@desrubro", SqlDbType.VarChar, cabecera.Rows[lc_contcab]["desrubro"]);
 //                AddParametro("@abrevrubro", SqlDbType.VarChar, cabecera.Rows[lc_contcab]["abrevrubro"]);
 //                retorno = COMANDOSQL.ExecuteNonQuery();
 //                COMANDOSQL.Parameters.Clear();
 //                if ((detalle != null))
 //                {
 //                    for (lccontdetalle = 0; lccontdetalle <= detalle.Rows.Count - 1; lccontdetalle++)
 //                    {
 //                        AddStore("DesRubrosPlanilla_update");
 //                        AddParametro("@codrubro", SqlDbType.Char, detalle.Rows[lccontdetalle]["codrubro"]);
 //                        AddParametro("@ccia_pla", SqlDbType.Char, detalle.Rows[lccontdetalle]["ccia_pla"]);
 //                        AddParametro("@tipo_pla", SqlDbType.Char, detalle.Rows[lccontdetalle]["tipo_pla"]);
 //                        AddParametro("@rubro_pla", SqlDbType.Char, detalle.Rows[lccontdetalle]["rubro_pla"]);
 //                        AddParametro("@norden", SqlDbType.Int, detalle.Rows[lccontdetalle]["norden"]);
 //                        retorno = COMANDOSQL.ExecuteNonQuery;
 //                        COMANDOSQL.Parameters.Clear();
 //                    }
 //                }
 //            }
 //            retorno = 1;
 //        }
 //        catch (Exception ex)
 //        {
 //            Sql_Error = ex.Message;
 //            retorno = 0;
 //        }
 //        SQL_DISCONNECT();
 //    }
 //    return retorno == 1;
 //}
 public bool Update(string empresaid, tb_plla_rubrospllacab BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllarubrospllacab_UPDATE", cnx))
         {
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = BE.rubrocod;
                 cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.tipoplla;
                 cmd.Parameters.Add("@tiporubro", SqlDbType.Char, 1).Value = BE.tiporubro;
                 cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 60).Value = BE.rubroname;
                 cmd.Parameters.Add("@rubroabrev", SqlDbType.VarChar, 30).Value = BE.rubroabrev;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        public bool Insert_Update(string empresaid, tb_plla_rubrospllacab BE, DataTable Cabecera, DataTable Detalle)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                bool xreturn = true;
                int lcont = 0;
                int lccontdetalle = 0;
                for (lcont = 0; lcont <= Cabecera.Rows.Count - 1; lcont++)
                {
                    if ((Detalle != null))
                    {
                        using (SqlCommand cmd = new SqlCommand("gspTbPllarubrosplladet_Eliminar", cnx))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = Cabecera.Rows[lcont]["rubrocod"];
                            try
                            {
                                cnx.Open();
                                if (cmd.ExecuteNonQuery() > 0)
                                {
                                    xreturn = true;
                                }
                                else
                                {
                                    xreturn = false;
                                }
                                cnx.Close();
                            }
                            catch (Exception ex)
                            {
                                Sql_Error = ex.Message;
                                //throw new Exception(ex.Message);
                                xreturn = false;
                                cnx.Close();
                            }
                        }
                    }

                    using (SqlCommand cmd = new SqlCommand("gspTbPllarubrospllacab_InsertUpdate", cnx))
                    {
                        cmd.CommandTimeout = 0;
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = Cabecera.Rows[lcont]["rubrocod"];
                        cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = Cabecera.Rows[lcont]["tipoplla"];
                        cmd.Parameters.Add("@tiporubro", SqlDbType.Char, 1).Value = Cabecera.Rows[lcont]["tiporubro"];
                        cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 60).Value = Cabecera.Rows[lcont]["rubroname"];
                        cmd.Parameters.Add("@rubroabrev", SqlDbType.VarChar, 30).Value = Cabecera.Rows[lcont]["rubroabrev"];
                        try
                        {
                            cnx.Open();
                            if (cmd.ExecuteNonQuery() > 0)
                            {
                                xreturn = true;
                            }
                            else
                            {
                                xreturn = false;
                            }
                            cnx.Close();
                        }
                        catch (Exception ex)
                        {
                            Sql_Error = ex.Message;
                            //throw new Exception(ex.Message);
                            xreturn = false;
                            cnx.Close();
                        }
                    }

                    if ((Detalle != null))
                    {
                        for (lccontdetalle = 0; lccontdetalle <= Detalle.Rows.Count - 1; lccontdetalle++)
                        {
                            using (SqlCommand cmd = new SqlCommand("gspTbPllarubrosplladet_InsertUpdate", cnx))
                            {
                                cmd.CommandTimeout = 0;
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = Detalle.Rows[lccontdetalle]["rubrocod"];
                                cmd.Parameters.Add("@empresaid", SqlDbType.Char, 2).Value = Detalle.Rows[lccontdetalle]["empresaid"];
                                cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = Detalle.Rows[lccontdetalle]["tipoplla"];
                                cmd.Parameters.Add("@rubroid", SqlDbType.Char, 3).Value = Detalle.Rows[lccontdetalle]["rubroid"];
                                cmd.Parameters.Add("@norden", SqlDbType.Int).Value = Detalle.Rows[lccontdetalle]["norden"];
                                try
                                {
                                    cnx.Open();
                                    if (cmd.ExecuteNonQuery() > 0)
                                    {
                                        xreturn = true;
                                    }
                                    else
                                    {
                                        xreturn = false;
                                    }
                                    cnx.Close();
                                }
                                catch (Exception ex)
                                {
                                    Sql_Error = ex.Message;
                                    //throw new Exception(ex.Message);
                                    xreturn = false;
                                    cnx.Close();
                                }
                            }
                        }
                    }
                }
                return xreturn;
            }
        }
        public DataSet GetOne(string empresaid, tb_plla_rubrospllacab BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbPllarubrospllacab_SELECT", cnx))
                {
                    DataSet ds = new DataSet();
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 4).Value = BE.rubrocod;
                    }

                    try
                    {
                        cnx.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        Sql_Error = ex.Message;
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
 public DataSet GetAll_MaxRubro(string empresaid, tb_plla_rubrospllacab BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllarubrospllacab_MAXCOD_RUBROGENPLLA", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 //cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = BE.rubrocod;
                 //cmd.Parameters.Add("@tiporubro", SqlDbType.Char, 1).Value = BE.tiporubro;
                 //cmd.Parameters.Add("@nomlike1", SqlDbType.VarChar, 60).Value = BE.nomlike1;
                 //cmd.Parameters.Add("@nomlike2", SqlDbType.VarChar, 60).Value = BE.nomlike2;
                 //cmd.Parameters.Add("@nomlike3", SqlDbType.VarChar, 60).Value = BE.nomlike3;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll_CONSULTA(string empresaid, tb_plla_rubrospllacab BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPllarubrospllacab_CONSULTA", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@rubrocod", string.IsNullOrEmpty(BE.rubrocod) ? (object)DBNull.Value : BE.rubrocod);
                 cmd.Parameters.AddWithValue("@tiporubro", string.IsNullOrEmpty(BE.tiporubro) ? (object)DBNull.Value : BE.tiporubro);
                 cmd.Parameters.AddWithValue("@nomlike1", string.IsNullOrEmpty(BE.nomlike1) ? (object)DBNull.Value : BE.nomlike1);
                 cmd.Parameters.AddWithValue("@nomlike2", string.IsNullOrEmpty(BE.nomlike2) ? (object)DBNull.Value : BE.nomlike2);
                 cmd.Parameters.AddWithValue("@nomlike3", string.IsNullOrEmpty(BE.nomlike3) ? (object)DBNull.Value : BE.nomlike3);
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        //public bool cabRubrosPlanilla_DELETE(DataTable cabecera)
        //{
        //    int lc_contcab = 0;
        //    int retorno = -1;
        //    if (SQL_CONNECT(true))
        //    {
        //        try
        //        {
        //            retorno = 0;
        //            for (lc_contcab = 0; lc_contcab <= cabecera.Rows.Count - 1; lc_contcab++)
        //            {
        //                AddStore("detRubrosPlanilla_delete");
        //                AddParametro("@codigo", SqlDbType.Char, cabecera.Rows[lc_contcab]["codrubro"]);
        //                retorno = COMANDOSQL.ExecuteNonQuery;
        //                COMANDOSQL.Parameters.Clear();
        //                AddStore("cabRubrosPlanilla_delete");
        //                AddParametro("@codigo", SqlDbType.Char, cabecera.Rows[lc_contcab]["codrubro"]);
        //                retorno = COMANDOSQL.ExecuteNonQuery();
        //                COMANDOSQL.Parameters.Clear();
        //            }
        //            retorno = 1;
        //        }
        //        catch (Exception ex)
        //        {
        //            Sql_Error = ex.Message;
        //            retorno = 0;
        //        }
        //        SQL_DISCONNECT();
        //    }
        //    return retorno == 1;
        //}
        public DataSet GetAll(string empresaid, tb_plla_rubrospllacab BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbPllaRubrospllacab_SEARCH", cnx))
                {
                    DataSet ds = new DataSet();
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@rubrocod", string.IsNullOrEmpty(BE.rubrocod) ? (object)DBNull.Value : BE.rubrocod);
                        cmd.Parameters.AddWithValue("@tipoplla", string.IsNullOrEmpty(BE.tipoplla) ? (object)DBNull.Value : BE.tipoplla);
                        cmd.Parameters.AddWithValue("@tiporubro", string.IsNullOrEmpty(BE.tiporubro) ? (object)DBNull.Value : BE.tiporubro);
                        cmd.Parameters.AddWithValue("@rubroname", string.IsNullOrEmpty(BE.rubroname) ? (object)DBNull.Value : BE.rubroname);
                        cmd.Parameters.AddWithValue("@rubroabrev", string.IsNullOrEmpty(BE.rubroabrev) ? (object)DBNull.Value : BE.rubroabrev);

                        //cmd.Parameters.Add("@rubrocod", SqlDbType.Char, 5).Value = BE.rubrocod;
                        //cmd.Parameters.Add("@tipoplla", SqlDbType.Char, 1).Value = BE.tipoplla;
                        //cmd.Parameters.Add("@tiporubro", SqlDbType.Char, 1).Value = BE.tiporubro;
                        //cmd.Parameters.Add("@rubroname", SqlDbType.VarChar, 60).Value = BE.rubroname;
                        //cmd.Parameters.Add("@rubroabrev", SqlDbType.VarChar, 30).Value = BE.rubroabrev;
                    }
                    try
                    {
                        cnx.Open();
                        using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        Sql_Error = ex.Message;
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
        private void CargaDatos()
        {
            var xcodactual = string.Empty;
            if (Examinar.CurrentRow != null)
            {
                xcodactual = Examinar.Rows[Examinar.CurrentRow.Index].Cells["rubrocod"].Value.ToString();
            }
            var nposcolumnasortear = 0;
            var PrvSotOrder = default(SortOrder);
            var zordenado = false;
            var xpalabra1 = string.Empty;
            var xpalabra2 = string.Empty;
            var xpalabra3 = string.Empty;

            if (txtfiltronombre.Text.Trim().Length > 0 & txtfiltronombre.Enabled)
            {
                xpalabra1 = VariablesPublicas.Palabras(txtfiltronombre.Text, 1);
                xpalabra2 = VariablesPublicas.Palabras(txtfiltronombre.Text, 2);
                xpalabra3 = VariablesPublicas.Palabras(txtfiltronombre.Text, 3);
            }
            var xtipo = string.Empty;
            var xvmcodigo = string.Empty;
            if (Examinar.CurrentRow != null)
            {
            }
            if (Examinar.SortedColumn != null)
            {
                nposcolumnasortear = Examinar.SortedColumn.Index;
                PrvSotOrder = Examinar.SortOrder;
                zordenado = true;
            }
            if (cmbfiltrotipo.Enabled)
            {
                if (cmbfiltrotipo.SelectedValue != null)
                {
                    xtipo = cmbfiltrotipo.SelectedValue.ToString();
                }
            }

            var BL = new tb_plla_rubrospllacabBL();
            var BE = new tb_plla_rubrospllacab();

            BE.rubrocod = xvmcodigo;
            BE.tiporubro = xtipo;
            BE.nomlike1 = xpalabra1;
            BE.nomlike2 = xpalabra2;
            BE.nomlike3 = xpalabra3;
            tablacabprestamos = BL.GetAll_CONSULTA(VariablesPublicas.EmpresaID, BE).Tables[0];
            lbltotaltrab.Text = "Sin Registros";
            if (BL.Sql_Error.Length == 0)
            {
                lbltotaltrab.Text = "Total Registros " + tablacabprestamos.Rows.Count.ToString();
            }
            Examinar.AutoGenerateColumns = false;
            Examinar.DataSource = tablacabprestamos;

            VariablesPublicas.PintaEncabezados(Examinar);
            if (zordenado)
            {
                if (PrvSotOrder == SortOrder.Ascending)
                {
                    Examinar.Sort(Examinar.Columns[nposcolumnasortear], System.ComponentModel.ListSortDirection.Ascending);
                }
                else
                {
                    Examinar.Sort(Examinar.Columns[nposcolumnasortear], System.ComponentModel.ListSortDirection.Descending);
                }
            }
            else
            {
                Examinar.Sort(Examinar.Columns["rubrocod"], System.ComponentModel.ListSortDirection.Ascending);
            }
            if (Examinar.CurrentRow == null)
            {
                if (Examinar.RowCount > 0)
                {
                    Examinar.CurrentCell = Examinar.Rows[0].Cells["rubroname"];
                }
            }
            for (lc_contador = 0; lc_contador <= Examinar.Rows.Count - 1; lc_contador++)
            {
                if (Examinar.Rows[lc_contador].Cells["rubrocod"].Value.ToString() == xcodactual)
                {
                    Examinar.CurrentCell = Examinar.Rows[lc_contador].Cells["rubroname"];
                    break;
                }
            }
            U_RefrescaControles();
        }
        private void btnnuevo_Click(object sender, EventArgs e)
        {
            if (!(TabControl1.SelectedIndex == 0))
            {
                TabControl1.SelectedIndex = 0;
            }
            u_n_opsel = 1;
            Blanquear();
            TabControl1.SelectedIndex = 0;
            TabControl1.SelectedIndex = 1;
            var BL = new tb_plla_rubrospllacabBL();
            var BE = new tb_plla_rubrospllacab();

            txtcodigo.Text = BL.GetAll_MaxRubro(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0].Rows[0]["maximo_codigo"].ToString();
            txtdescripcion.Text = string.Empty;
            cmbtipo.SelectedValue = "I";
            u_CargaAnexos();
            txtdescripcion.Focus();
        }
        private void btngrabar_Click(object sender, EventArgs e)
        {
            if (U_Validacion())
            {
                if (u_n_opsel == 1)
                {
                    var BL = new tb_plla_rubrospllacabBL();
                    var BE = new tb_plla_rubrospllacab();

                    BE.rubrocod = txtcodigo.Text.Trim();
                    tmptabla = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0];
                    if (tmptabla.Rows.Count > 0)
                    {
                        var BLMAX = new tb_plla_rubrospllacabBL();
                        var BEMAX = new tb_plla_rubrospllacab();

                        txtcodigo.Text = BLMAX.GetAll_MaxRubro(VariablesPublicas.EmpresaID.ToString(), BEMAX).Tables[0].Rows[0]["maximo_codigo"].ToString();
                    }
                    tmptabla.Rows.Add(VariablesPublicas.InsertIntoTable(tmptabla));
                    tmptabla.Rows[0]["rubrocod"] = txtcodigo.Text.Trim();
                    tmptabla.Rows[0]["tipoplla"] = xtipplla;
                }
                else
                {
                    var BL = new tb_plla_rubrospllacabBL();
                    var BE = new tb_plla_rubrospllacab();

                    BE.rubrocod = txtcodigo.Text.Trim();
                    tmptabla = BL.GetAll(VariablesPublicas.EmpresaID, BE).Tables[0];
                }

                for (lc_contador = 0; lc_contador <= tabladetprestamos.Rows.Count - 1; lc_contador++)
                {
                    tabladetprestamos.Rows[lc_contador]["rubrocod"] = txtcodigo.Text.Trim();
                }
                tmptabla.Rows[0]["tiporubro"] = cmbtipo.SelectedValue;
                tmptabla.Rows[0]["rubroname"] = txtdescripcion.Text;
                tmptabla.AcceptChanges();
                tabladetprestamos.AcceptChanges();

                var BLIU = new tb_plla_rubrospllacabBL();
                var BEIU = new tb_plla_rubrospllacab();
                if (BLIU.Insert_Update(VariablesPublicas.EmpresaID, BEIU, tmptabla, tabladetprestamos))
                {
                    seguridadlog();
                    U_CancelarEdicion(0);
                }
                else
                {
                    Frm_Class.ShowError(BLIU.Sql_Error, this);
                }
            }
        }
        private void btneliminar_Click(object sender, EventArgs e)
        {
            if (Examinar.CurrentRow != null)
            {
                var xnomcampo = string.Empty;
                if (xnomcampo.Length == 0)
                {
                    var BLC = new tb_plla_rubrospllacabBL();
                    var BEC = new tb_plla_rubrospllacab();

                    BEC.rubrocod = Examinar.Rows[Examinar.CurrentRow.Index].Cells["rubrocod"].Value.ToString();
                    tmpconsulta = BLC.GetAll(VariablesPublicas.EmpresaID, BEC).Tables[0];
                    if (BLC.Sql_Error.Length == 0)
                    {
                        var message = "Desea eliminar Código  " + tmpconsulta.Rows[0]["rubrocod"].ToString().Trim() + " - " + tmpconsulta.Rows[0]["rubroname"].ToString().Trim() + "...?";
                        var caption = "Mensaje del Sistema";
                        var buttons = MessageBoxButtons.YesNo;
                        DialogResult result;
                        result = MessageBox.Show(this, message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                        if (result == DialogResult.Yes)
                        {
                            if (BLC.Eliminar(VariablesPublicas.EmpresaID, tmpconsulta))
                            {
                                var BLL = new tb_co_seguridadlogBL();
                                var BEL = new tb_co_seguridadlog();
                                BEL.moduloid = Name;
                                BEL.clave = VariablesPublicas.EmpresaID + Examinar.Rows[Examinar.CurrentRow.Index].Cells["rubrocod"].Value.ToString();
                                BEL.cuser = VariablesPublicas.Usuar;
                                BEL.fecha = DateTime.Now;
                                BEL.pc = VariablesPublicas.userip;
                                BEL.accion = "B";
                                BEL.detalle = "DESCRIPCION :  BORRADO - ELIMINADO";

                                BLL.Insert(VariablesPublicas.EmpresaID.ToString(), BEL);
                                Examinar.Rows.Remove(Examinar.CurrentRow);
                                Examinar.Refresh();
                            }
                        }
                    }
                    else
                    {
                        Frm_Class.ShowError(BLC.Sql_Error, this);
                    }
                }
                else
                {
                    MessageBox.Show(xnomcampo, "IMPOSIBLE ELIMINAR REGISTRO");
                }
            }
            U_RefrescaControles();
        }