Exemplo n.º 1
0
        /// <summary>
        /// Gets the resource value and sets it as the label text.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Text    = CultureManager.GetString(ResourceName, VariableName);
            Visible = WebSecurity.IsSecuredAllowed(SecureRefference);
        }
Exemplo n.º 2
0
 public FuncionVo(Funcion funcion)
 {
     Id          = funcion.Id;
     Descripcion = CultureManager.GetString("Menu", funcion.Descripcion);
     Modulo      = string.IsNullOrEmpty(funcion.Modulo) ? "" : CultureManager.GetString("Menu", funcion.Modulo);
     Sistema     = CultureManager.GetString("Menu", funcion.Sistema.Descripcion);
     IconUrl     = string.Concat("~/", funcion.Descripcion, ".image");
 }
Exemplo n.º 3
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     for (int i = 0; i < Items.Count; i++)
     {
         var res = Items[i].Attributes["ResourceName"];
         var val = Items[i].Attributes["VariableName"];
         Items[i].Text = CultureManager.GetString(string.IsNullOrEmpty(res) ? "Labels" : res, val);
         Items[i].Attributes.Remove("ResourceName");
         Items[i].Attributes.Remove("VariableName");
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the resource value and sets it as the label text.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Text    = CultureManager.GetString(ResourceName, VariableName);
            Visible = WebSecurity.IsSecuredAllowed(SecureRefference);

            if (!String.IsNullOrEmpty(ListControlTargetID))
            {
                RegisterScript();
            }
        }
