Esempio n. 1
0
        public void OnAsignacionHandler(object sender, DataEventArgs e)
        {
            // cargar el nodo
            var exp  = new e_expedientes();
            var llam = new z_llamados();

            try
            {
                exp  = exp.getObjecte_expedientes(e.Id);
                llam = llam.getObjectz_llamados(exp.codigo_llamado);
                var tn = new LlamadoTreeNode(exp.seis2 + " / " + exp.cero5)
                {
                    ImageKey         = llam.clave,
                    SelectedImageKey = llam.clave,
                    NodeId           = exp.id_expediente,
                    NodeType         = TipoElemento.Expediente
                };
                // carros pedidos

                // agregar al árbol
                treeExpedientes.Nodes.Add(tn);
                treeExpedientes.SelectedNode = tn;
            }
            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);
            }
            //CargarExpedientes(_id_operadora);
        }
        private void btnAbrir_Click(object sender, EventArgs e)
        {
            if (dataExpedientes.SelectedRows.Count != 0)
            {
                try
                {
                    // reabrir expediente, y reasignar a operadora que lo abre
                    e_expedientes exp =
                        new e_expedientes().getObjecte_expedientes(
                            (int)dataExpedientes.SelectedRows[0].Cells["id_expediente"].Value);
                    exp.activo       = true;
                    exp.id_operadora = idOperadora;
                    exp.Update(exp);

                    DataSet ds = exp.Gete_expedientes_cerrados(dateDesde.Value, dateHasta.Value);
                    dataExpedientes.DataSource = ds.Tables[0];

                    MessageBox.Show("Operación realizada correctamente.", "Mensaje de ZEUS");
                }
                catch (Exception ex)
                {
                    Log.ShowAndLog(ex);
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un expediente.", "Mensaje de ZEUS");
            }
        }
        ////### Obtiene un Id de Carro si es un Id_Llamado en el Radio de una Compañía
        //public static int LlamadoEnRadioDeCia(int IdExpediente)
        //{
        //    var exp = new e_expedientes().getObjecte_expedientes(IdExpediente);
        //    var Desp_x_Dist = new m001_config();
        //    DataSet ds = Desp_x_Dist.GetConfigM001(exp.codigo_llamado);
        //    foreach (DataRow dr in ds.Tables[0].Rows)
        //    {
        //        Desp_x_Dist.id_llamado = (int)dr["id_llamado"];
        //        Desp_x_Dist.radio = (int)dr["radio"];
        //        Desp_x_Dist.id_compania = (int)dr["id_compania"];
        //        Desp_x_Dist.id_carro = (int)dr["id_carro"];
        //        return 1;
        //    }
        //    return 0;
        //}


        //### Data Set    Obtiene un Id de Carro si es un Id_Llamado en el Radio de una Compañía
        public int LlamadoEnRadioDeCia(int IdExpediente)
        {
            var     exp         = new e_expedientes().getObjecte_expedientes(IdExpediente);
            var     Desp_x_Dist = new m001_config();
            DataSet ds          = Desp_x_Dist.GetConfigM001(exp.codigo_llamado);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (exp.codigo_llamado == (int)dr["id_llamado"])
                {
                    Desp_x_Dist.id_llamado  = (int)dr["id_llamado"];
                    Desp_x_Dist.radio       = (int)dr["radio"];
                    Desp_x_Dist.id_compania = (int)dr["id_compania"];
                    Desp_x_Dist.id_carro    = (int)dr["id_carro"];
                    //Desp_x_Dist.x_cor = Convert.ToInt32(dr["pto_x"].ToString());  //(int)dr["pto_x"];
                    //Desp_x_Dist.y_cor = Convert.ToInt32(dr["pto_y"].ToString());  //(int)dr["pto_y"];
                    int x_cia = Convert.ToInt32(dr["pto_x"].ToString());  //(int)dr["pto_x"];
                    int y_cia = Convert.ToInt32(dr["pto_y"].ToString());  //(int)dr["pto_y"];

                    var centro  = new PointD(x_cia, y_cia);
                    var pto_exp = new PointD(exp.puntoX, exp.puntoY);
                    int IdCarro = Desp_x_Dist.HayExpEnRadio(centro, (int)dr["radio"], pto_exp);
                    if (IdCarro > 0)
                    {
                        return(IdCarro);
                    }
                }
            }
            return(0);
        }
