コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.usuario = (UsuarioBC)this.Session["Usuario"];
        if (!this.IsPostBack)
        {
            this.drops.Site(this.ddl_Site, this.usuario.ID);
            //SiteBC site = new SiteBC();
            //utils.CargaDrop(this.ddl_Site, "ID", "NOMBRE", site.ObtenerTodos());
            ddl_Site_SelectedIndexChanged(null, null);
            this.hf_idLugar.Value = "";
            TrailerTipoBC tt = new TrailerTipoBC();
            this.crearLeyenda(tt.obtenerTodo(), this.pnl_leyendaTipoTrailer, "DESCRIPCION");
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "graba", "graba_tab();", true);
            TrailerTipoBC tt = new TrailerTipoBC();
            this.crearLeyenda(tt.obtenerTodo(), this.pnl_leyendaTipoTrailer, "DESCRIPCION");
            if (this.ddl_Site.SelectedIndex > 0)
            {
                this.dv_leyendaEstado.Visible = true;

                SolicitudBC s   = new SolicitudBC();
                DataTable   dtl = s.ObtenerColorXSite(int.Parse(this.ddl_Site.SelectedValue));
                //   crearLeyenda(dtl, pnl_leyendaEstado, "SOLICITUD_ESTADO");
                //leyendaEstadoSolicitud(int.Parse(ddl_Site.SelectedValue));
            }
            else
            {
                this.dv_leyendaEstado.Visible = false;
            }
        }
    }