Exemplo n.º 5
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, TicketVo dataItem)
        {
            var ticket = dataItem;

            var cellEstado = GridUtils.GetCell(e.Row, TicketVo.IndexEstado);
            var lblEstado  = cellEstado.FindControl("lblEstado") as ResourceLabel;
            var lnkIniciar = cellEstado.FindControl("lnkIniciar") as ResourceLinkButton;
            var lnkCerrar  = cellEstado.FindControl("lnkCerrar") as ResourceLinkButton;

            if (lnkCerrar == null || lnkIniciar == null || lblEstado == null)
            {
                return;
            }

            if (!dataItem.PuntoEntregaNomenclado)
            {
                e.Row.BackColor = Color.Firebrick;
            }

            lnkCerrar.OnClientClick = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');");


            switch (ticket.Estado)
            {
            case Ticket.Estados.EnCurso:
                lnkIniciar.Visible     = false;
                lnkCerrar.Visible      = true;
                lblEstado.VariableName = "TICKETSTATE_CURRENT";
                lblEstado.Visible      = true;
                break;

            case Ticket.Estados.Cerrado:
                lnkIniciar.Visible     = false;
                lnkCerrar.Visible      = false;
                lblEstado.VariableName = "TICKETSTATE_CLOSED";
                lblEstado.Visible      = true;
                break;

            case Ticket.Estados.Anulado:
                lnkIniciar.Visible     = false;
                lnkCerrar.Visible      = false;
                lblEstado.VariableName = "TICKETSTATE_ANULADO";
                lblEstado.Visible      = true;
                break;

            default:
                lnkIniciar.Visible     = dataItem.PuntoEntregaNomenclado && dataItem.HasCoche;
                lnkCerrar.Visible      = false;
                lblEstado.VariableName = "TICKETSTATE_PROGRAMMED";
                lblEstado.Visible      = !lnkIniciar.Visible;
                break;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Render the content of all associated controls.
        /// </summary>
        /// <param name="output"></param>
        protected override void Render(HtmlTextWriter output)
        {
            output.Write(string.Format("<div class='{0}'>", CssClass));
            output.Write("<table style='width: 100%;'><tr>");

            if (Controls.Count <= 0)
            {
                output.Write("<td style='text-align: right;'>");
            }
            else
            {
                output.Write("<td><table><tr>");
                foreach (Control control in Controls)
                {
                    output.Write("<td>");

                    control.RenderControl(output);

                    output.Write("</td>");
                }
                output.Write("</tr></table></td><td style='text-align: right;'>");
            }

            var textTitle     = !string.IsNullOrEmpty(Text);
            var resourceTitle = !string.IsNullOrEmpty(ResourceName) && !string.IsNullOrEmpty(VariableName);

            if (resourceTitle || textTitle)
            {
                Image i = null;
                if (resourceTitle)
                {
                    i = new Image {
                        ImageUrl = ResolveUrl(string.Format(BaseImageUrl, VariableName)), CssClass = IconCssClass
                    };
                    AddControls(i);
                }
                var c = new Label {
                    Text = textTitle ? Text : CultureManager.GetString(ResourceName, VariableName).Trim(), CssClass = TitleCssClass
                };
                AddControls(c);
                c.RenderControl(output);
                if (i != null)
                {
                    i.RenderControl(output);
                }
            }
            output.Write("</td></tr></table></div>");
        }
Exemplo n.º 7
0
        public void GenerateColumns <T>(List <T> list)
        {
            Logger.Debug("GenerateColumns start");
            var properties = typeof(T).GetProperties()
                             .Where(p => p.GetGridMappingAttributes().Any())
                             .OrderBy(p => (p.GetGridMappingAttributes().First()).Index);

            Logger.Debug("GenerateColumns foreach properties");
            foreach (var property in properties)
            {
                var attribute = property.GetGridMappingAttributes().First();

                if (attribute.IsDataKey || (attribute.IsTemplate && (attribute.DataFormatString.Trim().Equals(string.Empty) || attribute.DataFormatString.Trim().Equals("{0}"))))
                {
                    continue;
                }
                if (string.IsNullOrEmpty(attribute.HeaderText) && attribute.ResourceName == null && attribute.VariableName == null)
                {
                    continue;
                }

                //var templateName = !string.IsNullOrEmpty(attribute.ExcelTemplateName)
                //    ? attribute.ExcelTemplateName
                //    : Format(string.IsNullOrEmpty(attribute.HeaderText)
                //                            ? CultureManager.GetString(attribute.ResourceName, attribute.VariableName)
                //                            : attribute.HeaderText).Replace(" ", "_").Replace("/", "_").Replace("%", "_").Replace("-", "_");

                var templateName = attribute.VariableName.Replace(" ", "_").Replace("/", "_").Replace("%", "_").Replace("-", "_");

                var headerText = CultureManager.GetString(attribute.ResourceName, attribute.VariableName);

                var excelData = _wbPart.GetDefinedName(templateName);
                var excelCol  = new ExcelColumn
                {
                    ExcelCol         = ExcelExtensions.ParseExcelColumn(excelData),
                    ExcelRow         = ExcelExtensions.ParseExcelRow(excelData),
                    PropertyName     = property.Name,
                    PropertyType     = property.PropertyType.FullName,
                    DataFormatString = attribute.ExcelTextFormat,
                };
                var templateCell = excelCol.ExcelCol + (excelCol.ExcelRow + 1);
                excelCol.Style = _wbPart.GetStyle(SheetName, templateCell);
                excelCol.ConditionalFormatStart = _wbPart.HasConditionals(SheetName, templateCell) ? templateCell : string.Empty;
                _excelColumns.Add(excelCol);
                _wbPart.UpdateValue(SheetName, _wbPart.GetDefinedName(templateName), headerText, 0, CellValues.SharedString, _sharedStrings);
            }
            Logger.Debug("GenerateColumns end");
        }
Exemplo n.º 8
0
        public void GenerateCols(IEnumerable list)
        {
            var first = true;

            foreach (var result in list)
            {
                if (first)
                {
                    var properties = result.GetType().GetProperties()
                                     .Where(p => p.GetGridMappingAttributes().Any())
                                     .Where(p => !p.GetGridMappingAttributes().First().IsDataKey)
                                     .OrderBy(p => (p.GetGridMappingAttributes().First()).Index)
                                     .ToArray();

                    foreach (var property in properties)
                    {
                        var attribute = property.GetGridMappingAttributes().First();

                        if (attribute.IsDataKey || attribute.IsTemplate)
                        {
                            continue;
                        }
                        if (string.IsNullOrEmpty(attribute.HeaderText) && attribute.ResourceName == null && attribute.VariableName == null)
                        {
                            continue;
                        }

                        var headerText = Format(string.IsNullOrEmpty(attribute.HeaderText)
                                                    ? CultureManager.GetString(attribute.ResourceName, attribute.VariableName)
                                                    : attribute.HeaderText).Replace(" ", "_").Replace("/", "_").Replace("%", "_").Replace("-", "_");

                        var excelData = _wbPart.GetDefinedName(headerText);
                        var excelCol  = new ExcelColumn
                        {
                            ExcelCol     = ExcelExtensions.ParseExcelColumn(excelData),
                            ExcelRow     = ExcelExtensions.ParseExcelRow(excelData),
                            PropertyName = property.Name,
                            PropertyType = property.PropertyType.FullName,
                        };
                        var templateCell = excelCol.ExcelCol + (excelCol.ExcelRow + 1);
                        excelCol.Style = _wbPart.GetStyle(SheetName, templateCell);
                        excelCol.ConditionalFormatStart = _wbPart.HasConditionals(SheetName, templateCell) ? templateCell : string.Empty;
                        _excelColumns.Add(excelCol);
                    }
                    first = false;
                }
            }
        }
Exemplo n.º 9
0
        protected override void Render(HtmlTextWriter writer)
        {
            var title = !string.IsNullOrEmpty(ResourceName)
                            ? CultureManager.GetString(ResourceName, VariableName)
                            : Title;

            if (Selected != null)
            {
                writer.AddAttribute("dopb", "true");
            }
            writer.AddAttribute("command", ClientID);
            writer.AddAttribute("title", title);
            writer.RenderBeginTag("div");
            base.Render(writer);
            writer.RenderEndTag();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Render all associated controls.
        /// </summary>
        /// <param name="output"></param>
        protected override void RenderContents(HtmlTextWriter output)
        {
            var text = string.IsNullOrEmpty(Text.Trim()) ? CultureManager.GetString(ResourceName, VariableName) : Text;

            output.Write(string.Format("<div class='{0}'>", CssClass));
            output.Write("<table style='width: 100%;'><tr><td style='vertical-align: middle;'>");
            output.Write(string.Format("<span class='{0}'>{1}</span>", TitleCssClass, text));
            output.Write("</td><td style='text-align: right;vertical-align: top;'>");

            foreach (Control control in Controls)
            {
                control.RenderControl(output);
            }

            output.Write("</td>");
            output.Write("</tr></table></div>");
        }
Exemplo n.º 11
0
        protected override void Render(HtmlTextWriter writer)
        {
            if (!Width.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Width, Width.ToString());
            }
            if (!HasOverflow && !Height.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, Height.ToString());
            }
            writer.AddAttribute(HtmlTextWriterAttribute.Class, CssClass);
            writer.RenderBeginTag(HtmlTextWriterTag.Table);

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, TitleCssClass);
            writer.RenderBeginTag(HtmlTextWriterTag.Td);
            writer.Write(!string.IsNullOrEmpty(TitleResourceName) ? CultureManager.GetString(TitleResourceName, TitleVariableName): Title);
            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            writer.AddAttribute(HtmlTextWriterAttribute.Class, BodyCssClass);
            writer.AddStyleAttribute(HtmlTextWriterStyle.VerticalAlign, "top");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);


            writer.AddStyleAttribute(HtmlTextWriterStyle.OverflowX, overflowx);
            writer.AddStyleAttribute(HtmlTextWriterStyle.OverflowY, overflowy);

            if (HasOverflow && !Height.IsEmpty)
            {
                writer.AddStyleAttribute(HtmlTextWriterStyle.Height, Height.ToString());
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            RenderContents(writer);

            writer.RenderEndTag();

            writer.RenderEndTag();
            writer.RenderEndTag();

            writer.RenderEndTag();
        }
