public static void PuestaEnServicio(int id_conductor, List <int> carrosCheck, string autoriza) { z_conductores cond = new z_conductores().getObjectz_conductores(id_conductor); string enserv = ""; foreach (int i in carrosCheck) { z_carros carro = new z_carros().getObjectz_carros(i); int id_cond_anterior = carro.id_conductor; // modificar conductor Carro.EnServicioConductor(carro, id_conductor); enserv += "," + carro.nombre; // verificar temporal z_conductores anterior = new z_conductores().getObjectz_conductores(id_cond_anterior); if (anterior.temporal) { VerificarTemporal(anterior); } } // temporal?? string auth = ""; if (cond.temporal) { auth = ", Autorizado por: " + autoriza; } if (enserv != "") { BitacoraGestion.NuevoEvento(BitacoraLlamado.IdOperadora, 0, string.Format( "Puesta en servicio de carros. Fecha: {0}, Conductor: {1}, Carros: {2}" + auth, DateTime.Now, cond.codigo_conductor, enserv.Trim(','))); } }
//######################################## //### JSON Servicio Clave MULTIPLE ### //######################################## public void JsonServicioHoraMultipleJSON(string strIdCarros, int IdEstado, string strIdConductores, string strMotivo, string strColor, Boolean booManual) { string[] ArIdCarro = strIdCarros.ToString().Split(','); string[] ArIdConductor = strIdConductores.ToString().Split(','); //string[] ArNomCarro = strCarros.ToString().Split(','); string[] MultiInsert = new string[ArIdCarro.Length]; string[] GetHoraActual = System.DateTime.Now.ToString().Split(' '); //# Crear CadaObjeto JSON JsonServicio servicios = new JsonServicio(); string strVector = ""; string strVectorJSON = ""; for (int x = 0; x < ArIdCarro.Length; x++) { servicios.fecha = GetHoraActual[0].ToString(); servicios.hora = GetHoraActual[1].ToString(); servicios.carro = Convert.ToInt32(ArIdCarro[x].ToString()); servicios.estado = IdEstado; //### Nombre de Conductor string strNomConductor = new z_conductores().Getz_NombreConductor(Convert.ToInt32(ArIdConductor[x].ToString())); servicios.conductor = strNomConductor.Replace("Ñ", "N"); servicios.motivo = strMotivo.Replace("Ñ", "N"); servicios.color = strColor; servicios.manual = booManual; string jsonBit = JsonConvert.SerializeObject(servicios); strVector += jsonBit + ","; //# Agregar en Bitacora de Gestión BitacoraGestion.NuevoEvento(BitacoraLlamado.IdOperadora, 0, "Carro: " + servicios.carro.ToString() + " Estado: " + servicios.estado.ToString() + " Conductor: " + servicios.conductor.ToString()); } strVector += "#"; strVectorJSON = strVector.Replace(",#", ""); string strVectorJSON_2 = strVectorJSON.Replace("\"", "%"); string strVectorJSON_3 = strVectorJSON_2.Replace(" ", "?"); z_carros ccarros = new z_carros(); if (ccarros.GetParametroPrioridad(6).Equals("TRUE")) { System.Diagnostics.Process proceso2 = new System.Diagnostics.Process(); proceso2.StartInfo.FileName = @"C:\ZEUS_CBMS\Apolo\servicios.py"; proceso2.StartInfo.Arguments = strVectorJSON_3; proceso2.StartInfo.CreateNoWindow = true; proceso2.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; proceso2.Start(); } //### Escribir JSON MultiPuestaServicio string fic = @"C:\ZEUS_CBMS\ZTablasApolo\JsonMultiPuestaServicio.txt"; StreamWriter sw = new StreamWriter(fic); sw.WriteLine("JSON Bitacora ZEUS"); sw.WriteLine(""); sw.WriteLine(strVectorJSON_3); sw.Close(); }
public static void FueraServicio(int id_conductor, List <int> carrosUncheck) { // poner fuera de servicio z_conductores cond = new z_conductores().getObjectz_conductores(id_conductor); string noserv = ""; foreach (int i in carrosUncheck) { z_carros carro = new z_carros().getObjectz_carros(i); Carro.SinConductor(carro); noserv += "," + carro.nombre; } if (noserv != "") { BitacoraGestion.NuevoEvento(BitacoraLlamado.IdOperadora, 0, string.Format( "Fuera de servicio de carros. Fecha: {0}, Conductor: {1}, Carros: {2}", DateTime.Now, cond.codigo_conductor, noserv.Trim(','))); } if (cond.temporal) { VerificarTemporal(cond); } }