Exemple #1
0
 protected override void ValidateDelete()
 {
     if (!DAOFactory.ReferenciaGeograficaDAO.ValidateDelete(EditObject.Id))
     {
         throw new ApplicationException(CultureManager.GetError("DELETE_GEO_REF"));
     }
 }
Exemple #2
0
 /// <summary>
 /// Validates the entity data.
 /// </summary>
 private void ValidateEntity()
 {
     if (txtNombre.Text == string.Empty)
     {
         throw new Exception(string.Format(CultureManager.GetError("MUST_ENTER_VALUE"), CultureManager.GetLabel("FULLNAME")));
     }
 }
        private void GuardarNuevaLinea()
        {
            if (string.IsNullOrEmpty(txtNumeroLinea.Text.Trim()))
            {
                DisplayError(string.Format(CultureManager.GetError("MUST_ENTER_VALUE"), CultureManager.GetLabel("NUMERO_LINEA")));
                return;
            }
            if (string.IsNullOrEmpty(txtImei.Text.Trim()))
            {
                DisplayError(string.Format(CultureManager.GetError("MUST_ENTER_VALUE"), CultureManager.GetLabel("SIM")));
                return;
            }

            if (!DAOFactory.LineaTelefonicaDAO.IsNumberUnique(EditObject.Id, txtNumeroLinea.Text.Trim()))
            {
                DisplayError(string.Format(CultureManager.GetError("DUPLICATED"), CultureManager.GetLabel("NUMERO_LINEA")));
                return;
            }

            if (!DAOFactory.LineaTelefonicaDAO.IsImeiUnique(EditObject.Id, txtImei.Text.Trim()))
            {
                DisplayError(string.Format(CultureManager.GetError("DUPLICATED"), CultureManager.GetLabel("SIM")));
                return;
            }

            EditObject.NumeroLinea = txtNumeroLinea.Text.Trim();
            EditObject.Imei        = txtImei.Text.Trim();

            DAOFactory.LineaTelefonicaDAO.SaveOrUpdate(EditObject);
        }
        protected void BtBuscarPoiClick(object sender, EventArgs e)
        {
            if (Usuario == null)
            {
                return;
            }

            lblPoiResult.Text = string.Empty;

            var empresas = (from l in SelectedLineas
                            select DAOFactory.LineaDAO.FindById(l)
                            into line
                            where line != null && line.Empresa != null
                            select line.Empresa.Id).ToList();

            var pois = DAOFactory.ReferenciaGeograficaDAO.GetByDescripcion(empresas, SelectedLineas, txtPoi.Text.Trim());

            switch (pois.Count())
            {
            case 0: JsAlert(string.Format(CultureManager.GetError("POI_NOT_FOUND"), "\\n\\n\\t" + txtPoi.Text)); break;

            case 1: SelectPoi(pois.First()); break;

            default:
                MultiViewPoi.SetActiveView(ViewPoiResult);
                cbPoiResult.DataSource = pois;
                cbPoiResult.DataBind();
                cbPoiResult.SelectedIndex = 0;
                break;
            }

            txtPoi.Text = string.Empty;
        }
Exemple #5
0
        protected void btSaveGeoRef_Click(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(txtCodigo.Text.Trim()))
                {
                    ThrowMustEnter("CODE");
                }

                var sel = gridConsultas.SelectedIndex;

                if (sel < 0)
                {
                    throw new Exception(CultureManager.GetError("MUST_SELECT_QUERY"));
                }

                var id = SelectedId[sel];

                var savedId = SavedId;

                if (savedId.Contains(id))
                {
                    throw new Exception(CultureManager.GetError("QUERY_ALREADY_SAVED"));
                }

                savedId.Add(id);
                SavedId = savedId;

                OnDireccionSaved(Selected[sel], id, cbTipoGeoRef.Selected, txtCodigo.Text.Trim());

                txtCodigo.Text     = String.Empty;
                lblSaveStatus.Text = String.Empty;
            }
            catch (Exception ex) { lblSaveStatus.Text = ex.Message; }
        }