Exemplo n.º 12
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            GridUtils.GenerateColumnIndices();

            if (multiDocumentos.ActiveViewIndex == 1)
            {
                DocumentContainer.EnableViewState = false;
                var tipoDocumento = DAOFactory.TipoDocumentoDAO.FindById(TipoDocumentoEdit.Get());
                Presenter = GetPresentStrategy(tipoDocumento);
                Presenter.CrearForm();
                DocumentContainer.EnableViewState = true;
            }

            if (!IsPostBack)
            {
                btBorrar.OnClientClick = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');");

                btNuevo.Visible = cbTipoDocumento.Visible = Permission == null || Permission.Add;

                if (OnlyForVehicles && Coche.Get() <= 0)
                {
                    Visible = false;
                }
                if (OnlyForEmployees && Empleado.Get() <= 0)
                {
                    Visible = false;
                }
                if (OnlyForEquipment && Equipo.Get() <= 0)
                {
                    Visible = false;
                }
                if (OnlyForTransporter && Transportista.Get() <= 0)
                {
                    Visible = false;
                }
            }
        }
Exemplo n.º 13
0
        protected void ShowMensaje(LogMensaje mensaje)
        {
            var iconDir = IconDir;

            var color = mensaje.Accion != null
                            ? Color.FromArgb(100, mensaje.Accion.Red, mensaje.Accion.Green, mensaje.Accion.Blue)
                            : Color.Gray;

            panelTitle.BackColor = color;
            panelTitle.ForeColor = color.GetBrightness() < 40 ? Color.White: Color.Black;

            if (mensaje.Accion != null && mensaje.Accion.PopIcon > 0)
            {
                imgAccion.ImageUrl = string.Format("{0}/{1}", iconDir, mensaje.Accion.PopUpIcon.PathIcono);
            }
            else
            {
                imgAccion.Visible = false;
            }

            lbMensaje.Text    = mensaje.Texto;
            lblHora.Text      = mensaje.Fecha.ToDisplayDateTime().ToString("dd/MM/yyyy HH:mm");
            lblRecepcion.Text = mensaje.FechaAlta.HasValue
                                    ? "(" + mensaje.FechaAlta.Value.ToDisplayDateTime().ToString("dd/MM/yyyy HH:mm") + ")"
                                    : string.Empty;

            var pos = mensaje.Fecha;

            var link = string.Format(
                "../Monitor/MonitorHistorico/monitorHistorico.aspx?Planta={0}&TypeMobile={1}&Movil={2}&InitialDate={3}&FinalDate={4}&ShowMessages=0&ShowPOIS=0&Empresa={5}",
                mensaje.Coche.Linea != null ? mensaje.Coche.Linea.Id : -1, mensaje.Coche.TipoCoche.Id, mensaje.Coche.Id, pos.Subtract(TimeSpan.FromMinutes(15)).ToString(CultureInfo.InvariantCulture),
                pos.Add(TimeSpan.FromMinutes(1)).ToString(CultureInfo.InvariantCulture), mensaje.Coche.Empresa != null ? mensaje.Coche.Empresa.Id : mensaje.Coche.Linea != null ? mensaje.Coche.Linea.Empresa.Id : -1);

            lbMensaje.OnClientClick = string.Format("window.open('{0}', '" + CultureManager.GetMenu("OPE_MON_HISTORICO") + "')", link);

            lblMovil.Text = mensaje.Coche.Interno;
            var imgMovl = string.Format("{0}/{1}", iconDir, mensaje.Coche.TipoCoche.IconoNormal.PathIcono);

            imgMovil.ImageUrl = imgMovl;

            var chofer = mensaje.Chofer ?? mensaje.Coche.Chofer;

            lblChofer.Text = chofer != null
                                 ? string.Format("{0} - {1}", chofer.Legajo, chofer.Entidad.Descripcion)
                                 : CultureManager.GetString("Labels", "SIN_CHOFER");

            lblDireccion.Text = GeocoderHelper.GetDescripcionEsquinaMasCercana(mensaje.Latitud, mensaje.Longitud);

            lblLatitud.Text  = mensaje.Latitud.ToString(CultureInfo.InvariantCulture);
            lblLongitud.Text = mensaje.Longitud.ToString(CultureInfo.InvariantCulture);

            Monitor1.ImgPath          = Config.Monitor.GetMonitorImagesFolder(this);
            Monitor1.GoogleMapsScript = GoogleMapsKey;
            Monitor1.EnableTimer      = false;
            Monitor1.AddLayers(LayerFactory.GetGoogleStreet(CultureManager.GetLabel("LAYER_GSTREET"), 8),
                               //LayerFactory.GetCompumap(CultureManager.GetLabel("LAYER_COMPUMAP"), Config.Map.CompumapTiles, 8),
                               LayerFactory.GetOpenStreetMap(CultureManager.GetLabel("LAYER_OSM")),
                               LayerFactory.GetGoogleSatellite(CultureManager.GetLabel("LAYER_GSAT"), 8),
                               LayerFactory.GetGoogleHybrid(CultureManager.GetLabel("LAYER_GHIBRIDO"), 8),
                               LayerFactory.GetGooglePhysical(CultureManager.GetLabel("LAYER_GFISICO"), 8),
                               LayerFactory.GetMarkers(LayerVehiculos, true));
            Monitor1.AddControls(ControlFactory.GetLayerSwitcher(),
                                 ControlFactory.GetNavigation());
            Monitor1.SetCenter(mensaje.Latitud, mensaje.Longitud, 7);
            Monitor1.AddMarkers(LayerVehiculos, MarkerFactory.CreateMarker(mensaje.Coche.Id.ToString("#0"), imgMovl, mensaje.Latitud, mensaje.Longitud));

            var empresa = mensaje.Coche.Empresa;
            var linea   = mensaje.Coche.Linea;
            var user    = WebSecurity.AuthenticatedUser != null?DAOFactory.UsuarioDAO.FindById(WebSecurity.AuthenticatedUser.Id) : null;

            var mensajes = DAOFactory.MensajeDAO.FindByTipo(null, empresa, linea, user);
            var messages = mensajes.Where(m => m.TipoMensaje.DeAtencion).OrderBy(m => m.Descripcion);

            cbMensaje.ClearItems();
            cbMensaje.AddItem(CultureManager.GetControl("DDL_NO_MESSAGE"), cbMensaje.NoneValue);
            foreach (var msg in messages)
            {
                cbMensaje.AddItem(msg.Descripcion, msg.Id);
            }

            if (mensaje.Estado > 0)
            {
                btAceptar.Visible  = false;
                btIgnorar.ImageUrl = "~/Operacion/btAtras.gif";

                var atencion = DAOFactory.AtencionEventoDAO.GetByEvento(mensaje.Id);
                if (atencion != null)
                {
                    panelUsuario.Visible = true;
                    lblUsuario.Text      = atencion.Usuario.NombreUsuario;
                    panelFecha.Visible   = true;
                    lblFecha.Text        = atencion.Fecha.ToDisplayDateTime().ToString("dd/MM/yyyy HH:mm");
                    cbMensaje.SetSelectedValue(atencion.Mensaje.Id);
                    cbMensaje.Enabled      = false;
                    txtObservacion.Text    = atencion.Observacion;
                    txtObservacion.Enabled = false;
                }
            }

            if (!WebSecurity.IsSecuredAllowed(Securables.EventAttention))
            {
                btAceptar.Visible  = false;
                btIgnorar.ImageUrl = "~/Operacion/btAtras.gif";
            }
        }
