示例#1
0
        public static void PonerEnServicio(z_carros carro)
        {
            carro.estado = 1;
            carro.modifyz_carros(carro);
            var servicio = new z_servicio(carro.id_carro, DateTime.Now, carro.estado, carro.id_conductor, "");

            servicio.Insert(servicio);
        }
示例#2
0
        public static void FueraServicio(z_carros carro, string motivo)
        {
            carro.estado = 2;
            carro.fecha_fuera_servicio  = DateTime.Now;
            carro.motivo_fuera_servicio = motivo;
            carro.modifyz_carros(carro);
            var servicio = new z_servicio(carro.id_carro, DateTime.Now, carro.estado, carro.id_conductor, motivo);

            servicio.Insert(servicio);
        }
示例#3
0
        public static void ConductorNoDisponible(z_carros carro)
        {
            var servicio = new z_servicio(carro.id_carro, DateTime.Now, 3, carro.id_conductor, "Temporalmente Sin Conductor");

            servicio.Insert(servicio);
            carro.fecha_fuera_servicio  = DateTime.Now;
            carro.motivo_fuera_servicio = "Temporalmente Sin Conductor";
            carro.estado = 3;
            carro.modifyz_carros(carro);
        }
示例#4
0
        public static void PonerEnServicio_MM(z_carros carro)
        {
            carro.estado                = 1;
            carro.Observacion2          = "";
            carro.motivo_fuera_servicio = "";
            carro.modifyz_carros(carro);
            var servicio = new z_servicio(carro.id_carro, DateTime.Now, carro.estado, carro.id_conductor, "");

            servicio.Insert(servicio);
        }
示例#5
0
        public static void SinConductor(z_carros carro, string motivo)
        {
            z_servicio servicio = new z_servicio(carro.id_carro, DateTime.Now, 3, carro.id_conductor, motivo);

            servicio.Insert(servicio);
            carro.fecha_fuera_servicio  = DateTime.Now;
            carro.motivo_fuera_servicio = motivo;
            carro.Observacion2          = motivo;
            carro.estado       = 3;
            carro.id_conductor = 0;
            carro.modifyz_carros(carro);
        }
示例#6
0
        public static void FueraServicio(z_carros carro, string motivo)
        {
            var servicio = new z_servicio(carro.id_carro, DateTime.Now, 2, carro.id_conductor, motivo);

            servicio.Insert(servicio);
            carro.estado = 2;
            carro.fecha_fuera_servicio  = DateTime.Now;
            carro.motivo_fuera_servicio = motivo;
            carro.Observacion2          = motivo;
            carro.id_conductor          = 0;
            carro.modifyz_carros(carro);
            carro.ActualizarEstadosCarros(2, carro.id_carro);
        }