Exemple #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int id;
                if (Request.QueryString["id"] == null || !int.TryParse(Request.QueryString["id"], out id))
                {
                    LblInfo.Text = CultureManager.GetError("NO_ENTREGA_INFO");
                    return;
                }

                var entrega = DAOFactory.EntregaDistribucionDAO.FindById(id);
                if (entrega != null)
                {
                    lblEntrega.Text  = entrega.Descripcion;
                    lblViaje.Text    = entrega.Viaje.Codigo;
                    lblVehiculo.Text = entrega.Viaje.Vehiculo != null ? entrega.Viaje.Vehiculo.Interno : CultureManager.GetError("NO_VEHICLE_ASSIGNED");
                    lblEstado.Text   = CultureManager.GetLabel(EntregaDistribucion.Estados.GetLabelVariableName(entrega.Estado));
                    if (entrega.ReferenciaGeografica != null)
                    {
                        lblDireccion.Text = GeocoderHelper.GetDescripcionEsquinaMasCercana(entrega.ReferenciaGeografica.Latitude, entrega.ReferenciaGeografica.Longitude);
                    }
                    lblEntrada.Text = (entrega.Entrada.HasValue ? entrega.Entrada.Value.ToDisplayDateTime().ToString("yyyy/MM/dd HH:mm") : string.Empty);
                    lblManual.Text  = (entrega.Manual.HasValue ? entrega.Manual.Value.ToDisplayDateTime().ToString("yyyy/MM/dd HH:mm") : string.Empty);
                    lblSalida.Text  = (entrega.Salida.HasValue ? entrega.Salida.Value.ToDisplayDateTime().ToString("yyyy/MM/dd HH:mm") : string.Empty);
                    lnkMonitorCiclo.Attributes.Add("id", entrega.Viaje.Id.ToString("#0"));
                }
            }
        }
        //private bool StartDistribucion(int id)
        //{
        //    var distribucion = DAOFactory.ViajeDistribucionDAO.FindById(id);

        //    if (distribucion.Estado != ViajeDistribucion.Estados.Pendiente) return false;
        //    var ciclo = new CicloLogisticoDistribucion(distribucion, DAOFactory, new MessageSaver(DAOFactory));
        //    IEvent evento = new InitEvent(DateTime.UtcNow);

        //    ciclo.ProcessEvent(evento);
        //    return true;
        //}

        protected void BtIniciarClick(object sender, EventArgs e)
        {
            mpePanel.Hide();
            if (TicketToInitId.Get() <= 0)
            {
                return;
            }


            var ticket = DAOFactory.ViajeDistribucionDAO.FindById(TicketToInitId.Get());

            TicketToInitId.Set(-1);

            var ciclo = new CicloLogisticoDistribucion(ticket, DAOFactory, new MessageSaver(DAOFactory));

            var evento = new InitEvent(DateTime.UtcNow);

            try
            {
                ciclo.ProcessEvent(evento);
                ShowInfo(CultureManager.GetSystemMessage("CLOG_START_SENT") + ticket.Vehiculo.Interno);
                Bind();
            }
            catch (NoVehicleException)
            {
                ShowError(new ApplicationException(CultureManager.GetError("TICKET_NO_VEHICLE_ASSIGNED")));
            }
            catch //AlreadyOpenException, QueueException, Exception
            {
                ShowError(new ApplicationException(CultureManager.GetError("CLOG_MESSAGE_NOT_SENT") + ticket.Vehiculo.Interno));
            }
        }
Exemple #8
0
 /// <summary>
 /// Validates the current edited object.
 /// </summary>
 protected override void ValidateSave()
 {
     if (txtDescripcion.Text == string.Empty)
     {
         throw new Exception(string.Format(CultureManager.GetError("MUST_ENTER_VALUE"), CultureManager.GetLabel("DESCRIPCION")));
     }
 }
        /// <summary>
        /// Saves the duplicated messenges.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            if (lbEmpresa.SelectedValues.Contains(0) && lbLinea.SelectedValues.Contains(0))
            {
                return;
            }

            var messenges = (from mens in Mensajes select DAOFactory.MensajeDAO.FindById(mens)).ToList();

            foreach (var mensaje in messenges)
            {
                if (!lbEmpresa.SelectedValues.Contains(0))
                {
                    DuplicarMensajePorEmpresa(mensaje);
                }

                if (lbLinea.SelectedValues.Contains(0))
                {
                    continue;
                }

                DuplicarMensajePorLinea(mensaje);
            }

            infoLabel1.Text = CultureManager.GetError(MensajesDuplicados);
        }
        protected void BtBuscarClick(object sender, EventArgs e)
        {
            if (Usuario == null)
            {
                return;
            }

            var entidades = DAOFactory.EntidadDAO.GetByDescripcion(new[] { cbLocacion.Selected },
                                                                   new[] { cbPlanta.Selected },
                                                                   new[] { -1 },
                                                                   new[] { cbTipoEntidad.Selected },
                                                                   txtEntidad.Text.Trim());

            if (!entidades.Any())
            {
                JsAlert(string.Format(CultureManager.GetError("ENTIDAD_NOT_FOUND"), (object)txtEntidad.Text.Trim()));

                SetSelectedEntidades();

                return;
            }

            foreach (var entidad in entidades)
            {
                var style = GetMarkerStyle(entidad);
                AddMarker(entidad, style);
                SelectEntidad(entidad.Id);
            }

            Monitor.SetCenter(entidades.First().ReferenciaGeografica.Latitude, entidades.First().ReferenciaGeografica.Longitude, SearchZoomLevel);

            UpdatePanel1.Update();
        }
