Example #1
0
    public static string WLeerLogoMunicipio()
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();
            string sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos);
            Lista.Add("Exito");
            Lista.Add(string.Format("/images/MunLog_{0}.jpg", sIdClienteMunicipio));
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WGrabarMunicipio(string sNombreMunic, string sRutMunic, string sNombreUserMunic, string sRutUserMunic, string sCorreoUserMunic,
                                          string sClave, string sClave2, string sTelefono)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            ClienteMunicipio cliente = new ClienteMunicipio(usr);
            cliente.Create(sNombreMunic, sRutMunic, sNombreUserMunic, sRutUserMunic, sCorreoUserMunic, sClave, sTelefono);

            Lista.Add("Exito");
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txtFecIni.Text = string.Format("{0}-{1}-{2}", DateTime.Now.Day.ToString("00"),
                                           DateTime.Now.Month.ToString("00"), DateTime.Now.Year.ToString("00"));
            txtFecIniHora.Text = string.Format("{0}:{1}:{2}", "08", "00", "00");

            DateTime Now = UtilWeb.GetDateNow();

            txtFecFin.Text = string.Format("{0}-{1}-{2}", DateTime.Now.Day.ToString("00"),
                                           DateTime.Now.Month.ToString("00"), DateTime.Now.Year.ToString("00"));
            txtFecFinHora.Text = string.Format("{0}:{1}:{2}", Now.Hour.ToString("00"),
                                               Now.Minute.ToString("00"), Now.Second.ToString("00"));

            //txtFecIni.Text = string.Format("{0}-{1}-{2}", DateTime.Now.Day.ToString("00"),
            //    DateTime.Now.Month.ToString("00"), DateTime.Now.Year.ToString("00"));
            //txtFecIniHora.Text = string.Format("{0}:{1}:{2}", "08", "00", "00");

            //txtFecFin.Text = string.Format("{0}-{1}-{2}", DateTime.Now.Day.ToString("00"),
            //    DateTime.Now.Month.ToString("00"), DateTime.Now.Year.ToString("00"));
            //txtFecFinHora.Text = string.Format("{0}:{1}:{2}", DateTime.Now.Hour.ToString("00"),
            //    DateTime.Now.Minute.ToString("00"), DateTime.Now.Second.ToString("00"));
        }
    }
Example #4
0
    public static string WLeerUsuarioConectadoAndMunicipios()
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            string html = "";
            WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html);

            Lista.Add("Exito");
            Lista.Add(usr.NombreLargo);
            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    private static void WLeerCamionesMunicipios_Internal(Usuario usr, ref string html, string IdMunicipio)
    {
        //Camiones camion = new Camiones(usr);
        //camion.ReadAll();
        VehRecolector camion = new VehRecolector(usr);

        if (IdMunicipio.Trim().Length == 0)
        {
            camion.ReadAll();
        }
        else
        {
            camion.ReadAll_Camion_del_Municipio(IdMunicipio);
        }
        //Se genera la tabla HTML
        List <ColumnaHtml> lista = new List <ColumnaHtml>();

        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreCamion"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreMarca"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "RutUserMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreModelo"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreTagPatente"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Telefono"));  //Aca va IMAGEN
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditCamion"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteCamion"));

        UtilWeb util = new UtilWeb();

        html = util.GetHtmlTableBasica(camion.Datos, lista);
    }