Exemplo n.º 14
0
        public static IHtmlString ResourceLabel(this HtmlHelper helper, string resourceName = "", string variableName = "", string secureRefference = "")
        {
            var visible = WebSecurity.IsSecuredAllowed(secureRefference);

            return(!visible ? new HtmlString(String.Empty) : new HtmlString(CultureManager.GetString(resourceName, variableName).Trim(' ')));
        }
Exemplo n.º 15
0
 protected void ThrowMustEnter(string resource, string variable)
 {
     throw new ApplicationException(string.Format(CultureManager.GetError("MUST_ENTER_VALUE"), CultureManager.GetString(resource, variable)));
 }
Exemplo n.º 16
0
        protected override void OnRowDataBound(C1GridView grid, C1GridViewRowEventArgs e, ViajeDistribucionVo dataItem)
        {
            var ticket = dataItem;

            var cellEstado   = GridUtils.GetCell(e.Row, ViajeDistribucionVo.IndexEstado);
            var cellVehiculo = GridUtils.GetCell(e.Row, ViajeDistribucionVo.IndexVehiculo);
            var lblEstado    = cellEstado.FindControl("lblEstado") as ResourceLabel;
            var lnkIniciar   = cellEstado.FindControl("lnkIniciar") as ResourceLinkButton;
            var lnkCerrar    = cellEstado.FindControl("lnkCerrar") as ResourceLinkButton;
            var lnkReenviar  = cellEstado.FindControl("lnkReenviar") as ResourceLinkButton;
            var lnkAsociar   = cellEstado.FindControl("lnkAsociar") as ResourceLinkButton;
            var lnkCombinar  = cellEstado.FindControl("lnkCombinar") as ResourceLinkButton;
            var cbVehiculo   = cellVehiculo.FindControl("cbVehiculo") as DropDownList;

            if (!ticket.Nomenclado)
            {
                e.Row.BackColor = Color.LightCoral;
                grid.Columns[ViajeDistribucionVo.IndexNoNomencladas].Visible = true;
            }

            if (lnkCerrar == null || lnkIniciar == null || lblEstado == null || lnkReenviar == null || lnkAsociar == null || lnkCombinar == null)
            {
                return;
            }

            lnkCerrar.OnClientClick   = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');");
            lnkReenviar.OnClientClick = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');");

            switch (ticket.Estado)
            {
            case ViajeDistribucion.Estados.EnCurso:
                lnkIniciar.Visible     = false;
                lnkCerrar.Visible      = lnkReenviar.Visible = lblEstado.Visible = true;
                lblEstado.VariableName = "TICKETSTATE_CURRENT";
                break;

            case ViajeDistribucion.Estados.Anulado:
                lnkIniciar.Visible     = lnkCerrar.Visible = lnkReenviar.Visible = false;
                lblEstado.VariableName = "TICKETSTATE_ANULADO";
                lblEstado.Visible      = true;
                break;

            case ViajeDistribucion.Estados.Cerrado:
                lnkIniciar.Visible     = lnkCerrar.Visible = lnkReenviar.Visible = false;
                lblEstado.VariableName = "TICKETSTATE_CLOSED";
                lblEstado.Visible      = true;
                break;

            default:
                lnkIniciar.Visible     = dataItem.HasCoche;
                lnkCerrar.Visible      = lnkReenviar.Visible = false;
                lblEstado.Visible      = !lnkIniciar.Visible;
                lblEstado.VariableName = "TICKETSTATE_PROGRAMMED";
                break;
            }

            lnkAsociar.Visible  = !ticket.HasCoche;
            lnkCombinar.Visible = ticket.Estado == ViajeDistribucion.Estados.Pendiente && ticket.HasCoche;

            if (_editMode)
            {
                e.Row.Attributes.Remove("onclick");
                var vehiculos = DAOFactory.CocheDAO.GetList(new[] { ticket.IdEmpresa }, new[] { ticket.IdLinea }).OrderBy(c => c.Interno);

                cbVehiculo.Items.Add(new ListItem("Ninguno", "0"));
                foreach (var vehiculo in vehiculos)
                {
                    cbVehiculo.Items.Add(new ListItem(vehiculo.Interno, vehiculo.Id.ToString("#0")));
                }

                cbVehiculo.Attributes.Add("IdViaje", ticket.Id.ToString("#0"));
                cbVehiculo.SelectedValue = ticket.IdVehiculo.ToString("#0");
                cbVehiculo.Enabled       = ticket.Estado == ViajeDistribucion.Estados.Pendiente;
                cbVehiculo.AutoPostBack  = true;
                cbVehiculo.Enabled       = true;
            }
            else
            {
                cbVehiculo.Items.Add(ticket.IdVehiculo > 0
                                         ? new ListItem(ticket.Vehiculo, ticket.IdVehiculo.ToString("#0"))
                                         : new ListItem("Ninguno", "0"));
                cbVehiculo.Enabled = false;
            }
        }