Exemple #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int idEvento, idViaje;

            if (Request.QueryString["idEvento"] == null || !int.TryParse(Request.QueryString["idEvento"], out idEvento) ||
                Request.QueryString["idViaje"] == null || !int.TryParse(Request.QueryString["idViaje"], out idViaje))
            {
                LblInfo.Text = CultureManager.GetError("NO_ENTREGA_INFO");
                return;
            }

            var viaje  = DAOFactory.ViajeDistribucionDAO.FindById(idViaje);
            var evento = DAOFactory.LogMensajeDAO.FindById(idEvento);

            Evento = evento;
            Viaje  = viaje;

            if (!IsPostBack)
            {
                if (evento != null && viaje != null)
                {
                    lblFecha.Text           = evento.Fecha.ToDisplayDateTime().ToString("dd-MM-yyyy HH:mm");
                    lblEvento.Text          = evento.Texto;
                    lblLatLong.Text         = "(" + evento.Latitud + " ; " + evento.Longitud + ")";
                    gridEntregas.DataSource = viaje.Detalles.Where(d => d.PuntoEntrega != null);
                    gridEntregas.DataBind();
                }
            }
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int id;
                if (Request.QueryString["id"] == null || !int.TryParse(Request.QueryString["id"], out id))
                {
                    LblInfo.Text = CultureManager.GetError("NO_ENTREGA_INFO");
                    return;
                }

                var entrega = DAOFactory.EntregaDistribucionDAO.FindById(id);
                if (entrega != null)
                {
                    var icono = entrega.PuntoEntrega.ReferenciaGeografica.Icono != null?Path.Combine(IconDir, entrega.PuntoEntrega.ReferenciaGeografica.Icono.PathIcono) : ResolveUrl("~/point.png");

                    imgIcono.Src        = icono;
                    lblCodigo.Text      = string.Format("{0} - {1}<br>{2}", entrega.PuntoEntrega.Codigo, entrega.PuntoEntrega.Descripcion, GeocoderHelper.GetDescripcionEsquinaMasCercana(entrega.PuntoEntrega.ReferenciaGeografica.Latitude, entrega.PuntoEntrega.ReferenciaGeografica.Longitude));
                    lblDescripcion.Text = entrega.Descripcion;
                    lblProgramado.Text  = entrega.Programado.ToDisplayDateTime().ToString("HH:mm");
                    //lblGps.Text = entrega.KmGps.HasValue ? entrega.KmGps.Value.ToString(CultureInfo.InvariantCulture) : "N/D";
                    lblEntrada.Text = entrega.Entrada.HasValue ? entrega.Entrada.Value.ToDisplayDateTime().ToString("HH:mm") : string.Empty;
                    lblManual.Text  = entrega.Manual.HasValue ? entrega.Manual.Value.ToDisplayDateTime().ToString("HH:mm") : string.Empty;
                    lblSalida.Text  = entrega.Salida.HasValue ? entrega.Salida.Value.ToDisplayDateTime().ToString("HH:mm") : string.Empty;
                    //lblCalculado.Text = entrega.KmCalculado.HasValue ? entrega.KmCalculado.Value.ToString(CultureInfo.InvariantCulture) : "N/D";
                    //lblControlado.Text = entrega.Viaje.Controlado && entrega.KmControlado.HasValue ? entrega.KmControlado.Value.ToString(CultureInfo.InvariantCulture) : "N/D";
                    lblEstado.Text = CultureManager.GetLabel(EntregaDistribucion.Estados.GetLabelVariableName(entrega.Estado));
                    lnkEditarPunto.OnClientClick = string.Format("window.open('../Parametrizacion/GeoRefAlta.aspx?id={0}')", entrega.PuntoEntrega.ReferenciaGeografica.Id);
                }
            }
        }