Esempio n. 4
0
        private static bool CheckRestriccionIncendio(int id_expediente)
        {
            var exp = new e_expedientes();

            exp = exp.getObjecte_expedientes(id_expediente);
            var llam = new z_llamados();

            llam = llam.getObjectz_llamados(exp.codigo_principal);

            if (exp.EnIncendio() && llam.rest_incendio)
            {
                var vb = new VistoBueno
                {
                    IdExpediente = id_expediente,
                    Mensaje      = "Este despacho requiere autorización de un oficial.",
                    Text         = "Despacho restringido en Incendio"
                };

                if (vb.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
                return(false);
            }
            return(true);
        }
Esempio n. 5
0
        public static bool ConfirmarDespacho(List <int> id_carro, int id_expediente, int batallon)
        {
            // cambiar clave!
            // obtener codigo llamado batallon
            var     llam           = new z_llamados();
            DataSet db             = llam.Getz_llamados_incendio();
            int     codigo_llamado = (int)db.Tables[0].Rows[batallon - 1]["codigo_llamado"];

            var exp = new e_expedientes();

            exp = exp.getObjecte_expedientes(id_expediente);
            // actualizar expediente
            exp.codigo_principal = codigo_llamado;
            exp.batallon         = batallon;
            // correlativo
            if (exp.correlativo_iioo == 0)
            {
                exp.correlativo_iioo = exp.GetNextCorrelativoIIOO();
            }
            exp.Update(exp);

            var retValue = ConfirmarDespacho(id_carro, id_expediente, batallon, false);

            return(retValue);
        }
Esempio n. 6
0
        private void ContarExp()
        {
            int num = new e_expedientes().Gete_expedientes_operadora(0).Tables[0].Rows.Count;

            //btnExpedientes.Text = string.Format((string)btnExpedientes.Tag, num);
            switch (num)
            {
            case 0:
                btnExpedientes.Text = "Sin Expedientes";
                break;

            case 1:
                btnExpedientes.Text = "1 Expediente";
                break;

            default:
                btnExpedientes.Text = string.Format("{0} Expedientes", num);
                break;
            }
            if (num > 0)
            {
                timer2.Start();
            }
            else
            {
                timer2.Stop();
                btnExpedientes.BackColor = DefaultBackColor;
            }
        }
Esempio n. 7
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (dataGridExpedientes.SelectedRows.Count != 0)
     {
         // cambiar expediente de "mano"
         try
         {
             z_locutores loc =
                 new z_locutores().Login((string)dataGridExpedientes.SelectedRows[0].Cells["login"].Value,
                                         textContraseña.Text);
             if (loc == null)
             {
                 MessageBox.Show("La contraseña ingresada no es correcta.", "Mensaje de ZEUS");
                 return;
             }
             e_expedientes exp =
                 new e_expedientes().getObjecte_expedientes(
                     (int)dataGridExpedientes.SelectedRows[0].Cells["id_expediente"].Value);
             exp.id_operadora = zeusWin.IdOperadora;
             exp.Update(exp);
         }
         catch (Exception ex)
         {
             Log.ShowAndLog(ex);
         }
     }
 }
Esempio n. 8
0
        //###############################################
        //###   JSON APOLO Y PUBLICAR MATERIAL MAYOR  ###
        //###############################################

        public void ApoloHoraCarro(string ClaveCarro, int iDcarro, int iDconductor, string zUser, string zPw)
        {
            var ccarros = new z_carros();

            ccarros = ccarros.getObjectz_carros(carroUsado.id_carro);
            string strCarro = ccarros.nombre;

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

            string obj = "{";

            obj += "'usuario':'" + zUser + "',";
            obj += "'password':'******',";
            //obj += "'fecha':'" + GetFechaHora[0].ToString() + "',";
            //obj += "'hora':'" + GetFechaHora[1].ToString() + "',";
            obj += "'estado':'" + ClaveCarro + "',";
            obj += "'carro':" + iDcarro + ",";
            obj += "'conductor':" + iDconductor + ",";
            obj += "'hora_estado':'" + System.DateTime.Now.ToString() + "'}";

            string obj_v2 = obj.Replace(" ", "?");

            if (ccarros.GetParametroPrioridad(6).Equals("TRUE"))
            {
                System.Diagnostics.Process proceso2 = new System.Diagnostics.Process();
                proceso2.StartInfo.FileName       = @"C:\ZEUS_CBMS\Apolo\bitacoras.py";
                proceso2.StartInfo.Arguments      = obj_v2;
                proceso2.StartInfo.CreateNoWindow = true;
                proceso2.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                proceso2.Start();
            }
        }