Example #6
0
    public static string WLeerDatosIniciales()
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        //if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        //    return scriptSerializer.Serialize(Lista.ToArray());

        try
        {
            ClienteMunicipio munic = new ClienteMunicipio();
            munic.ReadAll();

            UtilWeb.AddElementSeleccioneALista(munic.Datos);
            UtilWeb util      = new UtilWeb();
            string  jsonMunic = util.GetJson(munic.Datos);

            Lista.Add("Exito");
            Lista.Add(jsonMunic);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #7
0
    public static string WGrabarCamion(string sNombreCamion, string sMarcaCamion, string sModeloCamion, string sTagCamion)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            REM.BC2.Camiones camion = new REM.BC2.Camiones(usr);
            //camion.Create(sNombreCamion, sMarcaCamion, sModeloCamion, sTagCamion);

            Lista.Add("Exito");
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WLeerGeocercasDelMunicipio(string IdMunicipio)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            Geocercas geo = new Geocercas(usr);
            geo.ReadAll_Geocerca_del_Municipio(IdMunicipio);
            UtilWeb.AddElementSeleccioneALista(geo.Datos);
            UtilWeb util    = new UtilWeb();
            string  jsonMun = util.GetJson(geo.Datos);

            string html = "";
            WLeerGeocerca_Internal(usr, ref html, IdMunicipio);

            Lista.Add("Exito");
            //Lista.Add(jsonMun);
            Lista.Add(html);
            //Lista.Add(jsonCamiones);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    private static void WLeerGeocerca_Internal(Usuario usr, ref string html, string IdMunicipio)
    {
        Geocercas geo = new Geocercas(usr);

        //geo.ReadAll();
        if (IdMunicipio.Trim().Length == 0)
        {
            geo.ReadAll_con_Municipio();
        }
        else
        {
            geo.ReadAll_Geocerca_del_Municipio(IdMunicipio);
        }

        //Se genera la tabla HTML
        List <ColumnaHtml> lista = new List <ColumnaHtml>();

        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreGeocerca"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Ubicacion"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "RutUserMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Coordenadas"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Observacion"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Telefono"));  //Aca va IMAGEN
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditGeocerca"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteGeocerca"));

        UtilWeb util = new UtilWeb();

        html = util.GetHtmlTableBasica(geo.Datos, lista);
    }
    public static string WEliminarCamion(string Id)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            if (Id.Trim().Length != 0)
            {
                VehRecolector camion = new VehRecolector(usr);
                camion.Delete(Id);

                string html = "";
                WLeerCamionesMunicipios_Internal(usr, ref html, "");

                Lista.Add("Exito");
                Lista.Add(html);
            }
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WLeerParaEditarCamion(string Id)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            //ClienteMunicipio cliente = new ClienteMunicipio(usr);
            VehRecolector camion = new VehRecolector(usr);
            camion.Read(Id);
            //cliente.Read(Id);

            Lista.Add("Exito");

            Lista.Add(camion.Datos.Rows[0]["NombreCamion"].ToString());
            Lista.Add(camion.Datos.Rows[0]["NombreMarca"].ToString());
            Lista.Add(camion.Datos.Rows[0]["NombreModelo"].ToString());
            Lista.Add(camion.Datos.Rows[0]["NombreTagPatente"].ToString());
            Lista.Add(camion.Datos.Rows[0]["IdClienteMunicipio"].ToString());
            //Lista.Add(camion.Datos.Rows[0]["Telefono"].ToString());
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #12
0
    public static string WConsultarOTs(string sFechaDesde, string sFechaHasta, string sIdRuta, string sIdCamion)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            Ot ot = new Ot(usr);
            usr.ReadMunic();
            string   sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos);
            DateTime dtDesde;
            if (!DateTime.TryParse(sFechaDesde, out dtDesde))
            {
                Lista.Add("errorvalidacion");
                Lista.Add(string.Format("Ingrese fecha correcta Desde {0}", sFechaDesde));
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }
            DateTime dtHasta;
            if (!DateTime.TryParse(sFechaHasta, out dtHasta))
            {
                Lista.Add("errorvalidacion");
                Lista.Add(string.Format("Ingrese fecha correcta Hasta {0}", sFechaHasta));
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }
            ot.Buscar(sIdClienteMunicipio, dtDesde, dtHasta, sIdRuta, sIdCamion);

            //Se genera la tabla HTML
            List <ColumnaHtml> lista = new List <ColumnaHtml>();
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "StrDesdeHasta"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreRuta"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Numero"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Dia"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Inicio"));
            //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Termino"));
            //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "KG_Descargados"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreCamion"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreChoferes"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditOt"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteOt"));
            UtilWeb util = new UtilWeb();
            string  html = util.GetHtmlTableBasica(ot.Datos, lista);

            Lista.Add("Exito");
            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #13
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (this.txtName.Text.Trim().Length == 0 || this.txtPass.Text.Trim().Length == 0)
        {
            return;
        }

        Usuario       usuario         = new Usuario();
        string        userHostAddress = this.Request.UserHostAddress;
        string        userIp          = this.GetUserIP();
        bool          IsMismIP        = false;
        eeResultLogin eeResultLogin   = usuario.Login(this.txtName.Text, this.txtPass.Text, "", userHostAddress, userIp, ref IsMismIP);

        switch (eeResultLogin)
        {
        case eeResultLogin.UserNoExiste:
            this.Response.Redirect("UserNoAuthorized.aspx", true);
            break;

        case eeResultLogin.LoginExitoMismaIP:
        case eeResultLogin.LoginExitoDistintaIP:
            if (eeResultLogin == eeResultLogin.LoginExitoDistintaIP)
            {
                this.Response.Redirect("UserNoAuthorized.aspx", true);
                break;
            }
            string Token           = "";
            string StringOfControl = "";
            string Serial          = "";
            string stringSecure    = UtilWeb.GenerateStringSecure(usuario.Id, ref StringOfControl, ref Serial, ref Token);
            usuario.CreateSesionHistory(Token, DateTime.Now, userHostAddress, userIp, stringSecure, StringOfControl);
            this.Response.Cookies.Add(new HttpCookie("QS", "s=" + Token)
            {
                Expires = DateTime.Now.AddMinutes(double.Parse(ConfigurationManager.AppSettings["MinutesSession"].ToString()))
            });

            //Procesa tareas batch
            if (ConfigurationManager.AppSettings["Ejecutar_Carga_Fleetup"].ToString().ToUpper() == "TRUE")
            {
                FleetUpRecordVehPasoGeoCerca batch = new FleetUpRecordVehPasoGeoCerca(usuario);
                batch.ProcesarTareasBatchWialon(usuario);
            }

            if (usuario.H2QAccess)
            {
                this.Response.Redirect("registro_municipio.html", false);
                //this.Response.Redirect("RegistroClientes.html", false);
            }
            if (usuario.MunicipioAccess)
            {
                this.Response.Redirect("municipio_menu.html", false);
                // this.Response.Redirect("registro_ot_copia.html", false);
            }
            break;
        }
    }
    public static string WLeerDatosIniciales()
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();

            //Ruta rutas = new Ruta(usr);
            //rutas.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            //UtilWeb.AddElementSeleccioneALista(rutas.Datos);
            //UtilWeb util = new UtilWeb();
            //string jsonRutas = util.GetJson(rutas.Datos);

            //VehRecolector camiones = new VehRecolector(usr);
            //camiones.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            //UtilWeb.AddElementSeleccioneALista(camiones.Datos);
            //string jsonCamiones = util.GetJson(camiones.Datos);
            Solicitud solicitud = new Solicitud(usr);
            solicitud.Buscar(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));

            //Se genera la tabla HTML
            List <ColumnaHtml> lista = new List <ColumnaHtml>();
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "StrDesdeHasta"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreRuta"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Dia"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Inicio"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Termino"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "KG_Descargados"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreCamion"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreChoferes"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditSolicitud"));
            lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteSolicitud"));
            UtilWeb util = new UtilWeb();
            string  html = util.GetHtmlTableBasica(solicitud.Datos, lista);

            Lista.Add("Exito");
            Lista.Add(html);
            //Lista.Add(jsonRutas);
            //Lista.Add(jsonCamiones);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #15