Exemple #13
0
 /// <summary>
 /// Validates current object for deleting.
 /// </summary>
 private new void ValidateDelete()
 {
     if (DAOFactory.TipoReferenciaGeograficaDAO.HasChilds(EditObject.Id))
     {
         throw new ApplicationException(CultureManager.GetError("CANT_DEL_TIPO_POI"));
     }
 }
Exemple #14
0
        /// <summary>
        /// Sets page display according to the exception recieved.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            SetImage();

            if (Session["Error"] == null)
            {
                return;
            }

            var exception = (Exception)Session["Error"];
            var lastPage  = Session["LastVisitedPage"] != null ? (string)Session["LastVisitedPage"] : String.Empty;

            if (!NotifyError(exception, lastPage))
            {
                lblMailOK.Text = CultureManager.GetError("ERROR_MAIL_FAILED");
            }

            PrintError(exception, lastPage);

            Session["Error"]           = null;
            Session["LastVisitedPAge"] = null;
        }
Exemple #15
0
        /// <summary>
        /// Selects the indicated profile for the user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btSelPerfil_Click(object sender, EventArgs e)
        {
            try
            {
                if (LoginUser > 0)
                {
                    _usuario = DAOFactory.UsuarioDAO.FindById(LoginUser);

                    if (cbPerfiles.SelectedIndex == -1)
                    {
                        throw new Exception(string.Format(CultureManager.GetError("NO_SELECTED"), CultureManager.GetEntity("ROLE")));
                    }

                    var selectedProfile = Convert.ToInt32(cbPerfiles.SelectedValue);

                    IEnumerable <MovMenu>    modules;
                    IEnumerable <Asegurable> securables;
                    IEnumerable <int>        perfiles = DAOFactory.PerfilDAO.GetProfileAccess(_usuario, selectedProfile, out modules, out securables);

                    WebSecurity.Login(_usuario, perfiles, modules, securables);

                    ShowWellcome();
                }
                else
                {
                    ShowLogin();
                }
            }
            catch (Exception ex) { ShowError(ex); }
        }
Exemple #16
0
 /// <summary>
 /// Validates the current edited object.
 /// </summary>
 protected override void ValidateSave()
 {
     if (txtClave.Visible && (txtClave.Text == string.Empty || txtConfirmacion.Text == string.Empty ||
                              (!txtClave.Text.Equals(txtConfirmacion.Text))))
     {
         throw new Exception(CultureManager.GetError("PASSWORDS_DONT_MATCH"));
     }
 }
Exemple #17
0
        private void SendMessage(string cmd, string par)
        {
            if (cbSubEntidadMensaje.SelectedIndex < 0)
            {
                JsAlert(string.Format(CultureManager.GetError("NO_SELECTED"), CultureManager.GetEntity("PARENTI81")));
                return;
            }

            var ok    = 0;
            var error = 0;

            var sent   = string.Empty;
            var failed = string.Empty;

            foreach (ListItem li in cbSubEntidadMensaje.Items)
            {
                if (!li.Selected)
                {
                    continue;
                }

                var c = DAOFactory.SubEntidadDAO.FindById(Convert.ToInt32(li.Value));

                if (c.Sensor == null || c.Sensor.Dispositivo == null)
                {
                    JsAlert(string.Format(CultureManager.GetSystemMessage("UNASIGNED_VEHICLE"), c.Descripcion));
                    continue;
                }

                var dispositivo = c.Sensor.Dispositivo;
                var message     = M2mMessageSender.Create(dispositivo, new M2mMessageSaver(DAOFactory)).AddCommand(cmd);

                var cfgValue = par.Equals("On") ? "true" : "false";
                message.AddConfigParameter("DigitalOutput1", cfgValue, 0);

                var sendState = message.Send();

                if (sendState)
                {
                    ok++;
                    sent += "\\n" + li.Text;
                }
                else
                {
                    error++;
                    failed += "\\n" + li.Text;
                }
            }

            if (ok > 0)
            {
                JsAlert(string.Format(CultureManager.GetSystemMessage("MESSAGE_SENT"), sent));
            }
            if (error > 0)
            {
                JsAlert(string.Format(CultureManager.GetError("MESSAGE_NOT_SENT"), failed));
            }
        }