Esempio n. 9
0
        private int recIDHORA()
        {
            int bloque = 0;

            //### Validar Día Feriado
            e_expedientes expB = new e_expedientes();

            if (expB.EsFeriado() == true)
            {
                bloque = 1;
            }
            else
            {
                try
                {
                    int           id  = 0;
                    e_expedientes exp = new e_expedientes(0, "", "", 0.0, "", "", false, 0.0, DateTime.Now, DateTime.Now, "", "", "", "", "", "", "", 0, 0, 0, false, 0, 0, "", "");
                    fecha_registro = informacionExpediente1.Controls["textFechaHoraAlarma"].Text;
                    arreglo_1      = fecha_registro.Split(' ');
                    arreglo_2      = arreglo_1[1].Split(':');
                    hora_decimal   = arreglo_2[0].ToString() + "." + arreglo_2[1].ToString() + arreglo_2[2].ToString();
                    bloque         = exp.recuperarIDHoraDLL(hora_decimal);
                }
                catch (Exception exe)
                {
                }

                //catch (Exception myErr)
                //{
                //    throw (new Exception(myErr.ToString() + reqSQL));
                //}
            }
            return(bloque);
        }
Esempio n. 10
0
        public ArrayList Un_Carro_X_Clave_All(int id_grupo, int bloque, int id_expediente)
        {
            Cursor.Current = Cursors.WaitCursor;
            var       exp               = new e_expedientes();
            var       llam              = new z_llamados();
            int       id_carro_tip      = 0;
            string    sindesp           = "";
            ArrayList list_carros_alist = new ArrayList();

            try
            {
                exp  = exp.getObjecte_expedientes(id_expediente);
                llam = llam.getObjectz_llamados(exp.codigo_principal);
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }

            if (exp.id_area != 0)
            {
                // Obtener el ID de Carro Según Grupo Solicitado
                list_carros_alist = Despacho.Ranking_x_Claves_All(exp.id_expediente, id_grupo.ToString(), bloque);
                // List<int> id_carros = llam.incendio ? Despacho.DespacharBatallon(id_expediente, id_area, llam.codigo_llamado - 50, out sindesp) : Despacho.Despachar(id_expediente, id_area);



                /*
                 * var cd = new ConfirmarDespacho
                 * {
                 *  IdCarros = id_carros,
                 *  IdExpediente = id_expediente,
                 *  IdArea = id_area
                 * };
                 * cd.lblSinDesp.Text += "\n" + sindesp;
                 *
                 * // ******
                 *
                 * // ******************
                 *
                 * cd.ShowDialog();
                 * btnDespachar.Blink = false;
                 * ZeusWin.Actualizar();
                 *
                 * }
                 * else
                 * {
                 * var id_carros = new List<int>();
                 * var cd = new CarroDisponible { IdCarros = id_carros };
                 * if (cd.ShowDialog() == DialogResult.OK)
                 * {
                 *  Despacho.ConfirmarDespacho(id_carros, id_expediente);
                 * }
                 * }
                 * Cursor.Current = Cursors.Default;
                 */
            }
            return(list_carros_alist);
        }
Esempio n. 11
0
        public static void Ejecutar(e_expedientes expediente, List <int> carros)
        {
#if CBMS
            CBMS_CasoEspecialAgregarBX(expediente, carros);
            CBMS_CasoEspecialBXporB(expediente, carros);
            CBMS_CasoEspecialAgregarUT(expediente, carros);
#endif
        }
