예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            oWeb.ValidaSessionAdm();
            if (!IsPostBack)
            {
                CodCliente.Value = oWeb.GetData("CodCliente");
                CodPage.Value    = oWeb.GetData("CodPage");
                if (!string.IsNullOrEmpty(CodPage.Value))
                {
                    DBConn oConn = new DBConn();
                    if (oConn.Open())
                    {
                        cAppPages oAppPages = new cAppPages(ref oConn);
                        oAppPages.CodPage = CodPage.Value;
                        DataTable dtPage = oAppPages.Get();
                        if (dtPage != null)
                        {
                            if (dtPage.Rows.Count > 0)
                            {
                                lblNomPagina.Text = dtPage.Rows[0]["nom_page"].ToString();
                            }
                        }
                        dtPage = null;
                    }
                    oConn.Close();
                }

                LoadGrid();
            }
        }
예제 #2
0
        protected void LoadGrid()
        {
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAppPages oAppPages = new cAppPages(ref oConn);
                gridKpiPage.DataSource = oAppPages.Get();
                gridKpiPage.DataBind();

                oConn.Close();
            }
        }
        protected void oCmbPages_SelectedIndexChanged1(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            string TipoConsulta = "A";

            if (oCmbTipoConsulta.SelectedValue == "N")
            {
                tpconsulta_segundonivel.Visible = true;
            }

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAppPages oAppPages = new cAppPages(ref oConn);
                oAppPages.CodPage = oCmbPages.SelectedValue;
                DataTable dPage = oAppPages.Get();
                if (dPage != null)
                {
                    if (dPage.Rows.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(dPage.Rows[0]["tipo_consulta"].ToString()))
                        {
                            TipoConsulta = dPage.Rows[0]["tipo_consulta"].ToString();
                        }
                    }
                }
                dPage = null;
            }
            oConn.Close();
            if (oCmbTipoConsulta.SelectedValue == "N")
            {
                if ((TipoConsulta == "P") || (TipoConsulta == "R") || (TipoConsulta == "D"))
                {
                    btnSeleccionar.InnerText       = "Seleccionar Holding";
                    bVista.Value                   = "1";
                    btnChangeClientHolding.Visible = false;
                }
                else
                {
                    btnSeleccionar.InnerText    = "Seleccionar Clientes / Holding";
                    btnChangeClientHolding.Text = "Por Holding";
                    bVista.Value = string.Empty;
                    btnChangeClientHolding.Visible = true;
                }

                LoadGrid();
                btnSeleccionar.Disabled = false;
            }
        }
        protected void GridClientes_SelectedIndexChanged(object sender, EventArgs e)
        {
            string pCliente    = GridClientes.SelectedDataKey.Value.ToString();
            string pCodMonitor = CodMonitorView.Value;
            //string pCodPage = hddCodPage.Value;
            string pCodPage = oCmbPages.SelectedValue.ToString();

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                string TipoConsulta = "A";
                if (string.IsNullOrEmpty(hddMonitorCreated.Value))
                {
                    cAppPages oAppPages = new cAppPages(ref oConn);
                    oAppPages.CodPage = pCodPage;
                    DataTable dtPage = oAppPages.Get();
                    if (dtPage != null)
                    {
                        if (dtPage.Rows.Count > 0)
                        {
                            if (!string.IsNullOrEmpty(dtPage.Rows[0]["tipo_consulta"].ToString()))
                            {
                                TipoConsulta = dtPage.Rows[0]["tipo_consulta"].ToString();
                            }
                        }
                    }
                    dtPage = null;

                    cAptMonitorPages oAptMonitorPages = new cAptMonitorPages(ref oConn);
                    oAptMonitorPages.CodMonitor = CodMonitorView.Value;
                    DataTable dtMPage = oAptMonitorPages.Get();
                    oAptMonitorPages.OrderPage = (dtMPage.Rows.Count + 1).ToString();
                    dtMPage = null;
                    oAptMonitorPages.CodPage  = pCodPage;
                    oAptMonitorPages.TimePage = txt_time.Text;
                    oAptMonitorPages.EstPage  = "V";
                    if (TipoConsulta != "N")
                    {
                        oAptMonitorPages.TipoUsuario = TipoConsulta;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(bVista.Value))
                        {
                            oAptMonitorPages.TipoUsuario = "A";
                        }
                        else
                        {
                            oAptMonitorPages.TipoUsuario = "G";
                        }
                    }
                    oAptMonitorPages.Accion = "CREAR";
                    oAptMonitorPages.Put();

                    if (!string.IsNullOrEmpty(oAptMonitorPages.Error))
                    {
                        Response.Write(oAptMonitorPages.Error);
                        Response.End();
                    }

                    hddMonitorCreated.Value = "1";
                }

                cAptClientesMonitorpages oAptClientesMonitorpages = new cAptClientesMonitorpages(ref oConn);
                oAptClientesMonitorpages.CodCliente = pCliente;
                oAptClientesMonitorpages.CodMonitor = pCodMonitor;
                oAptClientesMonitorpages.CodPage    = pCodPage;
                oAptClientesMonitorpages.Accion     = "CREAR";
                oAptClientesMonitorpages.Put();

                btnChangeClientHolding.Visible = false;
            }
            oConn.Close();
            LoadGrid();
        }
        protected void oCmbTipoConsulta_OnClientSelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
        {
            DataTable oPages = null;

            tdselectvista.Visible = true;
            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAppPages oAppPages = new cAppPages(ref oConn);
                oAppPages.CodTipo = oCmbTipoConsulta.SelectedValue.ToString();

                if (oCmbTipoConsulta.SelectedValue.ToString() == "N")
                {
                    oAppPages.CodMonitor = CodMonitorView.Value;
                    oPages = oAppPages.GetByType();
                }
                else
                {
                    oPages = oAppPages.GetByTipo();
                }

                cAppTipoConnsulta oTipoConnsulta = new cAppTipoConnsulta(ref oConn);
                oTipoConnsulta.CodTipo     = oCmbTipoConsulta.SelectedValue.ToString();
                oTipoConnsulta.IndSegNivel = "S";
                DataTable dtTpCon = oTipoConnsulta.Get();
                if (dtTpCon != null)
                {
                    if (dtTpCon.Rows.Count > 0)
                    {
                        //tpconsulta_segundonivel.Visible = true;
                        tpconsulta_normal.Visible = false;
                        //oCmbPages.Visible = false;
                        //lblPage.Visible = true;

                        //if (oPages != null)
                        //{
                        //  if (oPages.Rows.Count > 0)
                        //  {
                        //    lblPage.Text = oPages.Rows[0]["nom_page"].ToString();
                        //    hddCodPage.Value = oPages.Rows[0]["cod_page"].ToString();
                        //LoadGrid();
                        //  }
                        //  oPages.Dispose();
                        //}
                        //oPages = null;
                        btnGrabar2.Visible = false;
                    }
                    else
                    {
                        lblPage.Visible = false;

                        cCliente  oCliente  = new cCliente(ref oConn);
                        DataTable dtcliente = oCliente.Get();
                        tpconsulta_normal.Visible       = true;
                        tpconsulta_segundonivel.Visible = false;
                        btnGrabar2.Visible = true;
                        //oCmbPages.Items.Add(new ListItem("Selecciona una vista", ""));

                        oCmbHolding.Items.Clear();
                        oCmbHolding.Items.Add(new ListItem("Selecciona holding", ""));
                        DataTable dtholding = oCliente.GetHolding();
                        if (dtholding != null)
                        {
                            foreach (DataRow oRow in dtholding.Rows)
                            {
                                oCmbHolding.Items.Add(new ListItem(oRow["holding"].ToString(), oRow["ncodholding"].ToString()));
                            }
                        }
                        dtholding = null;

                        oCmbCliente.Items.Clear();
                        oCmbCliente.Items.Add(new RadComboBoxItem("Selecciona cliente", ""));
                        if (dtcliente != null)
                        {
                            foreach (DataRow oRow in dtcliente.Rows)
                            {
                                oCmbCliente.Items.Add(new RadComboBoxItem(oRow["snombre"].ToString(), oRow["nkey_cliente"].ToString()));
                            }
                        }
                        dtcliente = null;
                    }
                }
                dtTpCon = null;

                oCmbPages.Visible = true;
                oCmbPages.Items.Clear();
                oCmbPages.Items.Add(new RadComboBoxItem("Selecciona una Vista", ""));
                if (oPages != null)
                {
                    if (oPages.Rows.Count > 0)
                    {
                        foreach (DataRow oRow in oPages.Rows)
                        {
                            oCmbPages.Items.Add(new RadComboBoxItem(oRow["nom_page"].ToString(), oRow["cod_page"].ToString()));
                        }
                    }
                    oPages.Dispose();
                }
                oPages = null;
            }
            oConn.Close();
        }