protected void btnGuardarAgregarDetalle_Click(object sender, EventArgs e)
    {
        try
        {
            CNCorrelativo ObjCN = new CNCorrelativo();
            CEDetalle     Obj   = new CEDetalle();
            Obj.Motivo            = txtMotivo.Text;
            Obj.Archivo           = txtNombreArchivo.Text;
            Obj.Tipo              = ddlTipoDetalle.SelectedValue;
            Obj.CodigoCorrelativo = Convert.ToInt32(lblCodigoCorrelativoDetalle.Text);
            Obj.Codigo            = Convert.ToInt32(lblCodigoDetalle.Text);

            if (lblCodigoDetalle.Text == "0")
            {
                ObjCN.InsertarDetalleCorrelativo(Obj, ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
            }
            else
            {
                ObjCN.ActualizarDetalleCorrelativo(Obj, ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
            }
            lblCodigoDetalle.Text = "0";
            Detalle();
            LimpiarRegistrarDetalle();
            mpeDetalle.Show();
        }
        catch (Exception ex)
        {
            ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
        }
        finally
        {
        }
    }
    protected void btnGuardarTabla_Click(object sender, EventArgs e)
    {
        try
        {
            int           codigo;
            CNCorrelativo ObjCN = new CNCorrelativo();
            CECorrelativo ObjCE = new CECorrelativo();

            ObjCE.CodigoAsignado = Convert.ToInt32(ddlUsuario.SelectedValue);
            ObjCE.Fecha          = Convert.ToDateTime(txtfecha.Text);
            ObjCE.Descripcion    = txtDescripcion.Text;
            ObjCE.Version        = txtVersion.Text;
            ObjCE.Codigo         = Convert.ToInt32(lblCodigoCorrelativo.Text);
            if (lblCodigoCorrelativo.Text == "0")
            {
                codigo = ObjCN.InsertarCorrelativo(ObjCE, ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Msje", "alert('Se ha realizado la peticion de un nuevo correlativo satisfactoriamente. \\n\\n Numero de Correlativo asignado:" + codigo + "');", true);
            }
            else
            {
                ObjCE.Numero = Convert.ToInt32(txtNumero.Text.Trim());
                codigo       = ObjCN.ActualizarCorrelativo(ObjCE, ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Msje", "alert('Se ha realizado la actualizacion del correlativo satisfactoriamente.');", true);
            }

            buscarcorrelativos();
        }
        catch (Exception ex)
        {
            ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
        }
        finally
        {
        }
    }
 protected void Detalle()
 {
     try
     {
         CNCorrelativo ObjCN = new CNCorrelativo();
         DataTable     temp  = new DataTable();
         CECorrelativo Obj   = new CECorrelativo();
         Obj.Codigo = Convert.ToInt32(lblCodigoCorrelativoDetalle.Text);
         temp       = ObjCN.ListarDetalleCorrelativo(Obj, ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
         if (lblUsuarioDetalle.Text == User.Identity.Name.ToString())
         {
             pnPanelInsercionDetalle.Visible = true;
             pnListadoDetalle.Height         = 400;
         }
         else
         {
             pnPanelInsercionDetalle.Visible = false;
             pnListadoDetalle.Height         = 570;
         }
         gvDetalle.DataSource = temp;
         gvDetalle.DataBind();
     }
     catch (Exception ex)
     {
         ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
     }
     finally
     {
     }
 }
 protected void buscarcorrelativos()
 {
     try
     {
         CNCorrelativo ObjCN = new CNCorrelativo();
         DataTable     temp  = new DataTable();
         temp = ObjCN.ListarCorrelativos(ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
         gvCorrelativos.DataSource = temp;
         gvCorrelativos.DataBind();
         Funciones.MostrarInformacionGrilla(temp.Rows.Count, gvCorrelativos, spRegistros);
         Funciones.OcultarColumnasGridView(gvCorrelativos, 1);
     }
     catch (Exception ex)
     {
         ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
     }
     finally
     {
     }
 }
 protected void lblNuevo_Click(object sender, EventArgs e)
 {
     try
     {
         mpeNuevo.Show();
         lblTitulo.Text = "Pedir Nuevo Correlativo de MGTABGENC";
         CNCorrelativo ObjCN = new CNCorrelativo();
         ddlUsuario.SelectedValue  = Funciones.GetCookie("CodigoUsuario");
         txtfecha.Text             = DateTime.Now.ToShortDateString();
         lblCodigoCorrelativo.Text = "0";
         txtDescripcion.Text       = "";
         txtVersion.Text           = "";
     }
     catch (Exception ex)
     {
         ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
     }
     finally
     {
     }
 }
    protected void btnEliminarDetalle_Click(object sender, EventArgs e)
    {
        try
        {
            int           codigo;
            CNCorrelativo ObjCN = new CNCorrelativo();
            CEDetalle     ObjCE = new CEDetalle();
            ObjCE.Codigo   = Convert.ToInt32(lblCodigoDetalleEliminar.Text);
            ObjCE.Vigencia = false;

            codigo = ObjCN.EliminarDetalleCorrelativo(ObjCE, ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "Msje", "alert('Se ha desestimado el correlativo satisfactoriamente.');", true);
            Detalle();
            mpeDetalle.Show();
        }
        catch (Exception ex)
        {
            ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
        }
        finally
        {
        }
    }
 protected void lblNuevo_Click(object sender, EventArgs e)
 {
     try
     {
         mpeNuevo.Show();
         lblTitulo.Text = "Pedir Nuevo Correlativo";
         CNCorrelativo ObjCN = new CNCorrelativo();
         //txtNumero.Text = ObjCN.ProximoCorrelativo(ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString()).ToString();
         //ddlUsuario.SelectedValue = Funciones.SeleccionarUsuarioEnComboUsuario(User.Identity.Name.ToString(), ConfigurationManager.ConnectionStrings["SIEMPRESOFT"].ConnectionString.ToString());
         ddlUsuario.SelectedValue  = Funciones.GetCookie("CodigoUsuario");
         txtfecha.Text             = DateTime.Now.ToShortDateString();
         lblCodigoCorrelativo.Text = "0";
         txtDescripcion.Text       = "";
         txtVersion.Text           = "";
     }
     catch (Exception ex)
     {
         ucMsje.RegistrarMensajeCliente("dvMsjeError", Funciones.m_strImagenError, ex.Message + "<br />" + ex.StackTrace);
     }
     finally
     {
     }
 }