Esempio n. 12
0
        /// <summary>
        /// Igual al caso especial Agregar BX, pero para los UT
        /// </summary>
        /// <param name="exp"></param>
        /// <param name="id_carros"></param>
        private static void CBMS_CasoEspecialAgregarUT(e_expedientes exp, ICollection <int> id_carros)
        {
            z_llamados llam = new z_llamados().getObjectz_llamados_id(exp.codigo_principal);

            // verificar 10-0
            if (llam.clave == "10-0")
            {
                // verificar 2 B despachados
                int       cant_b     = 0;
                DataTable tipo_carro = new z_tipo_carro().Getz_tipo_carro().Tables[0];
                DataTable carros     = new z_carros().Getz_carros().Tables[0];
                var       tipo_b     = (int)(tipo_carro.Select("tipo_carro_letra='B'")[0]["id_tipo_carro"]);
                var       columna_b  = (string)(tipo_carro.Select("tipo_carro_letra='B'")[0]["columna_despacho"]);
                var       tipo_ut    = (int)(tipo_carro.Select("tipo_carro_letra='UT'")[0]["id_tipo_carro"]);
                var       carros_b   = new List <int>();

                foreach (int id in id_carros)
                {
                    DataRow dr = carros.Select("id_carro=" + id)[0];
                    if ((int)dr["id_tipo_carro"] == tipo_b)
                    {
                        cant_b++;
                        carros_b.Add(id);
                    }
                }

                if (cant_b >= 2)
                {
                    // obtener primera prioridad B (hecho arriba)
                    DataSet prioridad = new z_prioridad().Getz_prioridad(exp.id_area);
                    // si primer carro == primera prioridad, verificar bx
                    var prim_prioridad = (int)prioridad.Tables[0].Rows[0][columna_b];
                    if ((int)carros.Select("id_carro=" + carros_b[0])[0]["id_compania"] == prim_prioridad)
                    {
                        DataRow[] dr =
                            carros.Select("id_compania = " + prim_prioridad + " and id_tipo_carro=" + tipo_ut +
                                          " and estado=1");
                        // si dr!= null, liberar último B solicitado y agregar ut al despacho
                        if (dr.Length != 0)
                        {
                            // liberar último carro B
                            //Carro.Liberar(carros_b[carros_b.Count-1]);
                            //id_carros.Remove(carros_b[carros_b.Count - 1]);

                            // despachar BX
                            var ut = (int)dr[0]["id_carro"];
                            id_carros.Add(ut);
                            //Carro.MarcarDespachado(ut);
                            z_carros c = new z_carros().getObjectz_carros(ut);
                            //Conductor.FueraServicio(c.id_conductor, c.id_carro);
                            Carro.Despachar(c);
                        }
                    }
                }
            }
        }
Esempio n. 13
0
        //public e_carros_usados CarroUsado
        //{
        //    get { return carroUsado; }
        //}



        //#########################
        //###   JSON Gestión Carro   ###
        //#########################
        public void ApoloHoraGestionCarro(int IdExp, int IdCarro, int intOp, int intIdGestion)
        {
            //# Objeto Expediente
            exp = exp.getObjecte_expedientes(IdExp);
            string[] GetFechaHora  = exp.fecha.ToString().Split(' ');
            string[] GetHoraActual = System.DateTime.Now.ToString().Split(' ');

            JsonGstionCarro gestion = new JsonGstionCarro();

            switch (IdExp)
            {
            case -1:
                gestion.acto = "6-13";
                break;

            case -2:
                gestion.acto = "6-14";
                break;

            case -3:
                gestion.acto = "6-15";
                break;

            default:
                break;
            }
            gestion.fecha     = GetHoraActual[0].ToString();
            gestion.hora      = GetHoraActual[1].ToString();
            gestion.carro     = IdCarro;
            gestion.operadora = intOp;
            gestion.idgestion = intIdGestion;

            string jsonBit   = JsonConvert.SerializeObject(gestion);
            string jsonBit_2 = jsonBit.Replace("\"", "%");
            string jsonBit_3 = jsonBit_2.Replace(" ", "?");

            if (ccarros.GetParametroPrioridad(6).Equals("TRUE"))
            {
                System.Diagnostics.Process proceso2 = new System.Diagnostics.Process();
                proceso2.StartInfo.FileName       = @"C:\ZEUS_CBMS\Apolo\salidas.py";
                proceso2.StartInfo.Arguments      = jsonBit_3;
                proceso2.StartInfo.CreateNoWindow = true;
                proceso2.StartInfo.WindowStyle    = System.Diagnostics.ProcessWindowStyle.Hidden;
                proceso2.Start();
            }


            //### Escribir JSON Salidas
            string       fic = @"C:\ZEUS_CBMS\ZTablasApolo\JsonGestionCarro.txt";
            StreamWriter sw  = new StreamWriter(fic);

            sw.WriteLine("JSON Bitacora ZEUS");
            sw.WriteLine("");
            sw.WriteLine(jsonBit_3);
            sw.Close();
        }
 private void comboClaves_SelectedIndexChanged(object sender, EventArgs e)
 {
     // cargar expedientes para dicha clave
     if (comboClaves.SelectedIndex != -1)
     {
         var     exp = new e_expedientes();
         DataSet ds  = exp.Gete_expedientes_codigoprincipal((int)comboClaves.SelectedValue);
         comboExpediente.DataSource = ds.Tables[0];
     }
 }