0
    public static string WGrabarOt(string sId, string sNumero, string sFecha, string sIdClienteMunicipio, string sIdRuta, string sIdCamion,
                                   string sNombreChoferes, string sCorreos, string sHora)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            if (sCorreos.Trim().Length == 0)
            {
                Lista.Add("error");
                Lista.Add("Ingrese el dato: Correos");
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }

            if (!UtilWeb.IsValidMail(sCorreos.Trim()))
            {
                Lista.Add("error");
                Lista.Add("El dato Correos está incorrecto");
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }

            double IdNew = 0;
            Ot     ot    = new Ot(usr);
            usr.ReadMunic();
            sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos);

            if (sId.Trim().Length == 0)
            {
                IdNew = ot.Create(sNumero, sFecha, sIdClienteMunicipio, sIdRuta, sIdCamion, sNombreChoferes, sCorreos, sHora, "0", "0");
            }
            else
            {
                ot.Update(sId, sNumero, sFecha, sIdClienteMunicipio, sIdRuta, sIdCamion, sNombreChoferes, sCorreos, sHora, "0", "0");
            }

            //WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html);

            Lista.Add("Exito");
            Lista.Add(string.Format("OT: {0}", IdNew.ToString()));
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #16
0
    public static string WEnviarCorreoSolicitud(string sIdSolicitud, string sNumero, string sFecha, string sIdCamion, string sNombreChoferes, string sCorreos,
                                                string sHora, string sValorRetiro)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            double IdNew = 0;
            usr.ReadMunic();
            string sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos);

            double    IdOT      = 0;
            double    IdSoltemp = 0;
            Solicitud solic     = new Solicitud(usr);
            if (solic.Read(sIdSolicitud))
            {
                Ot ot = new Ot(usr);
                if (double.TryParse(sIdSolicitud, out IdSoltemp))
                {
                    IdOT = ot.ReadByIdSolicitud(sIdSolicitud);
                }
                VehRecolector camion = new VehRecolector(usr);
                camion.Read(sIdCamion);

                //Viene leida la OT
                string CorreoString = File.ReadAllText(HttpContext.Current.Server.MapPath("~/templates") + "/correoavisoaciudadano.txt");
                CorreoString = CorreoString.Replace("[FECHA_RETIRO]", sFecha);
                CorreoString = CorreoString.Replace("[HORA_RETIRO]", sHora);
                CorreoString = CorreoString.Replace("[PATENTE_CAMION_RETIRO]", camion.Datos.Rows[0]["NombreTagPatente"].ToString());
                CorreoString = CorreoString.Replace("[CHOFER_CAMION_RETIRO]", sNombreChoferes);
                CorreoString = CorreoString.Replace("[NUMERO_FONO_PARA_LLAMAR_CIUDADANO]",
                                                    ConfigurationManager.AppSettings["NUMERO_FONO_PARA_LLAMAR_CIUDADANO"].ToString());

                string CorreoDestino = sCorreos;
                UtilWeb.SendMail(CorreoString, CorreoDestino, "ASIGNACIÓN DE RETIRO", false);
            }

            Lista.Add("Exito");
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #17
0
    public static string WGrabarOt(string sIdSolicitud, string sNumero, string sFecha, string sIdCamion, string sNombreChoferes, string sCorreos,
                                   string sHora, string sValorRetiro)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            double IdNew = 0;
            usr.ReadMunic();
            string sIdClienteMunicipio = UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos);

            double IdOT      = 0;
            double IdSoltemp = 0;
            Ot     ot        = new Ot(usr);
            if (double.TryParse(sIdSolicitud, out IdSoltemp))
            {
                IdOT = ot.ReadByIdSolicitud(sIdSolicitud);
            }

            if (IdOT == 0)
            {
                IdNew = ot.Create(sNumero, sFecha, sIdClienteMunicipio, "", sIdCamion, sNombreChoferes, sCorreos, sHora, sValorRetiro, sIdSolicitud);
            }
            else
            {
                ot.Update(IdOT.ToString(), sNumero, sFecha, sIdClienteMunicipio, "", sIdCamion, sNombreChoferes, sCorreos, sHora, sValorRetiro, sIdSolicitud);
            }

            //WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html);

            Lista.Add("Exito");
            Lista.Add(string.Format("OT: {0}", IdNew.ToString()));
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #18
0
    public static string WLeerParaEditarMunicipio(string Id)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            ClienteMunicipio cliente = new ClienteMunicipio(usr);
            cliente.Read(Id);

            Lista.Add("Exito");
            Lista.Add(cliente.Datos.Rows[0]["NombreMunic"].ToString());
            Lista.Add(cliente.Datos.Rows[0]["RutMunic"].ToString());
            Lista.Add(cliente.Datos.Rows[0]["NombreUserMunic"].ToString());
            Lista.Add(cliente.Datos.Rows[0]["RutUserMunic"].ToString());
            Lista.Add(cliente.Datos.Rows[0]["CorreoUserMunic"].ToString());
            Lista.Add(cliente.Datos.Rows[0]["Telefono"].ToString());

            if (File.Exists(HttpContext.Current.Server.MapPath("images") + string.Format(@"\MunLog_{0}.jpg", Id)))
            {
                Lista.Add(string.Format("/images/MunLog_{0}.jpg", Id));
            }
            else
            {
                Lista.Add("/images/demo/image-placeholder.png");
            }

            Lista.Add(cliente.Datos.Rows[0]["Clave"].ToString());
            Lista.Add(cliente.Datos.Rows[0]["Clave"].ToString());
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #19
0
    public static string WLeerDatosDeOT(string sIdOt)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();

            Ot ot = new Ot(usr);
            if (ot.Read(sIdOt))
            {
                Lista.Add("Exito");
                Lista.Add(string.Format("Municipalidad: {0}", UtilWeb.GetDatoSingular("NombreMunic", usr.oClienteMunicipio.Datos)));
                Lista.Add(string.Format("OT: {0}", UtilWeb.GetDatoSingular("Numero", ot.Datos)));
                Lista.Add(UtilWeb.GetDatoSingular("IdRuta", ot.Datos));
                Lista.Add(UtilWeb.GetDatoSingular("IdCamion", ot.Datos));
                Lista.Add(UtilWeb.GetDatoSingular("NombreChoferes", ot.Datos));
                Lista.Add(UtilWeb.GetDatoSingular("Correos", ot.Datos));
                Lista.Add(UtilWeb.GetDatoSingular("Hora", ot.Datos));
                Lista.Add(UtilWeb.GetDatoSingular("Fecha", ot.Datos));
            }
            else
            {
                Lista.Add("NoExiste");
            }
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #20
0
    public static string WGrabarRutas(string sId, string sNombreRuta, string sIdClienteMunicipio, string sIdGeocerca)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            Ruta Rutas = new Ruta(usr);
            // if (sId.Trim().Length == 0 && !(sId == "object HTMLSpanElement"))
            if (sId.Trim().Length == 0 || (sId == "[object HTMLSpanElement]"))
            {
                Rutas.Create(sNombreRuta, sIdClienteMunicipio, sIdGeocerca);
            }
            else
            {
                Rutas.Update(sId, sNombreRuta, sIdClienteMunicipio, sIdGeocerca);
            }

            string html = "";
            //WLeerRutas_Internal(usr, ref html, sIdClienteMunicipio);
            WLeerRutas_Geocerca_Internal(usr, ref html, sIdClienteMunicipio);


            Lista.Add("Exito");
            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #21