示例#7
0
        public static void SinConductor_MM(z_carros carro)
        {
            z_servicio servicio = new z_servicio(carro.id_carro, DateTime.Now, 3, carro.id_conductor, "Sin Conductor");

            servicio.Insert(servicio);
            carro.fecha_fuera_servicio = DateTime.Now;
            //carro.motivo_fuera_servicio = "Sin Conductor";
            carro.motivo_fuera_servicio = "";
            carro.Observacion2          = "";
            carro.estado       = 3;
            carro.id_conductor = 0;
            carro.modifyz_carros(carro);
        }
        private void btnDespachar_Click(object sender, EventArgs e)
        {
            //### Confirmar si hay Carros para Despachar
            if (IdCarros.Count > 0)
            {
                z_carros carros = new z_carros();
                exp = exp.getObjecte_expedientes(IdExpediente);

                DatosLogin.LogPrimerDespacho = false;

                //### Sólo Si es el Primer Despacho, Actualiza la Hora del Expediente.
                if (exp.material_despachado == "")
                {
                    exp.ActualizarFechaExpediente(IdExpediente);
                    DatosLogin.LogPrimerDespacho = true;
                }

                //### Asigna el Estado NOTEMPORAL a los Carros que se Despacharán.
                for (int a = 0; a < IdCarros.Count; a++)
                {
                    carros.actualizarZcarrosLlamadoEspecifico(IdCarros[a], IdExpediente);
                }


                if (confirmado)
                {
                    DialogResult = DialogResult.OK;
                    Close();
                    return;
                }

                try
                {
                    if (AlarmaGeneral)
                    {
                        Despacho.ConfirmarDespacho(IdCarros, IdExpediente, true);
                    }
                    else
                    {
                        if (Batallon != 0)
                        {
                            Despacho.ConfirmarDespacho(IdCarros, IdExpediente, Batallon);
                        }
                        else
                        {
                            Despacho.ConfirmarDespacho(IdCarros, IdExpediente);
                        }
                    }
                    confirmado          = true;
                    btnDespachar.Text   = "Cerrar";
                    btnAgregar.Enabled  = false;
                    btnCancelar.Enabled = false;
                }
                catch (Exception ex)
                {
                    Log.ShowAndLog(ex);
                }

                //### Asigna la Hora de 6-0 a los Carros Despachados
                for (int i = 0; i < IdCarros.Count; i++)
                {
                    BitacoraLlamado.NuevoEvento(exp.id_expediente, IdCarros[i],
                                                BitacoraLlamado.Carro,
                                                "6-0");
                }


                string StIdCarro     = "";
                string StIdConductor = "";

                string CDString      = "";
                string CDStringFinal = "";
                for (int x = 0; x < IdCarros.Count; x++)
                {
                    CDString += carros.ObtenerNombreCarro(IdCarros[x]) + ",";

                    carros         = carros.getObjectz_carros(IdCarros[x]);
                    StIdCarro     += carros.id_carro + ",";
                    StIdConductor += carros.id_conductor + ",";
                }
                CDString     += "#";
                CDStringFinal = CDString.Replace(",#", "");

                StIdCarro     += "#";
                StIdCarro      = StIdCarro.Replace(",#", "");
                StIdConductor += "#";
                StIdConductor  = StIdConductor.Replace(",#", "");



                int TipoTw = 2; //### Para Despachos debe ser Valor 2


                //############################################################
                //### Insertar Servicio por Carro Despachado JSON MULTIPLE ###
                //############################################################
                //                 public z_servicio(int id_carro, DateTime fecha, int estado, int id_conductor, string motivo_fuera_servicio)
                //z_servicio servicio = new z_servicio(99, System.DateTime.Now, 4, 99, "Despacho de carros: Se genera el despacho de los carros " + CDStringFinal + "");
                //servicio.Insert(servicio);
                //string strIdCarros, string strIdConductores, string strCarros

                //### Insert Multiple en Z_SERVICIOS
                z_servicio servicio = new z_servicio();
                servicio.InsertMultiple(StIdCarro, StIdConductor, CDString);

                //### JSON Multiple en servicio
                if (carros.GetParametroPrioridad(6) == "TRUE")
                {
                    JsonServicioClaves jsc = new JsonServicioClaves();
                    jsc.JsonServicioHoraMultipleJSON(StIdCarro, 4, StIdConductor, "En Acto", "Azul", false);

                    //### Actualiz Todos los Carros   :)
                    jsc.JsonServicioHoraMultipleJSON_TodosLosCarros();
                }



                //###########################
                //### Publicar en Twitter ###
                //###########################
                if (carros.GetParametroPrioridad(1) == "TRUE")
                {
                    if (CDStringFinal != "#")
                    {
                        System.Diagnostics.Process proceso = new System.Diagnostics.Process();
                        proceso.StartInfo.FileName       = @"C:\ZEUS_CBMS\New_App_Twitter\App_Twitter_Mod.exe";
                        proceso.StartInfo.Arguments      = TipoTw.ToString() + " " + IdExpediente.ToString() + " " + DatosLogin.InvokeTwitter.ToString() + " " + CDStringFinal;
                        proceso.StartInfo.CreateNoWindow = true;
                        proceso.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                        proceso.Start();
                    }
                }



                //#################
                //### App VIPER ###
                //#################
                var llam = new z_llamados();
                llam = llam.getObjectz_llamados(exp.codigo_llamado);


                //############################
                //### Producción CBMS ########
                //############################
                //# ID Usuario
                string text3 = "\"uEpZYQpJz2;"; //"\"6jD2ex00SN;";
                //# Password
                text3 += "M29vzK1BEg;";         //"a057ldMhGm;";



                //# Expediente
                text3 += exp.id_expediente.ToString() + ";";
                //# Fecha
                text3 += exp.fecha.ToString() + ";";

                ////# Clave con 0-4 para 10-12
                //if (llam.clave.ToString() == "10-12")
                //{
                //    text3 += llam.clave.ToString() + " A " + exp.cero4_10_12.ToString() + ";";
                //}
                //else
                //{
                text3 += llam.clave.ToString() + ";";
                //}

                //# Calle
                text3 += exp.seis2.ToString() + ";";
                //# Esquina
                text3 += exp.cero5.ToString() + ";";
                //# Carros
                text3 += CDStringFinal + ";";
                //# ID Area
                text3 += exp.id_area.ToString() + ";";
                //# Comuna
                text3 += exp.comuna.ToString() + ";";
                //# O-4
                text3 += exp.OrigenAlamarma.ToString() + ";";
                //# Latitud
                string[] array = exp.e_lat_long.ToString().Split(',');
                text3 += array[0].ToString() + ";";
                //# Longitud
                text3 += array[1].ToString() + ";";
                //# Incendio
                if (DatosLogin.InvokeTwitter == "FT1")
                {
                    text3 += "";
                }

                //if (DatosLogin.InvokeTwitter == "FT2")
                //{
                //    int intPrincipal = Convert.ToInt32(exp.codigo_principal.ToString());
                //    if (intPrincipal > 49)
                //    {
                //        text3 += "SALE A INCENDIO ";
                //    }
                //    else
                //    {
                //        text3 += "SALE";
                //    }
                //}

                ////### Incendios Estructural
                //if (DatosLogin.InvokeTwitter == "FT3")
                //{
                //    text3 += "INCENDIO";
                //}

                //if (DatosLogin.InvokeTwitter == "FT4")
                //{
                //    text3 += "2da ALARMA DE INCENDIO";
                //}

                //if (DatosLogin.InvokeTwitter == "FT5")
                //{
                //    text3 += "3ra ALARMA DE INCENDIO";
                //}

                //if (DatosLogin.InvokeTwitter == "FT6")
                //{
                //    text3 += "4ta ALARMA DE INCENDIO";
                //}

                //if (DatosLogin.InvokeTwitter == "FT7")
                //{
                //    text3 += "5ta ALARMA DE INCENDIO";
                //}

                //if (DatosLogin.InvokeTwitter == "FT8")
                //{
                //    text3 += "6ta ALARMA DE INCENDIO";
                //}

                //if (DatosLogin.InvokeTwitter == "FT9")
                //{
                //    text3 += "7ma ALARMA DE INCENDIO";
                //}

                ////### Incendios Forestal
                //if (DatosLogin.InvokeTwitter == "FT3F")
                //{
                //    text3 += "INCENDIO FORESTAL";
                //}

                //if (DatosLogin.InvokeTwitter == "FT4F")
                //{
                //    text3 += "2da ALARMA FORESTAL";
                //}

                //if (DatosLogin.InvokeTwitter == "FT5F")
                //{
                //    text3 += "3ra ALARMA FORESTAL";
                //}

                //if (DatosLogin.InvokeTwitter == "FT6F")
                //{
                //    text3 += "4ta ALARMA FORESTAL";
                //}

                //if (DatosLogin.InvokeTwitter == "FT7F")
                //{
                //    text3 += "5ta ALARMA FORESTAL";
                //}

                //if (DatosLogin.InvokeTwitter == "FT8F")
                //{
                //    text3 += "6ta ALARMA FORESTAL";
                //}

                //if (DatosLogin.InvokeTwitter == "FT9F")
                //{
                //    text3 += "7ma ALARMA FORESTAL";
                //}



                if (DatosLogin.InvokeTwitter == "FT2")
                {
                    int intPrincipal = Convert.ToInt32(exp.codigo_principal.ToString());
                    if (intPrincipal > 49)
                    {
                        text3 += "SALE A BATALLON DE INCENDIO ";
                    }
                    else
                    {
                        text3 += "SALE";
                    }
                }

                //### Incendios Estructural
                if (DatosLogin.InvokeTwitter == "FT3")
                {
                    text3 += "1er BATALLON DE INCENDIO ";
                }

                if (DatosLogin.InvokeTwitter == "FT4")
                {
                    text3 += "2do BATALLON DE INCENDIO ";
                }

                if (DatosLogin.InvokeTwitter == "FT5")
                {
                    text3 += "3er BATALLON DE INCENDIO ";
                }

                if (DatosLogin.InvokeTwitter == "FT6")
                {
                    text3 += "4to BATALLON DE INCENDIO ";
                }

                if (DatosLogin.InvokeTwitter == "FT7")
                {
                    text3 += "5to BATALLON DE INCENDIO ";
                }

                if (DatosLogin.InvokeTwitter == "FT8")
                {
                    text3 += "6to BATALLON DE INCENDIO ";
                }

                if (DatosLogin.InvokeTwitter == "FT9")
                {
                    text3 += "7mo BATALLON DE INCENDIO ";
                }

                //### Incendios Forestal
                if (DatosLogin.InvokeTwitter == "FT3F")
                {
                    text3 += "INCENDIO FORESTAL";
                }

                if (DatosLogin.InvokeTwitter == "FT4F")
                {
                    text3 += "2da ALARMA FORESTAL";
                }

                if (DatosLogin.InvokeTwitter == "FT5F")
                {
                    text3 += "3ra ALARMA FORESTAL";
                }

                if (DatosLogin.InvokeTwitter == "FT6F")
                {
                    text3 += "4ta ALARMA FORESTAL";
                }

                if (DatosLogin.InvokeTwitter == "FT7F")
                {
                    text3 += "5ta ALARMA FORESTAL";
                }

                if (DatosLogin.InvokeTwitter == "FT8F")
                {
                    text3 += "6ta ALARMA FORESTAL";
                }

                if (DatosLogin.InvokeTwitter == "FT9F")
                {
                    text3 += "7ma ALARMA FORESTAL";
                }



                //# Terminar Argumento
                text3 += "\"";


                //### Chequear si esta habilitado VIPER
                if (carros.GetParametroPrioridad(2) == "TRUE")
                {
                    System.Diagnostics.Process proceso2 = new System.Diagnostics.Process();
                    proceso2.StartInfo.FileName       = @"C:\ZEUS_CBMS\Viper\viper - Acceso directo";
                    proceso2.StartInfo.Arguments      = text3;
                    proceso2.StartInfo.CreateNoWindow = true;
                    proceso2.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                    proceso2.Start();
                }



                //###########################
                //###   JSON Emergencia   ###
                //###########################
                //var llam = new z_llamados();
                //llam = llam.getObjectz_llamados(exp.codigo_llamado);
                string   sector_r = exp.comuna.ToString().Replace("/", "-");
                string[] array2   = exp.e_lat_long.ToString().Split(',');
                //string CarrosSlach = CDStringFinal.Replace(",", "/");   //### NOMBRES de Carros
                string CarrosSlach = StIdCarro.Replace(",", "/");         //### ID de Carros

                string[] GetFechaHora = exp.fecha.ToString().Split(' ');

                JsonEmergencia emergencia = new JsonEmergencia();
                emergencia.expediente  = exp.id_expediente.ToString();
                emergencia.correlativo = exp.correlativo.ToString();
                emergencia.fecha       = GetFechaHora[0].ToString();
                emergencia.hora        = GetFechaHora[1].ToString();

                emergencia.id_acto     = exp.codigo_principal.ToString();
                emergencia.id_llamado  = llam.codigo_llamado.ToString();
                emergencia.calle       = exp.seis2.ToString().Replace("Ñ", "N");
                emergencia.casa        = exp.casa.ToString();
                emergencia.block       = exp.block.ToString();
                emergencia.piso        = exp.Piso.ToString();
                emergencia.villa       = exp.comuna.ToString().Replace("Ñ", "N");
                emergencia.area        = exp.id_area.ToString();
                emergencia.comuna      = exp.comuna_real.ToString().Replace("Ñ", "N");
                emergencia.esquina     = exp.cero5.ToString();
                emergencia.carros      = CarrosSlach.Replace("Ñ", "N");
                emergencia.casa        = exp.casa.ToString();
                emergencia.esquina     = exp.cero5.ToString().Replace("Ñ", "N");
                emergencia.quien_llama = exp.quien_llama.ToString().Replace("Ñ", "N");
                emergencia.telefono    = exp.telefono.ToString();
                emergencia.estado      = exp.activo.ToString();
                emergencia.operadora   = DatosLogin.NomUsuario.ToString().Replace("Ñ", "N");
                emergencia.latitud     = array2[0].ToString();
                emergencia.longitud    = array2[1].ToString();
                //# Tono de Llamado
                string strTono = "";
                if (Batallon != 0)
                {
                    strTono         = "1";
                    emergencia.acto = "BATALLON DE INCENDIO";
                }
                else
                {
                    strTono         = new e_expedientes().Get_Id_Tono(exp.codigo_principal.ToString());
                    emergencia.acto = llam.clave.ToString();
                }
                emergencia.tono = strTono;

                //### Incluir Notificación ZEUS Alerta
                if (carros.GetParametroPrioridad(8).Equals("TRUE"))
                {
                    emergencia.mobile = true;
                }
                else
                {
                    emergencia.mobile = false;
                }

                string json   = JsonConvert.SerializeObject(emergencia);
                string json_2 = json.Replace("\"", "%");
                string json_3 = json_2.Replace(" ", "?");

                if (carros.GetParametroPrioridad(6).Equals("TRUE"))
                {
                    System.Diagnostics.Process proceso2 = new System.Diagnostics.Process();
                    proceso2.StartInfo.FileName       = @"C:\ZEUS_CBMS\Apolo\emergencias.py";
                    proceso2.StartInfo.Arguments      = json_3.ToString();
                    proceso2.StartInfo.CreateNoWindow = true;
                    proceso2.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                    proceso2.Start();
                    //MessageBox.Show(json_3, "Json ZEUS            :)");
                }

                //### Escribir JSON MultiPuestaServicio
                string       fic = @"C:\ZEUS_CBMS\ZTablasApolo\JsonExpediente_" + System.DateTime.Now.ToString("yyyyMMddhhmmss") + ".txt";
                StreamWriter sw  = new StreamWriter(fic);
                sw.WriteLine("JSON Despacho ZEUS");
                sw.WriteLine("");
                sw.WriteLine(json_3);
                sw.Close();



                //######################## OJO
                //### Tonos Selectivos ### Agregar esta linea "using System.Linq;"
                //######################## para Distinct()
                string strParametros = "";
                if (Batallon > 0)
                {
                    //# Tono de Incendio
                    strParametros = "100,90,50";
                }
                else
                {
                    //# Tonos Selectivos
                    int[] IdCias = new int[IdCarros.Count];
                    for (int x = 0; x < IdCarros.Count; x++)
                    {
                        carros    = carros.getObjectz_carros(IdCarros[x]);
                        IdCias[x] = carros.id_compania;
                    }
                    //# Ordenar y Eliminar Compañias Repetidas
                    Array.Sort(IdCias);
                    //if (IdCias.Length > 1)
                    //{
                    //    IEnumerable<int> IdCiasUnico = IdCias.Distinct();
                    //}
                    //else
                    //{
                    //    IEnumerable<int> IdCiasUnico = IdCias;
                    //}


                    List <int> IdCiasUnico = new List <int>();
                    foreach (int i in IdCias)
                    {
                        if (!IdCiasUnico.Contains(i))
                        {
                            IdCiasUnico.Add(i);
                        }
                    }

                    //# Agrupa Tipo de Llamado
                    int ClavPrincipal  = exp.codigo_principal;
                    int TonoDelLlamado = 0;
                    if (EsLlamadoComandancia(ClavPrincipal))
                    {
                        TonoDelLlamado = 70;
                    }
                    if (EsRescate(ClavPrincipal))
                    {
                        TonoDelLlamado = 60;
                    }
                    if (EsOtrosServicios(ClavPrincipal))
                    {
                        TonoDelLlamado = 80;
                    }

                    //# Crear el String de Parámetro
                    foreach (int c in IdCiasUnico)
                    {
                        strParametros += c.ToString() + ",";
                    }

                    strParametros = "99," + strParametros + TonoDelLlamado;
                } //Fin If

                //MessageBox.Show("ParamSelectivo:  " + strParametros, "Tonos ZEUS");
                //### Activar Tonos
                if (carros.GetParametroPrioridad(3).Equals("TRUE"))
                {
                    System.Diagnostics.Process proceso2 = new System.Diagnostics.Process();
                    proceso2.StartInfo.FileName       = @"C:\ZEUS_CBMS\Tonos\TonosDesdeZeus.exe";
                    proceso2.StartInfo.Arguments      = strParametros;
                    proceso2.StartInfo.CreateNoWindow = true;
                    proceso2.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                    proceso2.Start();
                }
            } //# Fin IF Si hay Carros
            else
            {
                MessageBox.Show("No hay Carros Seleccionados para ser Despachados", "ZEUS");
            } //# Fin IF Si hay Carros
        }