Esempio n. 15
0
        private static bool CheckRestriccionB(int id_expediente, IEnumerable <int> id_carros)
        {
            // 1: Cantidad de carros b
            var exp = new e_expedientes();

            exp = exp.getObjecte_expedientes(id_expediente);
            var llam = new z_llamados();

            llam = llam.getObjectz_llamados(exp.codigo_principal);
            if (llam.max_b == 0)
            {
                return(true);
            }

            var     carros = new e_carros_usados();
            int     cant   = 0;
            DataSet ds     = carros.Gete_carros_exp(id_expediente);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                var c = new z_carros();
                c = c.getObjectz_carros((int)dr["id_carro"]);
                if (c.id_tipo_carro == 1)
                {
                    cant++;
                }
            }

            // carros actuales
            foreach (int id in id_carros)
            {
                var c = new z_carros();
                c = c.getObjectz_carros(id);
                if (c.id_tipo_carro == 1)
                {
                    cant++;
                }
            }

            if (cant > llam.max_b)
            {
                var vb = new VistoBueno
                {
                    IdExpediente = id_expediente,
                    Mensaje      = "La cantidad de carros permitida para esta clave ha sido superada."
                };

                if (vb.ShowDialog() == DialogResult.OK)
                {
                    return(true);
                }
                return(false);
            }
            return(true);
        }
Esempio n. 16
0
        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            DateTime hora    = DateTime.Now.AddMinutes(-DateTime.Now.Minute);
            var      Boletin = (ReportClass)crystalReportViewer1.ReportSource;
            var      exp     = new e_expedientes();
            DataSet  ds      = exp.GetIncendios24Horas();

            if (ds.Tables[0].Rows.Count == 0)
            {
                Boletin.OpenSubreport("Incendios").ReportDefinition.Sections["DetailSection1"].SectionFormat.
                EnableSuppress = true;
            }
            Boletin.OpenSubreport("Incendios").SetDataSource(ds);
            ds = exp.GetApoyos24Horas();
            if (ds.Tables[0].Rows.Count == 0)
            {
                Boletin.OpenSubreport("Apoyos").ReportDefinition.Sections["DetailSection1"].SectionFormat.EnableSuppress
                    = true;
            }

            Boletin.OpenSubreport("Apoyos").SetDataSource(ds);

            // textos
#if CBQN
            const string text = "CUERPO DE BOMBEROS QUINTA NORMAL";
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Titulo"]).Text =
                string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Titulo"]).Text, text,
                              hora.ToShortTimeString());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Introduccion"]).Text =
                string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Introduccion"]).Text,
                              hora.ToShortTimeString());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Finaliza"]).Text =
                string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Finaliza"]).Text,
                              hora.ToShortTimeString());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Total"]).Text =
                string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Total"]).Text,
                              exp.GetAlarmas24Horas());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Saludo"]).Text = hora.IsDaylightSavingTime()
                                                                                       ? "BUENAS TARDES"
                                                                                       : "BUENAS NOCHES";
            ((TextObject)Boletin.ReportDefinition.ReportObjects["MaterialFueraServicio"]).Text +=
                ObtenerCarrosFueraServicio(); //new z_carros().Getz_carrosFueraServicio();
            ((TextObject)Boletin.ReportDefinition.ReportObjects["OficialGuardia"]).Text +=
                new z_guardia().getObjectz_guardia("OFICIAL DE GUARDIA").oficial;