コード例 #2
0
    internal string crearPlayasLugares2(DataTable dt_zona)
    {
        SolicitudBC s   = new SolicitudBC();
        DataTable   dtl = s.ObtenerColorXSite(int.Parse(this.ddl_Site.SelectedValue));

        this.crearLeyenda(dtl, this.pnl_leyendaEstado, "SOLICITUD_ESTADO");

        PlayaBC playa = new PlayaBC();
        LugarBC lugar = new LugarBC();

        bool  primero = false;
        int   idzona, idplaya;
        Panel tab;

        foreach (DataRow row_zona in dt_zona.Rows)                          //Tabs Zonas
        {
            if (!primero)
            {
                tab = new Panel();
                tab.ClientIDMode = ClientIDMode.Static;
                tab.ID           = string.Format("cont_zona_{0}", row_zona["ID"].ToString());
                tab.CssClass     = "tab-pane fade active in";
                this.playaslugares.Controls.Add(tab);
                primero = true;
            }
            else
            {
                tab = new Panel();
                tab.ClientIDMode = ClientIDMode.Static;
                tab.ID           = string.Format("cont_zona_{0}", row_zona["ID"].ToString());
                tab.CssClass     = "tab-pane fade";
                this.playaslugares.Controls.Add(tab);
            }
            idzona = int.Parse(row_zona["ID"].ToString());

            DataTable dt_playas = playa.ObtenerXZona(idzona);         //Playas Agrupadas
            foreach (DataRow row_playa in dt_playas.Rows)
            {
                HtmlGenericControl h4 = new HtmlGenericControl("h4");
                h4.InnerText = row_playa["DESCRIPCION"].ToString();
                Panel contenido = new Panel();
                contenido.ClientIDMode = ClientIDMode.Static;
                contenido.ID           = string.Format("cont_playa_{0}", row_playa["ID"].ToString());
                tab.Controls.Add(h4);
                h4.Style.Add("display", "inline-block");
                tab.Controls.Add(contenido);

                //Append("<table>");
                idplaya = int.Parse(row_playa["ID"].ToString());
                DataTable dt_lugares = lugar.obtenerLugarEstado(idplaya, 0, int.Parse(this.ddl_Site.SelectedValue));
                int       cont       = 20;
                int       cont2      = 1;
                Panel     Row        = new Panel();
                Row.CssClass = "panel-control";
                Row.Style.Add("display", "inline-block");
                contenido.Controls.Add(Row);
                Random random = new Random();
                foreach (DataRow row_lugar in dt_lugares.Rows)              //Andenes
                {
                    if (cont == 10)
                    {
                        Row          = new Panel();
                        Row.CssClass = "panel-control";
                        Row.Style.Add("display", "inline-block");
                        contenido.Controls.Add(Row);                           //Nueva Row cada vez que empieza o cada 20 registros
                        cont = 0;
                    }

                    Panel Celda = new Panel();
                    Celda.ClientIDMode = ClientIDMode.Static;


                    Celda.ID = string.Format("cont_lugar_{0}", row_lugar["LUGA_ID"].ToString() + random.Next(1, 1000000).ToString());

                    //     Celda.ID = string.Format("cont_lugar_{0}", row_lugar["LUGA_ID"].ToString());
                    Celda.CssClass = "lugar";

                    Row.Controls.Add(Celda);

                    Panel DetallessuperiorCelda = new Panel();
                    Celda.Controls.Add(DetallessuperiorCelda);

                    Panel DetallesinferiorCelda = new Panel();
                    Celda.Controls.Add(DetallesinferiorCelda);

                    Panel PanelColorAlerta  = new Panel();
                    Panel PanelIconoTrailer = new Panel();

                    PanelColorAlerta.CssClass = "col-xs-6";
                    PanelColorAlerta.Style.Add("padding", "0");

                    PanelIconoTrailer.CssClass = "col-xs-6";
                    PanelIconoTrailer.Style.Add("padding", "0");

                    //Image imagenreloj = new Image();
                    Image iconotrailer = new Image();
                    DetallessuperiorCelda.Style.Add("background-color", row_lugar["COLOR_LUGAR"].ToString());
                    DetallessuperiorCelda.Style.Add("color", "black");
                    if (row_lugar["LUES_ID"].ToString() != "10")            //Si está habilitado/disponible
                    {
                        DetallessuperiorCelda.CssClass = "row columna-anden detalle-lugar";
                        //if (row_lugar["MOVI_ORIGEN"].ToString() != "0" ||
                        //    row_lugar["MOVI_DEST"].ToString() != "0")
                        //{ //Si tiene movimiento pendiente
                        //    DetallessuperiorCelda.Style.Add("background-color", "yellow");
                        //}
                        //else if (row_lugar["LUGA_OCUPADO"].ToString() == "True")
                        //{
                        //    DetallessuperiorCelda.Style.Add("background-color", "lime");
                        //}

                        HyperLink lnk = new HyperLink();
                        // LinkButton lnk = new LinkButton();
                        lnk.NavigateUrl = "#";
                        // lnk.Click += detallesolicitudes;
                        // lnk.CommandArgument = row_lugar["LUGA_ID"].ToString();
                        lnk.Attributes.Add("onclick", string.Format("modalPendientes({0});", row_lugar["LUGA_ID"].ToString()));

                        lnk.Text = row_lugar["LUGA_COD"].ToString();
                        DetallessuperiorCelda.Controls.Add(lnk);
                        string clrAlerta = row_lugar["COLOR"].ToString();
                        if (clrAlerta != "#FFFFFF")
                        {
                            PanelColorAlerta.Style.Add("background-color", clrAlerta);
                            PanelColorAlerta.Style.Add("border-radius", "20px");
                            Image imagen = new Image();
                            PanelColorAlerta.Controls.Add(imagen);
                            imagen.Style.Add("position", "absolute");
                            imagen.Style.Add("top", "0px");
                            imagen.Style.Add("left", "0px");
                            imagen.ImageUrl = "../img/reloj.png";
                            imagen.Width    = 20;
                            imagen.Height   = 20;
                        }
                        DetallesinferiorCelda.CssClass = "row columna-anden detalle-trailer";
                        DetallesinferiorCelda.Style.Add("background-color", row_lugar["TRTI_COLOR"].ToString());
                        PanelColorAlerta.Width  = 20;
                        PanelColorAlerta.Height = 20;

                        if (row_lugar["TRAI_ID"].ToString() == "-1")
                        {
                            Label tracto = new Label();
                            tracto.Text = "T";
                            PanelIconoTrailer.Controls.Add(tracto);
                        }
                        else
                        {
                            if (row_lugar["TRAI_PLACA"].ToString() != "0")
                            {
                                iconotrailer.Width  = 20;
                                iconotrailer.Height = 20;
                                string mensaje = string.Format("Anden: {0}", row_lugar["LUGA_COD"].ToString());
                                mensaje += string.Format(" Placa: {0}", row_lugar["TRAI_PLACA"].ToString());
                                mensaje += string.Format(" Número Flota: {0}", row_lugar["TRAI_NUMERO"].ToString());
                                mensaje += string.Format(" Locales Solicitud: {0}", row_lugar["locales"].ToString());
                                PanelIconoTrailer.Attributes.Add("onmouseover", string.Format("mostrarDatos('{0}', {1});", mensaje, row_playa["ID"].ToString()));
                                PanelIconoTrailer.Attributes.Add("onmouseout", string.Format("mostrarDatos('', {0});", row_playa["ID"].ToString()));
                                PanelIconoTrailer.Style.Add("padding-left", "2px");
                                if (row_lugar["tres_icono"].ToString() != "")
                                {
                                    iconotrailer.ImageUrl = row_lugar["tres_icono"].ToString();
                                }
                            }
                            PanelIconoTrailer.Controls.Add(iconotrailer);
                        }
                    }
                    else
                    {
                        Celda.CssClass = string.Format("{0} inhabilitado", Celda.CssClass);
                        Label codigo = new Label();
                        codigo.Text = row_lugar["LUGA_COD"].ToString();
                        DetallessuperiorCelda.Controls.Add(codigo);
                    }
                    DetallesinferiorCelda.Controls.Add(PanelColorAlerta);
                    DetallesinferiorCelda.Controls.Add(PanelIconoTrailer);

                    cont++;
                    cont2++;
                }
                Panel div_mensaje = new Panel();
                contenido.Controls.Add(div_mensaje);
                div_mensaje.ClientIDMode = ClientIDMode.Static;

                div_mensaje.ID = string.Format("msj_play_{0}", row_playa["ID"].ToString());
                //  div_mensaje.CssClass = "col-xs-12";
                div_mensaje.Style.Add("display", "block");
                div_mensaje.Style.Add("clear", "both");
            }
        }

        //   return strb.ToString();
        return("");
    }