示例#9
0
        //private void gvDisponible_CellContentClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    string valor = gvDisponible.CurrentRow.Cells[1].Value.ToString();
        //    if (valor != "0")
        //    {
        //        // poner en servicio
        //        z_conductores conductor = new z_conductores();
        //        int id_conductor = Convert.ToInt32(gvDisponible.CurrentRow.Cells[1].Value.ToString());
        //        z_carros carro = new z_carros();
        //        carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
        //        var carros = new List<int> { carro.id_carro };

        //        if (carro.estado == 1 && carro.id_conductor != 0)
        //        {
        //            // fuera de servicio con cond. actual
        //            Conductor.FueraServicio(carro.id_conductor, carros);
        //        }

        //        Conductor.PuestaEnServicio(id_conductor, carros, null);

        //        DataRow row = conductor.GetNombreConductor(id_conductor).Tables[0].Rows[0];
        //        lblDesConductor.Text = row["nombre_voluntario"].ToString();
        //        lblDescEstado.Text = "En servicio";

        //        MessageBox.Show("Conductor " + row["nombre_voluntario"].ToString() + " asignado al carro " + RecursosEstaticos.NombreCarro, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information);
        //    }
        //}


        //### 0-9
        private void gvDisponible_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //### JSON SERVICIO 1 = 0-9
            z_carros carro = new z_carros();

            carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
            JsonServicioClaves jsc = new JsonServicioClaves(carro.id_carro);

            string valor = gvDisponible.CurrentRow.Cells[1].Value.ToString();
            Color  color = new Color();

            if (valor != "0")
            {
                // poner en servicio
                z_conductores conductor    = new z_conductores();
                int           id_conductor = Convert.ToInt32(gvDisponible.CurrentRow.Cells[1].Value.ToString());
                //z_carros carro = new z_carros();
                //carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
                var carros = new List <int> {
                    carro.id_carro
                };

                if (carro.estado == 1 && carro.id_conductor != 0)
                {
                    DataSet ds1 = new z_conductores().Getz_conductoresCarro(carro.id_carro);
                    int     id_tipo_coductor1 = 0;
                    foreach (DataRow row2 in ds1.Tables[0].Rows)
                    {
                        //if ((int)row2["id_conductor"] == carro.id_conductor)
                        if ((int)row2["id_conductor"] == id_conductor)
                        {
                            id_tipo_coductor1 = (int)row2["id_tipo_conductor"];
                            break;
                        }
                    }

                    z_servicio servicio1 = new z_servicio(carro.id_carro, System.DateTime.Now, 1, carro.id_conductor, "Gestión M.M.: Asignación de conductor para el carro " + RecursosEstaticos.NombreCarro + "");
                    servicio1.Insert(servicio1);

                    //### JSON SERVICIO 1 = 0-9
                    if (carro.GetParametroPrioridad(6) == "TRUE")
                    {
                        //jsc.JsonServicioHora(carro.id_carro, 1, "Juan Perez", "0-9", "Verde");
                    }

                    // Fuera de Servicio con este Conductor
                    Conductor.FueraServicio(carro.id_conductor, carros);
                }

                Conductor.PuestaEnServicio(id_conductor, carros, null);


                //### JSON SERVICIO 1 = 0-9
                if (carro.GetParametroPrioridad(6) == "TRUE")
                {
                    //### Nombre de Conductor
                    string strNomConductor = new z_conductores().Getz_NombreConductor(id_conductor);
                    jsc.JsonServicioHora(carro.id_carro, 1, strNomConductor, "0-9", "Verde", true);
                }


                DataSet ds = new z_conductores().Getz_conductoresCarro(carro.id_carro);
                int     id_tipo_coductor = 0;
                foreach (DataRow row2 in ds.Tables[0].Rows)
                {
                    //if ((int)row2["id_conductor"] == carro.id_conductor)
                    if ((int)row2["id_conductor"] == id_conductor)
                    {
                        id_tipo_coductor = (int)row2["id_tipo_conductor"];
                        break;
                    }
                }

                DataRow row = conductor.GetNombreConductor(id_conductor, id_tipo_coductor).Tables[0].Rows[0];
                lblDesConductor.Text = row["nombre_voluntario"].ToString();
                lblDescEstado.Text   = "En servicio";

                z_servicio servicio2 = new z_servicio(carro.id_carro, System.DateTime.Now, 1, carro.id_conductor, "Gestión M.M.: Conductor queda en servicio para el carro " + carro.nombre + "");
                servicio2.Insert(servicio2);

                MessageBox.Show("Conductor " + row["nombre_voluntario"].ToString() + " asignado al carro " + RecursosEstaticos.NombreCarro, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //### Hacer Click al 0-9
                btn_09.PerformClick();
            }
        }