#elif CBMS
            const string text = "CUERPO DE BOMBEROS METROPOLITANO SUR";
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Titulo"]).Text                 = string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Titulo"]).Text, hora.ToShortTimeString());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Introduccion"]).Text           = string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Introduccion"]).Text, text, hora.ToShortTimeString());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Finaliza"]).Text               = string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Finaliza"]).Text, hora.ToShortTimeString());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Total"]).Text                  = string.Format(((TextObject)Boletin.ReportDefinition.ReportObjects["Total"]).Text, exp.GetAlarmas24Horas());
            ((TextObject)Boletin.ReportDefinition.ReportObjects["Saludo"]).Text                 = hora.IsDaylightSavingTime() ? "BUENAS TARDES" : "BUENAS NOCHES";
            ((TextObject)Boletin.ReportDefinition.ReportObjects["MaterialFueraServicio"]).Text += ObtenerCarrosFueraServicio();//new z_carros().Getz_carrosFueraServicio();
            ((TextObject)Boletin.ReportDefinition.ReportObjects["OficialGuardia"]).Text        += new z_guardia().getObjectz_guardia("OFICIAL DE GUARDIA").oficial;
#endif
        }
Esempio n. 17
0
 private void comboTipoLlamado_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (comboTipoLlamado.SelectedIndex != -1)
     {
         // llenar combo de 0-5
         DataSet ds = new e_expedientes().Gete_expedientes_codigoprincipal((int)comboTipoLlamado.SelectedValue);
         comboDireccion.DisplayMember = "esquina";
         comboDireccion.ValueMember   = "id_expediente";
         comboDireccion.DataSource    = ds.Tables[0];
     }
 }