Exemple #18
0
        protected override void ValidateDelete()
        {
            var coches = DAOFactory.CocheDAO.FindList(new[] { -1 }, new[] { -1 }, new[] { EditObject.Id });

            if (coches != null && coches.Any())
            {
                throw new Exception(CultureManager.GetError("ASSIGNED_VEHICLE_TYPE"));
            }
        }
Exemple #19
0
        protected override void OnDelete()
        {
            if (DAOFactory.EmpleadoDAO.FindByTarjeta(EditObject.Id) != null)
            {
                throw new Exception(CultureManager.GetError("CARD_USED"));
            }

            DAOFactory.TarjetaDAO.Delete(EditObject);
        }
Exemple #20
0
        /// <summary>
        /// Validate data before dalete.
        /// </summary>
        protected override void ValidateDelete()
        {
            var devices = DAOFactory.DispositivoDAO.GetByTipo(EditObject);

            if (devices != null && devices.Count > 0)
            {
                throw new Exception(CultureManager.GetError("ASSIGNED_DEVICE_TYPE"));
            }
        }
Exemple #21
0
        /// <summary>
        /// Actions to do on delete
        /// </summary>
        protected override void OnDelete()
        {
            if (!EditObject.Coches.IsEmpty())
            {
                throw new ApplicationException(CultureManager.GetError("CANT_DEL_TRANSPORTISTA"));
            }

            DAOFactory.TransportistaDAO.Delete(EditObject);
        }
Exemple #22
0
        protected override string GetGraphXml()
        {
            ToogleItems(lbBase);

            using (var helper = new FusionChartsMultiSeriesHelper())
            {
                SetGraphConfiguration(helper);

                var iniDate  = SecurityExtensions.ToDataBaseDateTime(dtpDate.SelectedDate.GetValueOrDefault());
                var finDate  = SecurityExtensions.ToDataBaseDateTime(dtpDate.SelectedDate.GetValueOrDefault()).AddHours(23).AddMinutes(59).AddSeconds(59);
                var colorGen = new ColorGenerator();

                var noCategoriesAdded = true;
                var hasValue          = false;
                if (lbBase.GetSelectedIndices().Length == 0)
                {
                    lbBase.ToogleItems();
                }

                foreach (var index in lbBase.GetSelectedIndices())
                {
                    var data = ReportFactory.IdleTimesDAO.GetAllMovilesStoppedInPlanta(Convert.ToInt32((string)lbBase.Items[index].Value),
                                                                                       iniDate, finDate, chkUndefined.Checked);

                    var dataset = new FusionChartsDataset {
                        Name = lbBase.Items[index].Text
                    };
                    dataset.SetPropertyValue("SeriesName", lbBase.Items[index].Text);
                    dataset.SetPropertyValue("color", HexColorUtil.ColorToHex(colorGen.GetNextColor()));

                    foreach (var item in data)
                    {
                        if (noCategoriesAdded)
                        {
                            helper.AddCategory(item.Date.ToShortTimeString());
                        }
                        dataset.addValue(item.TotalVehicles.ToString(CultureInfo.InvariantCulture));
                        if (!item.TotalVehicles.Equals(0))
                        {
                            hasValue = true;
                        }
                    }

                    helper.AddDataSet(dataset);
                    noCategoriesAdded = false;
                }

                if (!hasValue)
                {
                    throw new Exception(CultureManager.GetError("NO_MOBILE_IN_BASE"));
                }

                return(helper.BuildXml());
            }
        }
