/// <summary> /// Returns true if Order instances are equal /// </summary> /// <param name="other">Instance of Order to be compared</param> /// <returns>Boolean</returns> public bool Equals(Order other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return((Side == other.Side || Side != null && Side.Equals(other.Side)) && (Sv == other.Sv || Sv != null && Sv.Equals(other.Sv)) && (Pt == other.Pt || Pt != null && Pt.Equals(other.Pt)) && (Ot == other.Ot || Ot != null && Ot.Equals(other.Ot)) && (P == other.P || P != null && P.Equals(other.P)) && (Sc == other.Sc || Sc != null && Sc.Equals(other.Sc)) && (Rc == other.Rc || Rc != null && Rc.Equals(other.Rc)) && (S == other.S || S != null && S.Equals(other.S)) && (Pd == other.Pd || Pd != null && Pd.Equals(other.Pd)) && (Rac == other.Rac || Rac != null && Rac.Equals(other.Rac)) && (Md == other.Md || Md != null && Md.Equals(other.Md)) && (Sl == other.Sl || Sl != null && Sl.Equals(other.Sl)) && (Avp == other.Avp || Avp != null && Avp.Equals(other.Avp)) && (Sm == other.Sm || Sm != null && Sm.Equals(other.Sm)) && (Id == other.Id || Id != null && Id.Equals(other.Id)) && (Bsp == other.Bsp || Bsp != null && Bsp.Equals(other.Bsp)) && (Status == other.Status || Status != null && Status.Equals(other.Status)) && (Sr == other.Sr || Sr != null && Sr.Equals(other.Sr)) && (Cd == other.Cd || Cd != null && Cd.Equals(other.Cd))); }
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())); }
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())); }
public Operand(string token) { //TODO: properly handle optional elements {K}{Z} {AES}{ER} string token2 = token. Replace("{K0}", ""). Replace("{K1}", ""). Replace("{K2}", ""). Replace("{K3}", ""). Replace("{K4}", ""). Replace("{K5}", ""). Replace("{K6}", ""). Replace("{K7}", ""). Replace("{Z}", ""). Replace("{ER}", ""). Replace("{SAE}", ""). Replace("{1TO4}", ""). Replace("{1TO8}", ""). Replace("{1TO16}", ""); this._str = token; Tuple <bool, Rn, int> t0 = RegisterTools.toRn(token2); if (t0.Item1) { this._type = Ot.reg; this._rn = t0.Item2; this._nBits = t0.Item3; } else { Tuple <bool, ulong, int> t1 = AsmSourceTools.toConstant(token2); if (t1.Item1) { this._type = Ot.imm; this._imm = t1.Item2; this._nBits = t1.Item3; } else { Tuple <bool, Rn, Rn, int, long, int> t2 = AsmSourceTools.parseMemOperand(token2); if (t2.Item1) { this._type = Ot.mem; this._mem = new Tuple <Rn, Rn, int, long>(t2.Item2, t2.Item3, t2.Item4, t2.Item5); this._nBits = t2.Item6; } else { this._type = Ot.UNKNOWN; this._nBits = -1; } } } }
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())); }
private void Rashbutton_Click(object sender, EventArgs e) { Ot.Clear(); for (double i = (double)A.Value, n = 0; i <= (double)B.Value; i += (double)H.Value, n++) { Ot.Text += ("f( " + Math.Round(i, 2) + " )= " + Math.Round(f(i), 4) + "; "); if (n % 5 == 0 & n > 0) { Ot.Text += "\n"; } } }
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())); }
public static string ToString(Ot ot) { StringBuilder sb = new StringBuilder(); foreach (Ot value in Enum.GetValues(ot.GetType())) { if (ot.HasFlag(value)) { sb.Append(value.ToString() + ", "); } } if (sb.Length > 2) { sb.Length -= 2; } return(sb.ToString()); }
public void sampleData() { User user = new User(1, "Alex", "1144", 124); database.InsertOrReplaceAsync(user); Plans p = new Plans(1, "neuchatel getaz", 138, 124, new DateTime(2017, 11, 14), 2315.89306640625, 12.054499626, "MANU", "TAXI MEUBLES"); Plans p1 = new Plans(3143130, "Lausanne 10h", 138, 124, new DateTime(2017, 11, 12), 2315.89306640625, 12.054499626, "MANU", "TAXI MEUBLES"); database.InsertOrReplaceAsync(p); database.InsertOrReplaceAsync(p1); Periodes pe = new Periodes(); pe.periodeid = new DateTime(); pe.periodeplanid = 3143130; pe.periodeotid = 0; database.InsertOrReplaceAsync(pe); Ot o = new Ot(); o.otid = 3143130; o.otnobl = "002-TR3678422"; o.otpOids = 77.276; o.otpVolume = 0.151; o.otmontrembours = 0; o.otmontobligatoire = 0; o.otmontmontage = 0; o.otnoteinterne = "Info. : appeler le 079532 12 54 M. Farinha[Sep]camion : [Sep]étage : rez[Sep]"; o.otdatelivraison = new DateTime(); o.otdatemontage = new DateTime(); o.otetat = 32; o.otperiodesnecessaires = 2; o.otperiodesnonattributess = 0; o.otlieuchargement = "* TRIAL * TRIAL"; o.otdestinnom = "Duperrex Frères SA"; o.otaddress1 = "Route d'Apples 6, 1144 Ballens, Suisse"; o.ottel1 = "079 622 26 19"; o.otdestnp = "1144"; o.otdestville = "Ballens"; o._currency = "CHF"; o.otdatelivdemande = new DateTime(); o.tohour = new DateTime(); database.InsertOrReplaceAsync(o); }
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())); }
private async void getOtDetail() { try { List <Ot> ots = await App.Database.GetOTById(otid); Ot o = ots[0]; var name = ""; if (o.otdestinnom != null) { name += o.otdestinnom; } if (o.otdestprenom != null) { name += " " + o.otdestprenom; } clientName.Text = name; clientNumbers.Text = o.otnobl; clientNote.Text = o.otnoteinterne; }catch (Exception e) { } }
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())); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { // credit: http://stackoverflow.com/a/263416/677735 unchecked // Overflow is fine, just wrap { var hash = 41; // Suitable nullity checks etc, of course :) if (Side != null) { hash = hash * 59 + Side.GetHashCode(); } if (Sv != null) { hash = hash * 59 + Sv.GetHashCode(); } if (Pt != null) { hash = hash * 59 + Pt.GetHashCode(); } if (Ot != null) { hash = hash * 59 + Ot.GetHashCode(); } if (P != null) { hash = hash * 59 + P.GetHashCode(); } if (Sc != null) { hash = hash * 59 + Sc.GetHashCode(); } if (Rc != null) { hash = hash * 59 + Rc.GetHashCode(); } if (S != null) { hash = hash * 59 + S.GetHashCode(); } if (Pd != null) { hash = hash * 59 + Pd.GetHashCode(); } if (Rac != null) { hash = hash * 59 + Rac.GetHashCode(); } if (Md != null) { hash = hash * 59 + Md.GetHashCode(); } if (Sl != null) { hash = hash * 59 + Sl.GetHashCode(); } if (Avp != null) { hash = hash * 59 + Avp.GetHashCode(); } if (Sm != null) { hash = hash * 59 + Sm.GetHashCode(); } if (Id != null) { hash = hash * 59 + Id.GetHashCode(); } if (Bsp != null) { hash = hash * 59 + Bsp.GetHashCode(); } if (Status != null) { hash = hash * 59 + Status.GetHashCode(); } if (Sr != null) { hash = hash * 59 + Sr.GetHashCode(); } if (Cd != null) { hash = hash * 59 + Cd.GetHashCode(); } return(hash); } }
/// <summary> /// The sinhronize names. /// </summary> private void SinhronizeNames() { using ( var sessionSrz = ObjectFactory.GetInstance <IManagerSessionFactorys>().GetFactoryByName("NHibernateCfgAtl.xml").OpenSession()) { var sessionPvp = ObjectFactory.GetInstance <ISessionFactory>().GetCurrentSession(); var conceptManager = ObjectFactory.GetInstance <IConceptCacheManager>(); var srzImList = sessionSrz.QueryOver <Im>().List(); var srzOtList = sessionSrz.QueryOver <Ot>().List(); var pvpImOtList = sessionPvp.QueryOver <AutoComplete>().List(); var pvpImList = pvpImOtList.Where(x => x.Type.Id == srz.model.srz.concepts.AutoComplete.FirstName && x.Gender != null) .ToList(); var pvpOtList = pvpImOtList.Where(x => x.Type.Id == srz.model.srz.concepts.AutoComplete.MiddleName && x.Gender != null) .ToList(); // Перенос имен из СРЗ в ПВП var srz2PvpImList = srzImList.Where( x => !pvpImList.Any( y => x.Caption.ToLower() == y.Name.ToLower() && (x.W == y.Gender.Id - Sex.Sex1 + 1))) .ToList(); foreach (var im in srz2PvpImList) { var ac = new AutoComplete(); ac.Name = im.Caption.ToUpperFirstChar(); ac.Gender = conceptManager.GetBy(x => x.Code == im.W.ToString() && x.Oid.Id == Oid.Пол).FirstOrDefault() ?? conceptManager.GetById(Sex.Sex1); ac.Type = conceptManager.GetById(srz.model.srz.concepts.AutoComplete.FirstName); pvpImList.Add(ac); sessionPvp.Save(ac); } // Перенос отчеств из СРЗ в ПВП var srz2PvpOtList = srzOtList.Where( x => !pvpOtList.Any( y => x.Caption.ToLower() == y.Name.ToLower() && (x.W == y.Gender.Id - Sex.Sex1 + 1))) .ToList(); foreach (var ot in srz2PvpOtList) { var ac = new AutoComplete(); ac.Name = ot.Caption.ToUpperFirstChar(); ac.Gender = conceptManager.GetBy(x => x.Code == ot.W.ToString() && x.Oid.Id == Oid.Пол).FirstOrDefault() ?? conceptManager.GetById(Sex.Sex1); ac.Type = conceptManager.GetById(srz.model.srz.concepts.AutoComplete.MiddleName); pvpOtList.Add(ac); sessionPvp.Save(ac); } sessionPvp.Flush(); // Перенос имен из ПВП в СРЗ var pvp2SrzImList = pvpImList.Where( y => !srzImList.Any( x => x.Caption.ToLower() == y.Name.ToLower() && (x.W == y.Gender.Id - Sex.Sex1 + 1))) .ToList(); foreach (var im in pvp2SrzImList) { var ac = new Im(); ac.Caption = im.Name.ToUpperFirstChar(); int gender; if (im.Gender != null && int.TryParse(im.Gender.Code, out gender)) { ac.W = gender; } sessionSrz.Save(ac); } // Перенос отчеств из ПВП в СРЗ var pvp2SrzOtList = pvpOtList.Where( y => !srzOtList.Any( x => x.Caption.ToLower() == y.Name.ToLower() && (x.W == y.Gender.Id - Sex.Sex1 + 1))) .ToList(); foreach (var ot in pvp2SrzOtList) { var ac = new Ot(); ac.Caption = ot.Name.ToUpperFirstChar(); int gender; if (int.TryParse(ot.Gender.Code, out gender)) { ac.W = gender; } sessionSrz.Save(ac); } sessionSrz.Flush(); // закрываем сессию СРЗ sessionSrz.Close(); } }
public static Ot2 mergeOt(Ot ot1, Ot ot2, Ot ot3) { return((Ot2)(((byte)ot1) | (((byte)ot2) << 4) | (((byte)ot3) << 8))); }