Esempio n. 1
0
        private void btnDeshacer_Click(object sender, EventArgs e)
        {
            if (listSolicitado.SelectedItems.Count != 0)
            {
                if (
                    MessageBox.Show("¿Seguro desea deshacer esta solicitud?", "Confirme", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        e_recursos_empresas ere =
                            new e_recursos_empresas().getObjecte_recursos_empresas(
                                (int)listSolicitado.SelectedItems[0].Tag);
                        ere.Delete(ere.id_empresa);
                        a_agenda_detalle det = new a_agenda_detalle().getObjecta_agenda_detalle(ere.id_empresa);
                        BitacoraLlamado.NuevoEvento((int)comboExpedientes.SelectedValue, "apoyo",
                                                    "Eliminación de Solicitud: " + det.nombre);

                        FillSolicitado();
                    }
                    catch
                    {
                        MessageBox.Show("No se pudo completar la operación debido a un error de Base de Datos.",
                                        "Mensaje de ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un apoyo primero.", "Mensaje de ZEUS", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
        private void btnClave_Click(object sender, EventArgs e)
        {
            Claves c = new Claves();

            //e_expedientes exp = new e_expedientes().getObjecte_expedientes(id_expediente);
            c.CodigoPrincipal = expediente.codigo_principal;
            c.CodigoLlamado   = expediente.codigo_llamado;
            if (c.ShowDialog() == DialogResult.OK)
            {
                string prevClave = textClave.Text;
                expediente.codigo_llamado   = c.CodigoLlamado;
                expediente.codigo_principal = c.CodigoPrincipal;
                try
                {
                    expediente.Update(expediente);
                    MostrarInfo(expediente);
                    BitacoraLlamado.NuevoEvento(expediente.id_expediente, BitacoraLlamado.Llamado,
                                                string.Format(
                                                    "Por orden del Oficial a Cargo, se cambia la clave {0} a {1}",
                                                    prevClave, c.Clave));
                }
                catch (Exception ex)
                {
                    Log.ShowAndLog(ex);
                }
            }
        }
Esempio n. 3
0
        private void btnLugar_Click(object sender, EventArgs e)
        {
            if (listSolicitado.SelectedItems.Count != 0)
            {
                try
                {
                    e_recursos_empresas ere =
                        new e_recursos_empresas().getObjecte_recursos_empresas((int)listSolicitado.SelectedItems[0].Tag);
                    ere.estado = false;
                    ere.Update(ere);
                    a_agenda_detalle det = new a_agenda_detalle().getObjecta_agenda_detalle(ere.id_empresa);
                    BitacoraLlamado.NuevoEvento((int)comboExpedientes.SelectedValue, "apoyo",
                                                "En el Lugar: " + det.nombre);

                    FillSolicitado();
                }
                catch
                {
                    MessageBox.Show("No se pudo completar la operación debido a un error de Base de Datos.",
                                    "Mensaje de ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un apoyo primero.", "Mensaje de ZEUS", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 4
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (textOficial.Text != "")
     {
         BitacoraLlamado.NuevoEvento(IdExpediente, BitacoraLlamado.Llamado,
                                     "Asignación de carros autorizado por: " + textOficial.Text);
     }
     else
     {
         MessageBox.Show("Debe ingresar el nombre del oficial.");
     }
 }
Esempio n. 5
0
        private void btnSolicita_Click(object sender, EventArgs e)
        {
            if (comboExpedientes.SelectedIndex != -1 && listEmpresas.SelectedIndex != -1)
            {
                try
                {
                    e_recursos_empresas re =
                        new e_recursos_empresas().getObjecte_recursos_empresas((int)comboExpedientes.SelectedValue,
                                                                               (int)listEmpresas.SelectedValue);
                    re.estado = true;
                    if (re.id_expediente == 0)
                    {
                        re.id_expediente = (int)comboExpedientes.SelectedValue;
                        re.id_empresa    = (int)listEmpresas.SelectedValue;
                        re.Insert(re);
                    }
                    else
                    {
                        re.Update(re);
                    }
                    a_agenda_detalle det = new a_agenda_detalle().getObjecta_agenda_detalle(re.id_empresa);
                    BitacoraLlamado.NuevoEvento((int)comboExpedientes.SelectedValue, "apoyo",
                                                "Se Solicita: " + det.nombre);
                    FillSolicitado();

                    ((Button)sender).Image   = Resources.success.ToBitmap();
                    ((Button)sender).Enabled = false;
                    if (btnLugar.Enabled != true)
                    {
                        btnLugar.Image   = null;
                        btnLugar.Enabled = true;
                    }
                }
                catch (Exception ex)
                {
                    Log.Write(ex);
                    MessageBox.Show("No se pudo completar la operación debido a un error de Base de Datos.",
                                    "Mensaje de Zeus", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un expediente y una empresa primero.", "Error", MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
 private void btn67_Click(object sender, EventArgs e)
 {
     try
     {
         e_expedientes exp = new e_expedientes().getObjecte_expedientes(id_expediente);
         exp.sit_controlada = true;
         exp.Update(exp);
         ZeusWin.Actualizar();
         MessageBox.Show("Incendio finalizado a las " + DateTime.Now.ToShortTimeString() + " horas",
                         "Mensaje de Zeus");
         BitacoraLlamado.NuevoEvento(id_expediente, 0, BitacoraLlamado.Carro,
                                     "Finalización de Incendio");
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Esempio n. 7
0
        private void btnCerrar_Click(object sender, EventArgs e)
        {
            if (
                MessageBox.Show("¿Desea cerrar este expediente?", "Confirmar Cierre", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            try
            {
                // liberar empresas
                var           rec        = new e_recursos_empresas();
                e_expedientes expediente = new e_expedientes();
                expediente.limpiarTablaZcarrosLlamado(id_expediente);
                rec.freee_recursos_empresas(id_expediente);

                // liberar carros
                var     carros = new e_carros_usados();
                DataSet ds     = carros.Gete_carros_exp(id_expediente);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    carros.freee_carros_usados((int)dr["id_carro"]);
                    Carro.Liberar((int)dr["id_carro"]);
                    BitacoraLlamado.NuevoEvento(id_expediente, (int)dr["id_carro"],
                                                BitacoraLlamado.Carro, "6-10");
                }
                // cerrar
                var exp = new e_expedientes();
                exp        = exp.getObjecte_expedientes(id_expediente);
                exp.activo = false;
                exp.Update(exp);
                BitacoraLlamado.NuevoEvento(id_expediente, 0, BitacoraLlamado.Llamado,
                                            "Cierre de Expediente");
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
 private void btnIngresar_Click(object sender, EventArgs e)
 {
     if (Validar())
     {
         //z_novedad nov = new z_novedad();
         //nov.id_operadora = zeusWin.IdOperadora;
         //nov.novedad = textNovedad.Text;
         //nov.descripcion = textDescripcion.Text;
         //nov.addz_novedad(nov);
         if (radioLlamados.Checked)
         {
             BitacoraLlamado.NuevoEvento(zeusWin.IdExpediente, BitacoraLlamado.Llamado,
                                         textDescripcion.Text, DateTime.Parse(textFecha.Text));
         }
         else
         {
             BitacoraGestion.NuevoEvento(zeusWin.IdOperadora, zeusWin.IdAval, textDescripcion.Text,
                                         DateTime.Parse(textFecha.Text));
         }
         MessageBox.Show("Datos ingresados correctamente.", "Mensaje de ZEUS", MessageBoxButtons.OK,
                         MessageBoxIcon.Information);
     }
 }
        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
        }
        private void btnDespachar_Click(object sender, EventArgs e)
        {
            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 CDString      = "";
            string CDStringFinal = "";

            for (int x = 0; x < IdCarros.Count; x++)
            {
                CDString += carros.ObtenerNombreCarro(IdCarros[x]) + ",";
            }
            CDString     += "#";
            CDStringFinal = CDString.Replace(",#", "");
            int TipoTw = 2; //### Para Despachos debe ser Valor 2

            // #Publicar en Twitter#
            // #Alexy2411#
            //if (CDStringFinal != "#")
            //{
            //    System.Diagnostics.Process proceso = new System.Diagnostics.Process();
            //    proceso.StartInfo.FileName = @"C:\comander\app_twitter\App_Twitter_Mod.exe";
            //    proceso.StartInfo.Arguments = TipoTw.ToString() + " " + IdExpediente.ToString() + " " + DatosLogin.InvokeTwitter.ToString() + " " + CDStringFinal;
            //    proceso.Start();
            //}
        }