private void btnMenuItemNuevo_Click(object sender, EventArgs e)
        {
            try
            {
                if (_iCategoria != null)
                {
                    if (_iCategoria.IdNivel == 1)
                    {
                        fr             = new FrmIn_Categoria_CG_Mant();
                        fr.ReloadGrid += fr_ReloadGrid;
                        fr.set_Accion(Cl_Enumeradores.eTipo_action.grabar);
                        fr.MdiParent = this.MdiParent;
                        fr.Show();
                    }

                    if (_iCategoria.IdNivel == 2)
                    {
                        ofrLinea = new FrmIn_Linea_Mant(Cl_Enumeradores.eTipo_action.grabar);
                        ofrLinea.Delegado_FrmIn_Linea_Mant += ofr_Delegado_FrmIn_Linea_Mant;
                        ofrLinea.Text      = ofrLinea.Text + " ***NUEVO REGISTRO***";
                        ofrLinea.MdiParent = this.MdiParent;
                        ofrLinea.Show();
                    }

                    if (_iCategoria.IdNivel == 3)
                    {
                        ofrGrupo = new FrmIn_Grupo_Mant(Cl_Enumeradores.eTipo_action.grabar);
                        ofrGrupo.Delegado_FrmIn_Grupo_Mant += ofrGrupo_Delegado_FrmIn_Grupo_Mant;
                        ofrGrupo.Text      = ofrGrupo.Text + " ***NUEVO REGISTRO***";
                        ofrGrupo.MdiParent = this.MdiParent;
                        ofrGrupo.Show();
                    }

                    if (_iCategoria.IdNivel == 4)
                    {
                        ofrSubGrupo = new FrmIn_SubGrupo_Mant(Cl_Enumeradores.eTipo_action.grabar);
                        ofrSubGrupo.Event_FrmIn_SubGrupo_Mant_FormClosing += ofrSubGrupo_Event_FrmIn_SubGrupo_Mant_FormClosing;
                        ofrSubGrupo.Text      = ofrSubGrupo.Text + " ***NUEVO REGISTRO***";
                        ofrSubGrupo.MdiParent = this.MdiParent;
                        ofrSubGrupo.Show();
                    }
                }
                else
                {
                    MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Seleccione_un_registro), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }
 private void btnSubGrupo_Click(object sender, EventArgs e)
 {
     try
     {
         ofrSubGrupo = new FrmIn_SubGrupo_Mant(Cl_Enumeradores.eTipo_action.grabar);
         ofrSubGrupo.Event_FrmIn_SubGrupo_Mant_FormClosing += ofrSubGrupo_Event_FrmIn_SubGrupo_Mant_FormClosing;
         ofrSubGrupo.Text      = ofrSubGrupo.Text + " ***NUEVO REGISTRO***";
         ofrSubGrupo.MdiParent = this.MdiParent;
         ofrSubGrupo.Show();
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        void Update_Search_Delete(Cl_Enumeradores.eTipo_action accion, string titulo)
        {
            try
            {
                if (_iCategoria != null)
                {
                    if (_iCategoria.IdNivel == 1)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                fr = new FrmIn_Categoria_CG_Mant();
                                fr.set_Accion(accion);
                                fr.MdiParent   = MdiParent;
                                fr.ReloadGrid += fr_ReloadGrid;

                                info = new in_categorias_Info();
                                info = listCategoria.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria);

                                _iCategoriaPadre = listCategoria.Find(delegate(in_categorias_Info ca)
                                {
                                    return(ca.IdCategoria == info.IdCategoriaPadre && ca.IdEmpresa == _iCategoria.IdEmpresa);
                                });

                                fr.set_categoria(info);
                                fr.set_categoriaPadre(_iCategoriaPadre);
                                fr.Show();
                            }
                        }
                    }

                    if (_iCategoria.IdNivel == 2)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                ofrLinea = new FrmIn_Linea_Mant();

                                infoLinea = new in_linea_info();
                                infoLinea = listLinea.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria && q.IdLinea == _iCategoria.IdLinea);

                                ofrLinea = new FrmIn_Linea_Mant(accion);
                                ofrLinea.Delegado_FrmIn_Linea_Mant += ofr_Delegado_FrmIn_Linea_Mant;
                                ofrLinea.Text      = ofrLinea.Text + titulo;
                                ofrLinea._SetInfo  = infoLinea;
                                ofrLinea.MdiParent = this.MdiParent;
                                ofrLinea.Show();
                            }
                        }
                    }

                    if (_iCategoria.IdNivel == 3)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                ofrGrupo = new FrmIn_Grupo_Mant();
                                ofrGrupo.Delegado_FrmIn_Grupo_Mant += ofrGrupo_Delegado_FrmIn_Grupo_Mant;

                                infoGrupo = new in_grupo_info();
                                infoGrupo = listGrupo.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria && q.IdLinea == _iCategoria.IdLinea && _iCategoria.IdGrupo == q.IdGrupo);

                                ofrGrupo = new FrmIn_Grupo_Mant(accion);
                                ofrGrupo.Delegado_FrmIn_Grupo_Mant += ofrGrupo_Delegado_FrmIn_Grupo_Mant;
                                ofrGrupo.Text      = ofrGrupo.Text + titulo;
                                ofrGrupo._SetInfo  = infoGrupo;
                                ofrGrupo.MdiParent = this.MdiParent;
                                ofrGrupo.Show();
                            }
                        }
                    }

                    if (_iCategoria.IdNivel == 4)
                    {
                        if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.actualizar)
                        {
                            MessageBox.Show("No se pueden modificar registros inactivos (I)", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            return;
                        }
                        else
                        {
                            if (_iCategoria.Estado == "I" && accion == Cl_Enumeradores.eTipo_action.Anular)
                            {
                                MessageBox.Show("El registro seleccionado ya fue anulado", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                                return;
                            }

                            else
                            {
                                ofrSubGrupo = new FrmIn_SubGrupo_Mant();
                                ofrSubGrupo.Event_FrmIn_SubGrupo_Mant_FormClosing += ofrSubGrupo_Event_FrmIn_SubGrupo_Mant_FormClosing;

                                infoSubGrupo = new in_subgrupo_info();
                                infoSubGrupo = listSubGrupo.FirstOrDefault(q => q.IdEmpresa == _iCategoria.IdEmpresa && q.IdCategoria == _iCategoria.IdCategoria && q.IdLinea == _iCategoria.IdLinea && _iCategoria.IdGrupo == q.IdGrupo && _iCategoria.IdSubGrupo == q.IdSubgrupo);

                                ofrSubGrupo = new FrmIn_SubGrupo_Mant(accion);
                                ofrSubGrupo.Event_FrmIn_SubGrupo_Mant_FormClosing += ofrSubGrupo_Event_FrmIn_SubGrupo_Mant_FormClosing;
                                ofrSubGrupo.Text      = ofrSubGrupo.Text + titulo;
                                ofrSubGrupo._SetInfo  = infoSubGrupo;
                                ofrSubGrupo.MdiParent = this.MdiParent;
                                ofrSubGrupo.Show();
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Seleccione_un_registro), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                MessageBox.Show(param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas) + ex.Message + " ", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
            }
        }