0
    public static string WLeerDatosIniciales()
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();

            Ruta rutas = new Ruta(usr);
            rutas.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(rutas.Datos);
            UtilWeb util      = new UtilWeb();
            string  jsonRutas = util.GetJson(rutas.Datos);

            VehRecolector camiones = new VehRecolector(usr);
            camiones.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(camiones.Datos);
            string jsonCamiones = util.GetJson(camiones.Datos);

            Lista.Add("Exito");
            Lista.Add(string.Format("Municipalidad: {0}", UtilWeb.GetDatoSingular("NombreMunic", usr.oClienteMunicipio.Datos)));
            Lista.Add(jsonRutas);
            Lista.Add(jsonCamiones);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WGrabarGeocerca(string sId, string sNombreGeocerca, string sUbicacion, string sCoordenadas,
                                         string sObservacion, string sIdClienteMunicipio)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            Geocercas geo = new Geocercas(usr);
            if (sId.Trim().Length == 0)
            {
                geo.Create(sNombreGeocerca, sUbicacion, sCoordenadas, sObservacion, sIdClienteMunicipio);
            }
            else
            {
                geo.Update(sId, sNombreGeocerca, sUbicacion, sCoordenadas, sObservacion, sIdClienteMunicipio);
            }

            string html = "";
            WLeerGeocerca_Internal(usr, ref html, sIdClienteMunicipio);

            Lista.Add("Exito");
            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #23
0
    private static void WLeerUsuarioConectadoAndMunicipios_Internal(Usuario usr, ref string html)
    {
        ClienteMunicipio cliente = new ClienteMunicipio(usr);

        cliente.ReadAll();

        //Se genera la tabla HTML
        List <ColumnaHtml> lista = new List <ColumnaHtml>();

        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "RutMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreUserMunic"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "RutUserMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "CorreoUserMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Telefono"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Telefono"));  //Aca va IMAGEN
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditMunicipio"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteMunicipio"));

        UtilWeb util = new UtilWeb();

        html = util.GetHtmlTableBasica(cliente.Datos, lista);
    }
Example #24
0
    private static void WLeerRutas_Geocerca_Internal(Usuario usr, ref string html, string IdMunicipio)
    {
        Ruta rutas = new Ruta(usr);

        rutas.ReadAllRutasyGeocercas_ByIdMunicipio(IdMunicipio);

        //Se genera la tabla HTML
        List <ColumnaHtml> lista = new List <ColumnaHtml>();

        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreMunic"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreRuta"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "NombreGeocerca"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "RutUserMunic"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Coordenadas"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Observacion"));
        //lista.Add(new ColumnaHtml(eeTipoColumnaHtml.Label, "", "Telefono"));  //Aca va IMAGEN
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageEdit, "Id", "", "Edit", "EditRutas"));
        lista.Add(new ColumnaHtml(eeTipoColumnaHtml.ImageDelete, "Id", "", "Delete", "DeleteRutas"));

        UtilWeb util = new UtilWeb();

        html = util.GetHtmlTableBasica(rutas.Datos, lista);
    }
Example #25
0
    public static string WGrabarSolicitud(string sNombre, string sRut, string sDireccion, string sCorreo, string sTelefono,
                                          string sTipo_residuo, string sComentarios, string sIdMunic)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();

        //Usuario usr = new Usuario();
        //if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        //    return scriptSerializer.Serialize(Lista.ToArray());

        try
        {
            double    IdNew     = 0;
            Solicitud solicitud = new Solicitud();
            IdNew = solicitud.Create(sNombre, sRut, sDireccion, sCorreo, sTelefono, sTipo_residuo, sComentarios, sIdMunic);

            //WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html);

            string CorreoString = File.ReadAllText(HttpContext.Current.Server.MapPath("~/templates") + "/correorecepcionsolicitud.txt");
            CorreoString = CorreoString.Replace("[FECHA_RETIRO]", UtilWeb.GetDateNow().ToShortDateString());
            CorreoString = CorreoString.Replace("[NUMERO_FONO_PARA_LLAMAR_CIUDADANO]",
                                                ConfigurationManager.AppSettings["NUMERO_FONO_PARA_LLAMAR_CIUDADANO"].ToString());

            string CorreoDestino = sCorreo;
            UtilWeb.SendMail(CorreoString, CorreoDestino, "AViSO DE RECEPCIÓN DE SOLICITUD", false);

            Lista.Add("Exito");
            Lista.Add(string.Format("La Solicitud fue grabada con éxito. Folio de Solicitud: {0}", IdNew.ToString()));
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WLeerUsuarioConectado()
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            ClienteMunicipio mun = new ClienteMunicipio(usr);
            mun.ReadAll();
            UtilWeb.AddElementSeleccioneALista(mun.Datos);
            UtilWeb util    = new UtilWeb();
            string  jsonMun = util.GetJson(mun.Datos);


            string html = "";
            WLeerCamionesMunicipios_Internal(usr, ref html, "");

            Lista.Add("Exito");
            Lista.Add(jsonMun);
            //Lista.Add(usr.NombreLargo);
            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WLeerDatos(string sIdCamion, string sFechaDesde, string sFechaHasta, string sIdRuta, string sIdOT)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();

            Ruta rutas = new Ruta(usr);
            rutas.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(rutas.Datos);
            UtilWeb util      = new UtilWeb();
            string  jsonRutas = util.GetJson(rutas.Datos);

            VehRecolector camiones = new VehRecolector(usr);
            camiones.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(camiones.Datos);
            string jsonCamiones = util.GetJson(camiones.Datos);

            Lista.Add("Exito");
            Lista.Add(jsonRutas);
            Lista.Add(jsonCamiones);

            Ot ot = new Ot(usr);
            ot.Read(sIdOT);
            sIdCamion = ot.Datos.Rows[0]["IdCamion"].ToString();
            VehRecolector veh = new VehRecolector(usr);
            veh.Read(sIdCamion);

            DateTime dtIni;
            if (!DateTime.TryParse(ot.Datos.Rows[0]["Fecha"].ToString(), out dtIni))
            {
                Lista.Clear();
                Lista.Add("Error");
                Lista.Add("Fecha OT no válida");
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }
            if (ot.Datos.Rows[0]["Hora"].ToString().Length < 5)
            {
                Lista.Clear();
                Lista.Add("Error");
                Lista.Add("Hora OT no válida");
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }

            int Hora = 0; int Minuto = 0; int Segundo = 0;
            if (ot.Datos.Rows[0]["Hora"].ToString().Length == 5)
            {
                if (!int.TryParse(ot.Datos.Rows[0]["Hora"].ToString().Substring(0, 2), out Hora))
                {
                    Lista.Clear();
                    Lista.Add("Error");
                    Lista.Add("Hora de OT no válida");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
                if (!int.TryParse(ot.Datos.Rows[0]["Hora"].ToString().Substring(3, 2), out Minuto))
                {
                    Lista.Clear();
                    Lista.Add("Error");
                    Lista.Add("Hora de OT no válida");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
            }

            if (ot.Datos.Rows[0]["Hora"].ToString().Length == 8)
            {
                if (!int.TryParse(ot.Datos.Rows[0]["Hora"].ToString().Substring(0, 2), out Hora))
                {
                    Lista.Clear();
                    Lista.Add("Error");
                    Lista.Add("Hora de OT no válida");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
                if (!int.TryParse(ot.Datos.Rows[0]["Hora"].ToString().Substring(3, 2), out Minuto))
                {
                    Lista.Clear();
                    Lista.Add("Error");
                    Lista.Add("Hora de OT no válida");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
                if (!int.TryParse(ot.Datos.Rows[0]["Hora"].ToString().Substring(6, 2), out Segundo))
                {
                    Lista.Clear();
                    Lista.Add("Error");
                    Lista.Add("Hora de OT no válida");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
            }

            dtIni = dtIni.Add(new TimeSpan(Hora, Minuto, Segundo));
            // ot.Datos.Rows[0]["Hora"].ToString()

            //Final del dia
            DateTime dtFin;
            if (!DateTime.TryParse(ot.Datos.Rows[0]["Fecha"].ToString(), out dtFin))
            {
                Lista.Clear();
                Lista.Add("Error");
                Lista.Add("Fecha Hasta no válida");
                return(scriptSerializer.Serialize(Lista.ToArray()));
            }
            dtFin = dtFin.Add(new TimeSpan(23, 59, 0));

            //Se lee info del Camion desde la data de Fleetup
            //Geocerca, Fecha, Hora Partida o Paso, Ruta, Camion, Chofer,
            //fence-names
            ///fencealerts/geo-fencealerts

            //Se lee la Ruta
            string nomRutaAux = "";
            sIdRuta = ot.Datos.Rows[0]["IdRuta"].ToString();
            rutas.ReadById(sIdRuta);
            nomRutaAux = rutas.Datos.Rows[0]["NombreRuta"].ToString();

            string nomCamionAux = "";
            camiones.Read(sIdCamion);
            nomCamionAux = camiones.Datos.Rows[0]["NombreCamion"].ToString() + "-" + camiones.Datos.Rows[0]["NombreTagPatente"].ToString();

            string htmlTemp = File.ReadAllText(HttpContext.Current.Server.MapPath("~/templates") + "/template_paso_a_paso_otv2.html");
            string html     = "";

            double TimeIni = UtilWeb.DateTimeToUnixTimestamp(dtIni);
            double TimeFin = UtilWeb.DateTimeToUnixTimestamp(dtFin);

            string devId = UtilWeb.GetDatoSingular("NombreTagPatente", veh.Datos);  //"213NW2019000039"

            Wialon wialon = new Wialon();

            string urlMapa = "";
            if (wialon.GetExecuteReport(TimeIni, TimeFin, devId, HttpContext.Current.Server.MapPath("~/images"), ref urlMapa))
            {
                if (wialon.Datos != null)
                {
                    double RegsPorPage = 10;
                    for (int i = 0; i < wialon.Datos.Rows.Count; i++)
                    {
                        ////////JToken Jtoken = arrayAlertas[i];
                        //////string NombreGeoCercaAux = dataFleet.Datos.Rows[i]["fenceNameFleetup"].ToString();
                        //////string acconTimeAux = dataFleet.Datos.Rows[i]["acconTimeFleetup"].ToString();
                        ////////DateTime acconTimeAuxDateTime = new DateTime(acconTimeAux.Substring(0, 4), acconTimeAux.Substring(0, 4))
                        //////string tmTimeAux = dataFleet.Datos.Rows[i]["tmTimeFleetup"].ToString();

                        html += htmlTemp;
                        html  = html.Replace("[NUM_INDEX_REG]", (i + 1).ToString());
                        html  = html.Replace("[NOMBRE_GEOCERCA]", wialon.Datos.Rows[i]["zone_name"].ToString());
                        html  = html.Replace("[DIA_ALERTA_PASO_POR_GEOCERCA]", wialon.Datos.Rows[i]["time_begin"].ToString());
                        html  = html.Replace("[HORA_ALERTA_PASO_POR_GEOCERCA]", wialon.Datos.Rows[i]["time_end"].ToString());
                        html  = html.Replace("[NOMBRE_RUTA]", nomRutaAux);
                        html  = html.Replace("[NOMBRE_CHOFER]", ot.Datos.Rows[0]["NombreChoferes"].ToString());
                        html  = html.Replace("[NOMBRE_CAMION] - [PATENTE_CAMION]", nomCamionAux);
                        html  = html.Replace("[URL_MAPA]", urlMapa);

                        //if (i > RegsPorPage)
                        //{
                        //    break;
                        //}
                    }
                }
                Lista.Add(html);
                Lista.Add(urlMapa);
            }


            //FleetUpRecordVehPasoGeoCerca dataFleet = new FleetUpRecordVehPasoGeoCerca(usr);
            //dataFleet.ReadAll(sIdCamion, dtIni, dtFin.AddDays(1));



            ////Fleetup fleet = new Fleetup(usr);
            ////string strGeo = fleet.LeerGeoCercas();  //Se leen definicion de GeoCercas
            ////string devId = UtilWeb.GetDatoSingular("Fleetup_devId", veh.Datos);  //"213NW2019000039"
            ////string strGeoAlertasJSON = fleet.LeerAlertasGeoCercas(devId, new DateTime(2020, 6, 16));
            ////JObject rootObject = JObject.Parse(strGeoAlertasJSON);
            ////JArray arrayAlertas = (JArray)rootObject["data"];

            //Ot ot = new Ot(usr);
            //ot.Read(sIdOT);

            //double RegsPorPage = 30;
            //for (int i = 0; i < dataFleet.Datos.Rows.Count; i++)
            //{
            //    //JToken Jtoken = arrayAlertas[i];
            //    string NombreGeoCercaAux = dataFleet.Datos.Rows[i]["fenceNameFleetup"].ToString();
            //    string acconTimeAux = dataFleet.Datos.Rows[i]["acconTimeFleetup"].ToString();
            //    //DateTime acconTimeAuxDateTime = new DateTime(acconTimeAux.Substring(0, 4), acconTimeAux.Substring(0, 4))
            //    string tmTimeAux = dataFleet.Datos.Rows[i]["tmTimeFleetup"].ToString();

            //    html += htmlTemp;
            //    html = html.Replace("[NUM_INDEX_REG]", (i + 1).ToString());
            //    html = html.Replace("[NOMBRE_GEOCERCA]", NombreGeoCercaAux);
            //    html = html.Replace("[DIA_ALERTA_PASO_POR_GEOCERCA]", acconTimeAux);
            //    html = html.Replace("[HORA_ALERTA_PASO_POR_GEOCERCA]", tmTimeAux);
            //    html = html.Replace("[NOMBRE_RUTA]", nomRutaAux);
            //    html = html.Replace("[NOMBRE_CHOFER]", ot.Datos.Rows[0]["NombreChoferes"].ToString());
            //    html = html.Replace("[NOMBRE_CAMION] - [PATENTE_CAMION]", nomCamionAux);
            //    if (i > RegsPorPage)
            //    {
            //        break;
            //    }
            //}

            //Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
    public static string WLeerDatosInicialesOLD_MFP(string sIdCamion, string sFechaDesde, string sIdRuta, string sIdOT)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();

            Ruta rutas = new Ruta(usr);
            rutas.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(rutas.Datos);
            UtilWeb util      = new UtilWeb();
            string  jsonRutas = util.GetJson(rutas.Datos);

            VehRecolector camiones = new VehRecolector(usr);
            camiones.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(camiones.Datos);
            string jsonCamiones = util.GetJson(camiones.Datos);

            Lista.Add("Exito");
            Lista.Add(jsonRutas);
            Lista.Add(jsonCamiones);

            VehRecolector veh = new VehRecolector(usr);
            veh.Read(sIdCamion);

            //Se lee info del Camion desde Fleetup
            //Geocerca, Fecha, Hora Partida o Paso, Ruta, Camion, Chofer,
            //fence-names
            ///fencealerts/geo-fencealerts

            string  htmlTemp = File.ReadAllText(HttpContext.Current.Server.MapPath("~/templates") + "/template_paso_a_paso_ot.html");
            string  html     = "";
            Fleetup fleet    = new Fleetup(usr);

            string strGeo = fleet.LeerGeoCercas();                                           //Se leen definicion de GeoCercas

            string  devId             = UtilWeb.GetDatoSingular("Fleetup_devId", veh.Datos); //"213NW2019000039"
            string  strGeoAlertasJSON = fleet.LeerAlertasGeoCercas(devId, new DateTime(2020, 6, 16));
            JObject rootObject        = JObject.Parse(strGeoAlertasJSON);
            JArray  arrayAlertas      = (JArray)rootObject["data"];

            string nomRutaAux = "";
            rutas.Read(sIdRuta);
            nomRutaAux = rutas.Datos.Rows[0]["NombreRuta"].ToString();

            string nomCamionAux = "";
            camiones.Read(sIdCamion);
            nomCamionAux = camiones.Datos.Rows[0]["NombreCamion"].ToString() + "-" + camiones.Datos.Rows[0]["NombreTagPatente"].ToString();

            Ot ot = new Ot(usr);
            ot.Read(sIdOT);

            for (int i = 0; i < arrayAlertas.Count; i++)
            {
                JToken Jtoken            = arrayAlertas[i];
                string NombreGeoCercaAux = Jtoken["fenceName"].ToString();
                string acconTimeAux      = Jtoken["acconTime"].ToString();
                //DateTime acconTimeAuxDateTime = new DateTime(acconTimeAux.Substring(0, 4), acconTimeAux.Substring(0, 4))
                string tmTimeAux = Jtoken["tmTime"].ToString();

                html += htmlTemp;
                html  = html.Replace("[NUM_INDEX_REG]", (i + 1).ToString());
                html  = html.Replace("[NOMBRE_GEOCERCA]", NombreGeoCercaAux);
                html  = html.Replace("[DIA_ALERTA_PASO_POR_GEOCERCA]", acconTimeAux);
                html  = html.Replace("[HORA_ALERTA_PASO_POR_GEOCERCA]", tmTimeAux);
                html  = html.Replace("[NOMBRE_RUTA]", nomRutaAux);
                html  = html.Replace("[NOMBRE_CHOFER]", ot.Datos.Rows[0]["NombreChoferes"].ToString());
                html  = html.Replace("[NOMBRE_CAMION] - [PATENTE_CAMION]", nomCamionAux);
            }

            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #29
0
    public static string WLeerDatosIniciales(string sIdSolicitud)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            usr.ReadMunic();

            //Ruta rutas = new Ruta(usr);
            //rutas.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            //UtilWeb.AddElementSeleccioneALista(rutas.Datos);
            UtilWeb util = new UtilWeb();
            //string jsonRutas = util.GetJson(rutas.Datos);

            VehRecolector camiones = new VehRecolector(usr);
            camiones.ReadAll(double.Parse(UtilWeb.GetDatoSingular("Id", usr.oClienteMunicipio.Datos)));
            UtilWeb.AddElementSeleccioneALista(camiones.Datos);
            string jsonCamiones = util.GetJson(camiones.Datos);

            Solicitud solicitud = new Solicitud(usr);
            if (solicitud.Read(sIdSolicitud))
            {
                Lista.Add("Exito");
                if (solicitud.Datos.Rows[0]["NumeroOT"].ToString().Length > 0)
                {
                    Lista.Add(string.Format("OT: {0}", solicitud.Datos.Rows[0]["NumeroOT"].ToString()));
                }
                else
                {
                    Lista.Add("OT: POR ASIGNAR");
                }

                Lista.Add(jsonCamiones);
                Lista.Add(solicitud.Datos.Rows[0]["IdCamion"].ToString());
                Lista.Add(solicitud.Datos.Rows[0]["NombreChoferes"].ToString());
                Lista.Add(solicitud.Datos.Rows[0]["CorreosOT"].ToString());
                Lista.Add(solicitud.Datos.Rows[0]["FechaOT"].ToString());
                Lista.Add(solicitud.Datos.Rows[0]["HoraOT"].ToString());

                Lista.Add(solicitud.Datos.Rows[0]["Nombre"].ToString());
                Lista.Add(solicitud.Datos.Rows[0]["Direccion"].ToString());
                Lista.Add(solicitud.Datos.Rows[0]["TipoResiduo"].ToString());
                Lista.Add("");
                Lista.Add(solicitud.Datos.Rows[0]["ValorRetiroOT"].ToString());
            }

            //Lista.Add(jsonRutas);
            //Lista.Add(jsonCamiones);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }
Example #30
0
    public static string WGrabarMunicipio(string sId, string sNombreMunic, string sRutMunic, string sNombreUserMunic, string sRutUserMunic, string sCorreoUserMunic,
                                          string sClave, string sClave2, string sTelefono, string sLogo)
    {
        JavaScriptSerializer scriptSerializer = new JavaScriptSerializer();
        List <string>        Lista            = new List <string>();
        Usuario usr = new Usuario();

        if (!UtilWeb.CheckSession(Lista, ref usr, HttpContext.Current))
        {
            return(scriptSerializer.Serialize(Lista.ToArray()));
        }

        try
        {
            if (sId.Trim().Length != 0)
            {
                if (sClave != sClave2)
                {
                    Lista.Add("CSD");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }

                if (sCorreoUserMunic == "")
                {
                    Lista.Add("CORREO_NO");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
                bool res = UtilWeb.IsValidMail(sCorreoUserMunic);
                if (!res)
                {
                    Lista.Add("CORREO_NO");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }


                if (sRutMunic == "")
                {
                    Lista.Add("RUT_NO");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
                if (!UtilWeb.IsValidRut(sRutMunic))
                {
                    Lista.Add("RUT_NO");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }

                if (sRutUserMunic == "")
                {
                    Lista.Add("RUT_USER_NO");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
                if (!UtilWeb.IsValidRut(sRutUserMunic))
                {
                    Lista.Add("RUT_USER_NO");
                    return(scriptSerializer.Serialize(Lista.ToArray()));
                }
            }

            ClienteMunicipio cliente = new ClienteMunicipio(usr);
            if (sId.Trim().Length == 0)
            {
                //cliente.Create(sNombreMunic, sRutMunic, sNombreUserMunic, sRutUserMunic, sCorreoUserMunic, sClave, sTelefono);
                sId = cliente.Create(sNombreMunic, sRutMunic, sNombreUserMunic, sRutUserMunic, sCorreoUserMunic, sClave, sTelefono).ToString();
            }
            else
            {
                cliente.Update(sId, sNombreMunic, sRutMunic, sNombreUserMunic, sRutUserMunic, sCorreoUserMunic, sClave, sTelefono);
            }


            if (sLogo.Trim().Length != 0 && !sLogo.Contains("image-placeholder.png"))
            {
                //data:image/png;base64,djsjsadkjadjkhadfkadkfakhdfkjhadkjh
                sLogo = sLogo.Substring(sLogo.IndexOf("base64,") + "base64,".Length);
                byte[] bytes = Convert.FromBase64String(sLogo);
                File.WriteAllBytes(string.Format(HttpContext.Current.Server.MapPath("~/images") + "\\MunLog_{0}.jpg", sId), bytes);
            }


            string html = "";
            WLeerUsuarioConectadoAndMunicipios_Internal(usr, ref html);

            Lista.Add("Exito");
            Lista.Add(html);
        }
        catch (Exception ex)
        {
            Lista.Add("Exception");
            Lista.Add(ex.Message);
            Lista.Add("Hubo un error no controlado en la aplicación, por favor inténtelo nuevamente, si el problema persiste contactarse con el administrador sistemas para revisar el log de eventos del servidor.");
        }
        return(scriptSerializer.Serialize(Lista.ToArray()));
    }