Exemple #23
0
        public Respuesta <string> Login(string username, string password)
        {
            try
            {
                var clientIp = Context.Request.UserHostAddress;

                if (string.IsNullOrEmpty(username))
                {
                    throw new ApplicationException(CultureManager.GetError("NO_USERNAME"));
                }
                if (string.IsNullOrEmpty(password))
                {
                    throw new ApplicationException(CultureManager.GetError("NO_PASSWORD"));
                }

                var user = DAOFactory.UsuarioDAO.FindForLogin(username, password);

                if (user == null)
                {
                    throw new ApplicationException(CultureManager.GetError("WRONG_USER_PASS"));
                }
                //if (user.Tipo == 0) throw new ApplicationException(CultureManager.GetError("NO_ACCESS"));
                if (user.Inhabilitado || (user.FechaExpiracion != null && user.FechaExpiracion < DateTime.UtcNow))
                {
                    user.Inhabilitado    = true;
                    user.FechaExpiracion = null;
                    DAOFactory.UsuarioDAO.SaveOrUpdate(user);
                    throw new ApplicationException(CultureManager.GetError("USER_DISABLED"));
                }
                if (!user.IsInIpRange(clientIp))
                {
                    throw new ApplicationException("No puede acceder al sistema desde esta ubicacion");
                }

                Usuario = user;

                var sessionId = Guid.NewGuid().ToString();

                var loginInfo = new LoginInfo
                {
                    ClientIp   = clientIp,
                    SessionId  = sessionId,
                    Expiration = DateTime.UtcNow.AddMinutes(20),
                    UserId     = user.Id
                };

                Context.Application[sessionId] = loginInfo;

                return(Respuesta <string> .Create(sessionId));
            }
            catch (Exception ex)
            {
                return(Respuesta <string> .CreateError(ex.Message));
            }
        }
Exemple #24
0
        /// <summary>
        /// Enviar mensaje Personalizado
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btMensajePer_Click(object sender, EventArgs e)
        {
            var msg = txtMensajePer.Text.Trim();

            if (string.IsNullOrEmpty(msg))
            {
                JsAlert(CultureManager.GetError("ENTER_MESSAGE_TEXT"));
                return;
            }
            SendMessage(MessageSender.Comandos.SubmitTextMessage, msg);
        }
Exemple #25
0
        /// <summary>
        /// Card massive import procedure using LinqToExcel
        /// </summary>
        private void ImportDevices()
        {
            var fileName = string.Concat(Server.MapPath(TmpDir), DateTime.Now.ToString("yyyyMMdd-HHmmss"), ".xls");

            try
            {
                fuImportData.SaveAs(fileName);

                var linea   = ddlBaseDispositivo.Selected > 0 ? DAOFactory.LineaDAO.FindById(ddlBaseDispositivo.Selected) : null;
                var empresa = ddlDistritoDispositivo.Selected > 0 ? DAOFactory.EmpresaDAO.FindById(ddlDistritoDispositivo.Selected) : linea != null ? linea.Empresa : null;
                var tipo    = DAOFactory.TipoDispositivoDAO.FindById(ddlTipoDispositivo.Selected);

                var file = new ExcelQueryFactory(fileName);
                var data = from c in file.Worksheet <DispositivoImportador>("Importar") select c;

                foreach (var dispImp in data)
                {
                    if (!TieneDatos(dispImp))
                    {
                        continue;
                    }

                    var device = SetDeviceDefaultValues(dispImp, empresa, linea, tipo);
                    var coche  = !string.IsNullOrEmpty(dispImp.Interno) && linea != null
                                    ? DAOFactory.CocheDAO.GetByInterno(new[] { ddlDistritoDispositivo.Selected },
                                                                       new[] { ddlBaseDispositivo.Selected },
                                                                       dispImp.Interno)
                                    : null;

                    if (coche != null)
                    {
                        coche.Dispositivo = device;

                        DAOFactory.CocheDAO.SaveOrUpdate(coche);
                    }
                    else
                    {
                        DAOFactory.DispositivoDAO.SaveOrUpdate(device);
                    }

                    if (device.IdNum == 0)
                    {
                        device.IdNum = device.Id;
                    }

                    DAOFactory.DispositivoDAO.SaveOrUpdate(device);
                }

                infoLabel1.Mode = InfoLabelMode.INFO;
                infoLabel1.Text = @"Se ha finalizado con exito la importacion de Dispositivos.";
            }
            catch (Exception e) { ShowError(new Exception(CultureManager.GetError(FileFormat), e)); }
            finally { File.Delete(fileName); }
        }
