using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace bajaWare.Monitoreo
{
    public partial class frmMonitoreo : System.Web.UI.Page
    {
        private MonitoreoDatosService.IMonitoreoDatosService rsMonitoreo = new MonitoreoDatosService.MonitoreoDatosServiceClient();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
                txtFecha.Text = DateTime.Now.ToShortDateString();
            
        }

       

        protected void grvDatos_DataBound(object sender, EventArgs e)
        {
            
        }

        protected void btnBusca_Click1(object sender, EventArgs e)
        {
           List<MonitoreoDatosService.MonitoreoDatosBajaWare> lstDatos= rsMonitoreo.ListadoMonitoreo(Convert.ToDateTime(txtFecha.Text)).ToList();
           try
           {
               grvPersonas.DataSource = lstDatos;
               grvPersonas.DataBind();
               grvEjec.DataSource = lstDatos;
               grvEjec.DataBind();
               grvAva.DataSource = lstDatos;
               grvAva.DataBind();
               grvMov.DataSource = lstDatos;
               grvMov.DataBind();
               grvGar.DataSource = lstDatos;
               grvGar.DataBind();
               grvProy.DataSource = lstDatos;
               grvProy.DataBind();
               grvEmpre.DataSource = lstDatos;
               grvEmpre.DataBind();
               grvCG.DataSource = lstDatos;
               grvCG.DataBind();
               grvCA.DataSource = lstDatos;
               grvCA.DataBind();
               grvCInd.DataSource = lstDatos;
               grvCInd.DataBind();
           }
           catch(Exception exc)
           {
               ScriptManager.RegisterStartupScript(UpdGeneral, UpdGeneral.GetType(), "Error", "alert(Ocurrio un error: " + exc.Message, true);
           }
        }

        protected void btnAtras_Click(object sender, EventArgs e)
        {
            Response.Redirect("~/Interfaces/frmBusqueda.aspx");
        }

        //protected void grvDatos_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if(e.Row.RowType==DataControlRowType.DataRow)
        //    {
        //        GridView grvPersonas = (GridView)e.Row.FindControl("grvPersonas");
        //        grvPersonas.DataSource = grvDatos.DataSource;
        //        grvPersonas.DataBind();
        //    }
        //}

        //protected void grvEjecutivos_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvEjec = (GridView)e.Row.FindControl("grvEjec");
        //        grvEjec.DataSource = grvEjecutivos.DataSource;
        //        grvEjec.DataBind();
        //    }
        //}

        //protected void grvAval_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvAva = (GridView)e.Row.FindControl("grvAva");
        //        grvAva.DataSource = grvAval.DataSource;
        //        grvAva.DataBind();
        //    }
        //}

        //protected void grvMovCont_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvMov = (GridView)e.Row.FindControl("grvMov");
        //        grvMov.DataSource = grvMovCont.DataSource;
        //        grvMov.DataBind();
        //    }
        //}

        //protected void grvGarantias_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvGar = (GridView)e.Row.FindControl("grvGar");
        //        grvGar.DataSource = grvGarantias.DataSource;
        //        grvGar.DataBind();
        //    }
        //}

        //protected void grvProyectos_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvProy = (GridView)e.Row.FindControl("grvProy");
        //        grvProy.DataSource = grvProyectos.DataSource;
        //        grvProy.DataBind();
        //    }
        //}

        //protected void grvCredEmpre_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvEmpre = (GridView)e.Row.FindControl("grvEmpre");
        //        grvEmpre.DataSource = grvCredEmpre.DataSource;
        //        grvEmpre.DataBind();
        //    }
        //}

        //protected void grvCredGarant_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvCG = (GridView)e.Row.FindControl("grvCG");
        //        grvCG.DataSource = grvCredGarant.DataSource;
        //        grvCG.DataBind();
        //    }
        //}

        //protected void grvCredAval_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvCA = (GridView)e.Row.FindControl("grvCA");
        //        grvCA.DataSource = grvCredAval.DataSource;
        //        grvCA.DataBind();
        //    }
        //}

        //protected void grvCredInd_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //     if (e.Row.RowType == DataControlRowType.DataRow)
        //    {
        //        GridView grvCInd = (GridView)e.Row.FindControl("grvCInd");
        //        grvCInd.DataSource = grvCredInd.DataSource;
        //        grvCInd.DataBind();
        //    }
            
        //}
    }
}