Exemplo n.º 17
0
        protected override void CreateRowTemplate(C1GridViewRow row)
        {
            var lblEstado   = row.Cells[ViajeDistribucionVo.IndexEstado].FindControl("lblEstado") as ResourceLabel;
            var lnkIniciar  = row.Cells[ViajeDistribucionVo.IndexEstado].FindControl("lnkIniciar") as ResourceLinkButton;
            var lnkCerrar   = row.Cells[ViajeDistribucionVo.IndexEstado].FindControl("lnkCerrar") as ResourceLinkButton;
            var lnkReenviar = row.Cells[ViajeDistribucionVo.IndexEstado].FindControl("lnkReenviar") as ResourceLinkButton;
            var lnkAsociar  = row.Cells[ViajeDistribucionVo.IndexEstado].FindControl("lnkAsociar") as ResourceLinkButton;
            var lnkCombinar = row.Cells[ViajeDistribucionVo.IndexEstado].FindControl("lnkCombinar") as ResourceLinkButton;
            var cbVehiculo  = row.Cells[ViajeDistribucionVo.IndexVehiculo].FindControl("cbVehiculo") as DropDownList;

            if (lblEstado == null)
            {
                lblEstado = new ResourceLabel {
                    ResourceName = "Labels", ID = "lblEstado", Visible = false
                };
                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(lblEstado);
            }

            if (lnkIniciar == null)
            {
                lnkIniciar = new ResourceLinkButton
                {
                    ResourceName    = "Labels",
                    ID              = "lnkIniciar",
                    CommandName     = "Start",
                    CommandArgument = row.RowIndex.ToString("#0"),
                    VariableName    = "DISTRIBUCION_INICIAR",
                    Visible         = false
                };
                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(lnkIniciar);
            }

            row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(new Literal {
                Text = @"<br/>"
            });

            if (lnkAsociar == null)
            {
                lnkAsociar = new ResourceLinkButton
                {
                    ResourceName    = "Labels",
                    ID              = "lnkAsociar",
                    CommandName     = "Asociar",
                    CommandArgument = row.RowIndex.ToString("#0"),
                    VariableName    = "ASOCIAR_VEHICULO",
                    Visible         = false,
                    OnClientClick   = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');")
                };

                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(lnkAsociar);
            }

            if (lnkCombinar == null)
            {
                lnkCombinar = new ResourceLinkButton
                {
                    ResourceName    = "Labels",
                    ID              = "lnkCombinar",
                    CommandName     = "Combinar",
                    CommandArgument = row.RowIndex.ToString("#0"),
                    VariableName    = "DISTRIBUCION_COMBINAR",
                    Visible         = false,
                    OnClientClick   = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');")
                };

                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(lnkCombinar);
            }

            if (lnkCerrar == null)
            {
                lnkCerrar = new ResourceLinkButton
                {
                    ResourceName    = "Labels",
                    ID              = "lnkCerrar",
                    CommandName     = "Close",
                    CommandArgument = row.RowIndex.ToString("#0"),
                    VariableName    = "DISTRIBUCION_CERRAR",
                    Visible         = false,
                    OnClientClick   = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');")
                };

                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(lnkCerrar);
            }

            if (lnkReenviar == null)
            {
                lnkReenviar = new ResourceLinkButton
                {
                    ResourceName    = "Labels",
                    ID              = "lnkReenviar",
                    CommandName     = "Reenviar",
                    CommandArgument = row.RowIndex.ToString("#0"),
                    VariableName    = "DISTRIBUCION_REENVIAR",
                    Visible         = false,
                    OnClientClick   = string.Concat("return confirm('", CultureManager.GetString("SystemMessages", "CONFIRM_OPERATION"), "');")
                };

                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(new Literal {
                    Text = @"<br/>"
                });
                row.Cells[ViajeDistribucionVo.IndexEstado].Controls.Add(lnkReenviar);
            }

            if (cbVehiculo == null)
            {
                cbVehiculo = new DropDownList
                {
                    ID      = "cbVehiculo",
                    Visible = true
                };

                row.Cells[ViajeDistribucionVo.IndexVehiculo].Controls.Add(cbVehiculo);
            }

            cbVehiculo.SelectedIndexChanged += ComboOnSelectedIndexChanged;
            lnkIniciar.Command  += LnkbtnEstadoCommand;
            lnkCerrar.Command   += LnkbtnEstadoCommand;
            lnkReenviar.Command += LnkbtnEstadoCommand;
            lnkAsociar.Command  += LnkbtnEstadoCommand;
            lnkCombinar.Command += LnkbtnEstadoCommand;
        }
Exemplo n.º 18
0
 protected void ThrowCantDelete(string resource, string variable)
 {
     throw new ApplicationException(string.Format(CultureManager.GetError("CANT_DEL"), CultureManager.GetString(resource, variable)));
 }
Exemplo n.º 19
0
 protected void ThrowDuplicated(string resource, string variable)
 {
     throw new ApplicationException(string.Format(CultureManager.GetError("DUPLICATED"), CultureManager.GetString(resource, variable)));
 }
Exemplo n.º 20
0
 protected void ThrowInvalidValue(string resource, string variable)
 {
     throw new ApplicationException(string.Format(CultureManager.GetError("INVALID_VALUE"), CultureManager.GetString(resource, variable)));
 }
Exemplo n.º 21
0
 public SistemaVo(Sistema sistema)
 {
     Id          = sistema.Id;
     Descripcion = CultureManager.GetString("Menu", sistema.Descripcion);
     IconUrl     = string.Concat("~/", sistema.Descripcion, ".image");
 }
Exemplo n.º 22
0
        /// <summary>
        /// Gets the resource value and sets it as the label text.
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            WatermarkText = CultureManager.GetString(ResourceName, VariableName);
        }