Exemple #26
0
        private void SetView(int view)
        {
            switch (view)
            {
            case Views.Vehiculos:
                ListControl.Set(null);
                gridVehiculos.DataSource = VehiculosPendientes;
                gridVehiculos.DataBind();
                IndexControl.Set(0);
                break;

            case Views.Control:
                if (!VehiculosSeleccionados.Any())
                {
                    ShowError(string.Format(CultureManager.GetError("MUST_SELECT_VALUE"), CultureManager.GetEntity("PARENTI03")));
                    SetView(Views.Vehiculos);
                    return;
                }
                if (ListControl.Get() == null)
                {
                    var viajes = GetDistribuciones(VehiculosSeleccionados).Where(x => !x.Controlado).Select(v => v.Id).ToList();
                    ListControl.Set(viajes);
                    CountControl.Set(viajes.Count);
                }
                var index = IndexControl.Get();
                var count = CountControl.Get();

                var viaje = GetDistribucionAControlar(index);
                BindViaje(viaje);

                txtIndexControl.Text = (index + 1).ToString("#0");
                lblCountControl.Text = count.ToString("#0");
                btSiguiente.Visible  = index < count - 1;
                btAnterior.Visible   = index > 0;

                break;

            case Views.Resumen:
                var distribuciones = GetDistribuciones(new[] { -1 });
                var controladas    = distribuciones.Where(d => d.Controlado).Select(d => new ViajeDistribucionVo(d)).ToList();
                //var noControladas = distribuciones.Where(d => !d.Controlado).ToList();

                gridResumen.GroupedColumns.Clear();
                gridResumen.GroupedColumns.Add(gridResumen.Columns[0] as C1Field);
                gridResumen.DataSource = controladas;
                gridResumen.DataBind();
                break;
            }

            tab.ActiveTabIndex  = view;
            updCompleto.Visible = true;
            updCompleto.Update();
        }
Exemple #27
0
        private void View()
        {
            if (Distrito == null)
            {
                ShowError(new Exception(CultureManager.GetError("MUST_SEARCH")));
                return;
            }

            AddSessionParameters(false);

            OpenWin(String.Concat(ApplicationPath, "Monitor/MonitorHistorico/monitorHistorico.aspx"), "Monitor Historico");
        }
Exemple #28
0
        /// <summary>
        /// Validates current edited object.
        /// </summary>
        protected override void ValidateSave()
        {
            if (cbSubSistema.SelectedIndex == -1)
            {
                throw new Exception(string.Format(CultureManager.GetError("NO_SELECTED"), CultureManager.GetEntity("SISTEMA")));
            }

            if (txtReferencia.Text.Contains(","))
            {
                throw new Exception(CultureManager.GetError("FUNC_REF_WRONG_CHARS"));
            }
        }
Exemple #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            double la, lo;

            if (Request.QueryString["d"] == null)
            {
                lblDescripcion.Text = CultureManager.GetError("NO_ADDRESS_INFO");
                return;
            }
            if (Request.QueryString["la"] == null || !double.TryParse(Request.QueryString["la"], NumberStyles.Any, CultureInfo.InvariantCulture, out la))
            {
                lblDescripcion.Text = CultureManager.GetError("NO_ADDRESS_INFO");
                return;
            }
            if (Request.QueryString["lo"] == null || !double.TryParse(Request.QueryString["lo"], NumberStyles.Any, CultureInfo.InvariantCulture, out lo))
            {
                lblDescripcion.Text = CultureManager.GetError("NO_ADDRESS_INFO");
                return;
            }

            var idsLineas = Request.QueryString["l"].Split(' ').Select(l => Convert.ToInt32(l)).ToList();

            if (idsLineas.Count <= 0)
            {
                lblDescripcion.Text = CultureManager.GetError("NO_ADDRESS_INFO");
                return;
            }

            lblTipo.Text        = CultureManager.GetLabel("ADDRESS");
            lblDescripcion.Text = Request.QueryString["d"];
            imgTipo.ImageUrl    = "salida.gif";
            lblLatitud.Text     = la.ToString();
            lblLongitud.Text    = lo.ToString();

            var vehicles = DAOFactory.CocheDAO.GetList(new[] { -1 }, idsLineas);

            var pois = ReportFactory.MobilePoiDAO.GetMobilesNearPoint(vehicles, la, lo, 1000);

            if (pois.Count > 10)
            {
                pois.RemoveRange(10, pois.Count - 10);
            }

            gridMov.DataSource = pois;
            gridMov.DataBind();
        }
Exemple #30
0
 protected void btPedirFoto_Click(object sender, EventArgs e)
 {
     if (!dtFotoDesde.SelectedDate.HasValue)
     {
         JsAlert(string.Format(CultureManager.GetError("NO_SELECTED"), CultureManager.GetLabel("DESDE")));
         return;
     }
     if (!dtFotoHasta.SelectedDate.HasValue)
     {
         JsAlert(string.Format(CultureManager.GetError("NO_SELECTED"), CultureManager.GetLabel("HASTA")));
         return;
     }
     SendMessage(MessageSender.Comandos.RetrievePictures, null);
 }