Esempio n. 18
0
        private static void CheckBatallon(int id_expediente, IEnumerable <int> id_carros)
        {
            var exp = new e_expedientes();

            exp = exp.getObjecte_expedientes(id_expediente);
            List <int> s;
            int        id_mayor = 0;
            var        cu       = new e_carros_usados();

            // no hay batallones para áreas
            if (exp.id_area == 0)
            {
                return;
            }
            // revisar si esta combinación de carros+los actuales superan un batallón

            var     llam = new z_llamados();
            DataSet ds   = llam.Getz_llamados_incendio();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                // cantidad de carros
                CantidadCarros cc = ObtenerCantidadCarros(exp.id_area, (int)dr["codigo_llamado"], out s);
                var            ca = new CantidadCarros();
                // sumar
                DataSet de = cu.Gete_carros_exp(id_expediente);
                foreach (DataRow dw in de.Tables[0].Rows)
                {
                    var carro = new z_carros();
                    carro = carro.getObjectz_carros((int)dw["id_carro"]);
                    ca.Cantidad[carro.id_tipo_carro - 1]++;
                }
                // carros actuales
                foreach (int i in id_carros)
                {
                    var carro = new z_carros();
                    carro = carro.getObjectz_carros(i);
                    ca.Cantidad[carro.id_tipo_carro - 1]++;
                }
                // comparar
                if (ca >= cc)
                {
                    id_mayor = (int)dr["codigo_llamado"];
                }
            }
            if (id_mayor != 0)
            {
                // avisar
                MessageBox.Show("Se han superado los carros para un batallón. Se cambiará la clave.");
                // cambiar clave
                exp.codigo_principal = id_mayor;
                exp.Update(exp);
            }
        }
 private void CargarDatos()
 {
     try
     {
         DataSet ds = new e_expedientes().Gete_expedientes_cerrados(dateDesde.Value, dateHasta.Value.AddDays(1));
         dataExpedientes.DataSource = ds.Tables[0];
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Esempio n. 20
0
/*
 *      private void btnAdmin_Click(object sender, EventArgs e)
 *      {
 *          new GeoAdmin().ShowDialog();
 *      }
 */

        private void Agenda_Load(object sender, EventArgs e)
        {
            Icon = Icon.FromHandle(Resources.Agenda.GetHicon());

            var exp = new e_expedientes();

            Expedientes = exp.Gete_expedientes();
            comboExpedientes.DisplayMember = "clave_dir";
            comboExpedientes.ValueMember   = "id_expediente";
            comboExpedientes.DataSource    = Expedientes.Tables[0];
            comboExpedientes.SelectedValue = zeusWin.IdExpediente;
            FillCombos();
        }
 private void EditarExpediente_Load(object sender, EventArgs e)
 {
     try
     {
         informacionExpediente1.ComunasDataSource = new k_comuna().Getk_comuna().Tables[0];
         e_expedientes exp = new e_expedientes().getObjecte_expedientes(id_expediente);
         informacionExpediente1.Expediente = exp;
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Esempio n. 22
0
        public static List <int> Despachar(int id_expediente, int id_area)
        {
            // 6
            var sinDespacho      = new List <int>();
            var idDespacho       = new List <int>();
            var compañias_usadas = new List <int>();

            // tipos de carro
            try
            {
                var exp = new e_expedientes();
                exp = exp.getObjecte_expedientes(id_expediente);
                int codigo_llamado = exp.codigo_llamado;
                // id area

                CantidadCarros cantidad = ObtenerCantidadCarros(id_area, codigo_llamado, out idDespacho);

                OrdenarCarros(cantidad, codigo_llamado);
                for (int i = 0; i < cantidad.Cantidad.GetLength(0); i++)
                {
                    while (cantidad.Cantidad[i] > 0)
                    {
                        // obtener carro
#if CBMS
                        z_carros carro = ObtenerCarro(cantidad.Id_tipo[i], id_area);
#elif CBQN
                        z_carros carro = ObtenerCarro(cantidad.Id_tipo[i], id_area, false, compañias_usadas);
#endif
                        if (carro.id_carro != 0)
                        {
                            idDespacho.Add(carro.id_carro);
                            cantidad.Cantidad[i]--;
                            compañias_usadas.Add(carro.id_compania);
                        }
                        else
                        {
                            sinDespacho.Add(cantidad.Id_tipo[i]);
                            break;
                        }
                    }
                }
                // Ejecutar casos especiales de despacho
                CasosEspecialesDespacho.Ejecutar(exp, idDespacho);
            }
            catch (Exception e)
            {
                Log.ShowAndLog(e);
            }
            return(idDespacho);
        }
Esempio n. 23
0
        private void btnExpedientes_Click(object sender, EventArgs e)
        {
            // crear menú con expedientes
            var     menu = new ContextMenuStrip();
            DataSet ds   = new e_expedientes().Gete_expedientes_operadora(0);

            foreach (DataRow dr in ds.Tables[0].Select("", "fecha desc"))
            {
                var tm = new ToolStripMenuItem(dr["clave"] + " " + dr["seis2"] + " / " + dr["cero5"], null,
                                               onMenuClick);
                tm.Tag = dr["id_expediente"];
                menu.Items.Add(tm);
            }
            menu.Show(btnExpedientes, 0, btnExpedientes.Height);
        }
        private void AdminCorrelativos_Load(object sender, EventArgs e)
        {
            // mostrar valores actuales
            try
            {
                var exp = new e_expedientes();

                textCorrelativoExp.Text    = exp.GetCorrelativoExp().ToString();
                textCorrelativoIIOO.Text   = exp.GetCorrelativoIIOO().ToString();
                textCorrelativoRedTIC.Text = exp.GetCorrelativoRedTIC().ToString();
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
        private void CarroEspecialidad_Load(object sender, EventArgs e)
        {
            Icon = Icon.FromHandle(Resources.asignacion_carro_especialidad_32.GetHicon());
            var     llam = new z_llamados();
            DataSet ds   = llam.Getz_llamados_principal();

            comboClaves.DataSource = ds.Tables[0];

            // expediente seleccionado
            if (ZeusWin.IdExpediente != 0)
            {
                e_expedientes exp = new e_expedientes().getObjecte_expedientes(zeusWin.IdExpediente);
                comboClaves.SelectedValue     = exp.codigo_principal;
                comboExpediente.SelectedValue = exp.id_expediente;
            }
        }
Esempio n. 26
0
        public void MostrarInfo(int idExpediente)
        {
            id_expediente = idExpediente;
            var exp = new e_expedientes();

            try
            {
                exp = exp.getObjecte_expedientes(idExpediente);
                // expediente
                id_area = exp.id_area;
                informacionExpediente1.Expediente = exp;
                RecursosEstaticos.IdExpediente    = exp.id_expediente;

                // oficial a cargo
                if (exp.id_voluntario != 0)
                {
                    z_cargos cargo = new z_cargos().getObjectz_cargos(exp.id_voluntario);
                    var      vol   = new z_voluntarios();
                    vol            = vol.getObjectz_voluntarios(exp.id_voluntario);
                    btnACargo.Text = cargo.id_voluntario != 0 ? cargo.llamado_oficial.ToString() : vol.num_llamado.ToString();
                }
                else
                {
                    btnACargo.Text = "Ninguno";
                }

                // frecuencia
                e_frecuencias freq = new e_frecuencias().getObjecte_frecuencias(exp.id_frecuencia);
                btnFrecuencia.Text      = freq.frecuencia;
                btnFrecuencia.BackColor = Color.FromArgb(freq.color);

                if (id_expediente_asignado == idExpediente)
                {
                    btnDespachar.Blink     = true;
                    id_expediente_asignado = 0;
                }
                else
                {
                    btnDespachar.Blink = false;
                }
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
        private void LlenarCamposIniciales()
        {
            e_expedientes exp = new e_expedientes();

            exp = exp.getObjecte_expedientes(Zeus.Util.RecursosEstaticos.IdExpediente);

            txtDia.Text  = exp.fecha.ToString("dd");
            txtMes.Text  = exp.fecha.ToString("MM");
            txtAnio.Text = exp.fecha.ToString("yyyy");

            txtHoraInicio.Text = exp.fecha.ToString("hh:MM");

            txtDireccionServicio.Text = exp.cero5;
            txtEsquinaServicio.Text   = exp.seis2;

            ddlComunaEmergencia.Text = exp.comuna;
        }
 private void MostrarEnMapa(int id)
 {
     lock (lockIdExpediente)
     {
         if ((int)lockIdExpediente == id)
         {
             return;
         }
         Cursor current = Cursor.Current;
         Cursor.Current = Cursors.WaitCursor;
         e_expedientes exp = new e_expedientes().getObjecte_expedientes(id);
         PlugData.ZoomToPoint(new PointD(exp.puntoX, exp.puntoY));
         PlugData.DrDireccion = MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList);
         MapWin.View.Draw.DrawCircle(exp.puntoX, exp.puntoY, 10, Color.Red, true);
         lockIdExpediente = id;
         Cursor.Current   = current;
     }
 }
Esempio n. 29
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. 30
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            e_expedientes exp = new e_expedientes().getObjecte_expedientes(id_expediente);

            //exp.id_voluntario = (int) dr[0]["id_voluntario"];
            exp.cargo_llamado = textNumero.Text;
            exp.Update(exp);
            //num_llamado = d;
            DialogResult = DialogResult.OK;
            Close();

            /*
             * int d;
             * if (int.TryParse(textNumero.Text, out d))
             * {
             *  try
             *  {
             *      DataRow[] dr = new z_cargos().Getz_cargos().Tables[0].Select("llamado_oficial=" + d);
             *      if (dr.Length > 0)
             *      {
             *          e_expedientes exp = new e_expedientes().getObjecte_expedientes(id_expediente);
             *          exp.id_voluntario = (int) dr[0]["id_voluntario"];
             *          exp.Update(exp);
             *          num_llamado = d;
             *          DialogResult = DialogResult.OK;
             *          Close();
             *      }
             *      else
             *      {
             *          MessageBox.Show("El número introducido no corresponde a un oficial válido", "Mensaje de Zeus");
             *      }
             *  }
             *  catch (Exception ex)
             *  {
             *      Log.ShowAndLog(ex);
             *  }
             * }
             * else
             * {
             *  MessageBox.Show("Debe introducir un número válido", "Mensaje de Zeus");
             * }
             */
        }