/// <summary>
    /// Llena el grid con la informacion de los Responsables
    /// de solucion
    /// </summary>
    /// <param name="searchFilter">filtro de Busqueda</param>
    /// <param name="showErrorMessage">muestra mensaje de error en caso de no haber datos</param>
    private void Fill_gvSolutionResponsibles(string searchFilter, bool showErrorMessage)
    {
        SolutionResponsible result = new SolutionResponsible();

        result.GetSolutionResponsibles(searchFilter);

        if (result.Messages.Status == 0)
        {
            wucMessageControl.Title   = "Error";
            wucMessageControl.Image   = "../include/imagenes/error_32.png";
            wucMessageControl.Message = result.Messages.Message;
            wucMessageControl.ShowPopup();
        }
        else
        {
            if (result.SolutionResponsiblesTable.Count <= 0 && showErrorMessage == true)
            {
                wucMessageControl.Title   = "Error";
                wucMessageControl.Image   = "../include/imagenes/advertencia_32.png";
                wucMessageControl.Message = "No se encontraron datos";
                wucMessageControl.ShowPopup();
            }
        }

        gvResponsibles.DataSource = result.SolutionResponsiblesTable;
        gvResponsibles.DataBind();

        setStatusImage();
    }
    /// <summary>
    /// Actualiza la información de un
    /// responsable de solución
    /// Autor: Manuel Gutierrez Rojas
    /// Fecha: 18.Oct.2011
    /// </summary>
    private void Update()
    {
        SolutionResponsible updResponsible = new SolutionResponsible();

        updResponsible.Name       = tbName.Text;
        updResponsible.Email      = tbEmail.Text;
        updResponsible.Area       = tbArea.Text;
        updResponsible.Status     = ddlStatus.SelectedValue;
        updResponsible.IdCountryR = decimal.Parse(ddlCountries.SelectedValue);



        try
        {
            Decimal codSolutionResponsible = Convert.ToDecimal(Session["COD_SOLUTION_RESPONSIBLE"]);

            if (updResponsible.GetUnfinishedIncidents(codSolutionResponsible) > 0 && ddlStatus.SelectedValue == "0")
            {
                wucMessageControl.Title   = "Error";
                wucMessageControl.Image   = "../include/imagenes/error_32.png";
                wucMessageControl.Message = "El Registro no puede ser dado de baja</br>Aún hay incidencias Activas para el";
                wucMessageControl.ShowPopup();
            }
            else
            {
                updResponsible.UpdateAffectedClient(updResponsible, codSolutionResponsible);

                if (updResponsible.Messages.Status == 1)
                {
                    wucMessageControl.Title = "Mensaje";
                    wucMessageControl.Image = "../include/imagenes/info_32.png";
                }
                else
                {
                    wucMessageControl.Title = "Error";
                    wucMessageControl.Image = "../include/imagenes/error_32.png";
                }

                wucMessageControl.Message = updResponsible.Messages.Message;
                wucMessageControl.ShowPopup();
                //Registrar las pistas de Auditoria
                UpdateSolutionRespAudit();

                btnNewResponsible_ModalPopupExtender.Enabled = false;

                Load_SolutionResponsibles();
            }
        }
        catch (Exception ex)
        {
            wucMessageControl.Title   = "Error";
            wucMessageControl.Image   = "../include/imagenes/error_32.png";
            wucMessageControl.Message = ex.Message.ToString();
            wucMessageControl.ShowPopup();

            SafetyPad.SetLogRecord("SolutionResponsibles.aspx.cs", ex.ToString());
        }
    }
    /// <summary>
    /// Carga la información de un Responsable para su edición
    /// </summary>
    /// <param name="rowIndex">fila seleccionada</param>
    private void EditSolutionResponsible(int rowIndex)
    {
        //Guardar el Código del Responsable a editar
        Session["COD_SOLUTION_RESPONSIBLE"] = gvResponsibles.DataKeys[rowIndex]["COD_SOLUTION_RESPONSIBLE"].ToString();

        //Cargar la información del responsable
        SolutionResponsible result = new SolutionResponsible();

        result.EditSolutionResponsible(Convert.ToDecimal(Session["COD_SOLUTION_RESPONSIBLE"]));

        if (result.Messages.Status == 0) //Si hay un error
        {
            wucMessageControl.Title   = "Error";
            wucMessageControl.Image   = "../include/imagenes/error_32.png";
            wucMessageControl.Message = result.Messages.Message;
            wucMessageControl.ShowPopup();
        }
        else //Si el dato es correcto
        {
            tbName.Text             = result.Name;
            tbArea.Text             = result.Area;
            tbEmail.Text            = result.Email;
            ddlStatus.SelectedValue = gvResponsibles.DataKeys[rowIndex]["RECORD_STATUS"].ToString();

            try
            {
                ddlCountries.SelectedValue = result.IdCountryR.ToString();
            }
            catch
            {
                ddlCountries.DataSourceID = odsAllCountries.ID;
                odsAllCountries.DataBind();
                ddlCountries.DataBind();
                try
                {
                    ddlCountries.SelectedValue = "4";
                }
                catch
                {
                    ddlCountries.SelectedValue = "1";
                }
            }


            btnNewResponsible_ModalPopupExtender.Enabled = true;
            btnNewResponsible_ModalPopupExtender.Show();
        }
    }
    /// <summary>
    /// Inserta un nuevo Responsable de solución
    /// Autor: Manuel Gutiérrez Rojas
    /// Fecha: 18.Oct.2011
    /// </summary>
    private void Insert()
    {
        SolutionResponsible newResponsible = new SolutionResponsible();

        newResponsible.Name       = tbName.Text;
        newResponsible.Email      = tbEmail.Text;
        newResponsible.Area       = tbArea.Text;
        newResponsible.Status     = ddlStatus.SelectedValue;
        newResponsible.IdCountryR = decimal.Parse(ddlCountries.SelectedValue);

        try
        {
            newResponsible.InsertSolutionResponsible(newResponsible);

            if (newResponsible.Messages.Status == 1)
            {
                wucMessageControl.Title = "Mensaje";
                wucMessageControl.Image = "../include/imagenes/info_32.png";
            }
            else
            {
                wucMessageControl.Title = "Error";
                wucMessageControl.Image = "../include/imagenes/error_32.png";
            }

            wucMessageControl.Message = newResponsible.Messages.Message;
            wucMessageControl.ShowPopup();
            //Registrar las pistas de Auditoria
            InsertSolutionRespAudit();

            btnNewResponsible_ModalPopupExtender.Enabled = false;

            Load_SolutionResponsibles();
        }
        catch (Exception ex)
        {
            wucMessageControl.Title   = "Error";
            wucMessageControl.Image   = "../include/imagenes/error_32.png";
            wucMessageControl.Message = ex.Message.ToString();
            wucMessageControl.ShowPopup();

            SafetyPad.SetLogRecord("SolutionResponsibles.aspx.cs", ex.ToString());
        }
    }