示例#10
0
        //### 0-8
        private void button2_Click(object sender, EventArgs e)
        {
            //### JSON SERVICIO 2 = 0-8
            z_carros carro = new z_carros();

            carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
            JsonServicioClaves jsc = new JsonServicioClaves(carro.id_carro);


            //### Fuera de Servicio Electrico
            if (rbfsElectrico.Checked)
            {
                //### Hacer Click al 0-8
                btn_08.PerformClick();

                //z_carros carro = new z_carros();
                //carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
                Carro.FueraServicio(carro.id_carro, rbfsElectrico.Text);
                //Estado = 2;
                BitacoraGestion.NuevoEvento(1, 1,
                                            "Carro: " + Text + " Fuera de Servicio (" + "Eléctrico" +
                                            ")");

                z_servicio servicio1 = new z_servicio(carro.id_carro, System.DateTime.Now, 2, carro.id_conductor, "Gestión M.M.: Carro " + RecursosEstaticos.NombreCarro + " fuera de servicio -> Eléctrico");
                servicio1.Insert(servicio1);

                lblDescEstado.Text = rbfsElectrico.Text;


                //### JSON SERVICIO 2 = 0-8
                if (carro.GetParametroPrioridad(6) == "TRUE")
                {
                    jsc.JsonServicioHora(carro.id_carro, 2, "", "0-8", "Rojo", true);
                }
            }


            //### Fuera de Servicio Mecánico
            if (rbfsMecanico.Checked)
            {
                //### Hacer Click al 0-8
                btn_08.PerformClick();

                //z_carros carro = new z_carros();
                //carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
                Carro.FueraServicio(carro.id_carro, rbfsMecanico.Text);
                //Estado = 2;
                BitacoraGestion.NuevoEvento(1, 1,
                                            "Carro: " + Text + " Fuera de Servicio (" + "Mecánico" +
                                            ")");

                z_servicio servicio1 = new z_servicio(carro.id_carro, System.DateTime.Now, 2, carro.id_conductor, "Gestión M.M.: Carro " + RecursosEstaticos.NombreCarro + " fuera de servicio -> Mecánico");
                servicio1.Insert(servicio1);

                lblDescEstado.Text = rbfsMecanico.Text;

                //### JSON SERVICIO 2 =0-8
                if (carro.GetParametroPrioridad(6) == "TRUE")
                {
                    jsc.JsonServicioHora(carro.id_carro, 2, "", "0-8", "Rojo", true);
                }
            }


            //### Fuera de Servicio
            if (rbfsOtro.Checked)
            {
                //### Hacer Click al 0-8
                btn_08.PerformClick();

                //z_carros carro = new z_carros();
                //carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
                Carro.FueraServicio(carro.id_carro, txtOtro.Text);
                //Estado = 2;
                BitacoraGestion.NuevoEvento(1, 1,
                                            "Carro: " + Text + " Fuera de Servicio (" + txtOtro.Text +
                                            ")");

                z_servicio servicio1 = new z_servicio(carro.id_carro, System.DateTime.Now, 2, carro.id_conductor, "Gestión M.M.: Carro " + RecursosEstaticos.NombreCarro + " fuera de servicio -> " + txtOtro.Text + "");
                servicio1.Insert(servicio1);

                lblDescEstado.Text = "Fuera de Servicio: " + txtOtro.Text;

                //### JSON SERVICIO 2 =0-8
                if (carro.GetParametroPrioridad(6) == "TRUE")
                {
                    jsc.JsonServicioHora(carro.id_carro, 2, "", "0-8", "Rojo", true);
                }
            }

            //### Fuera de Servicio SIN CONDUCTOR
            if (rbSinConductor.Checked)
            {
                //### Hacer Click al 0-8
                btn_08.PerformClick();

                //z_carros carro = new z_carros();
                //carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);

                Carro.SinConductor(carro.id_carro);
                //Carro.FueraServicio(carro.id_carro, "Sin Conductor.");
                BitacoraGestion.NuevoEvento(DatosLogin.LoginUsuario, DatosLogin.LoginUsuario,
                                            "Carro: " + carro.nombre + " Sin coductor");

                z_servicio servicio1 = new z_servicio(carro.id_carro, System.DateTime.Now, 3, carro.id_conductor, "Gestión M.M.: Carro " + RecursosEstaticos.NombreCarro + " sin conductor");
                servicio1.Insert(servicio1);

                //MessageBox.Show("Sin conductor asignado" + RecursosEstaticos.NombreCarro, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //### JSON SERVICIO 2 =0-8
                if (carro.GetParametroPrioridad(6) == "TRUE")
                {
                    jsc.JsonServicioHora(carro.id_carro, 2, "", "0-8", "Amarillo", true);
                }
            }

            if (rbLiberarCarro.Checked)
            {
                // Preguntar antes de liberar
                if (
                    MessageBox.Show(
                        "'Liberar Carro' debe ser utilizado sólo como medida de emergencia, ¿Está seguro que desea liberar este carro?",
                        "Liberar Carro", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                {
                    try
                    {
                        //z_carros carro = new z_carros();
                        //carro = carro.getObjectz_carros(RecursosEstaticos.NombreCarro);
                        // liberar carro
                        Carro.Liberar(carro.id_carro);
                        var cu = new e_carros_usados();
                        cu = cu.getObjecte_carros_usados(carro.id_carro);
                        cu.freee_carros_usados(cu.id_carro);

                        z_servicio servicio1 = new z_servicio(carro.id_carro, System.DateTime.Now, 1, carro.id_conductor, "Gestión M.M.: Carro " + RecursosEstaticos.NombreCarro + " liberado");
                        servicio1.Insert(servicio1);
                    }
                    catch (Exception ex)
                    {
                        Log.ShowAndLog(ex);
                    }
                }

                lblEstadoCarro.Text = "En servicio";
            }

            MessageBox.Show("Carro " + RecursosEstaticos.NombreCarro + " " + lblDescEstado.Text + " asignado correctamente", "ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }