private void AdminOficiales_Load(object sender, EventArgs e)
        {
            try
            {
                // agregar cargos oficiales
                DataSet c_oficiales = new z_oficiales().Getz_oficialesVisibles();
                comboCargos.DisplayMember = "tipo";
                comboCargos.ValueMember   = "id_oficial";
                comboCargos.DataSource    = c_oficiales.Tables[0];

                listNombres.DisplayMember = "Key";
                listNombres.ValueMember   = "Value";

                var vol = new z_voluntarios();
                ds      = vol.Getz_voluntarios();
                nombres = new List <object>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    var p =
                        new KeyValuePair <string, int>((string)dr["apellidos"] + " " + dr["nombres"],
                                                       (int)dr["id_voluntario"]);
                    nombres.Add(p);
                }
                listNombres.Items.Clear();
                listNombres.Items.AddRange(nombres.ToArray());

                listActuales.DisplayMember = "nombre_completo";
                listActuales.ValueMember   = "id_cargo";
                Source = new z_cargos().Getz_cargosLista().Tables[0];
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
예제 #2
0
        private void textNombres_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                var cond = new z_conductores();
                cond = cond.getObjectz_conductores(textNombres.Text);
                switch (cond.id_tipo_conductor)
                {
                case 1:
                    z_cuarteleros cuart = new z_cuarteleros().getObjectz_cuarteleros(cond.id_cuart_vol);
                    textNombres.Text         = cuart.apellidos + " " + cuart.nombres;
                    listNombres.SelectedItem = cuart.apellidos + " " + cuart.nombres;
                    break;

                case 2:
                    z_voluntarios vol = new z_voluntarios().getObjectz_voluntarios(cond.id_cuart_vol);
                    textNombres.Text         = vol.apellidos + " " + vol.nombres;
                    listNombres.SelectedItem = vol.apellidos + " " + vol.nombres;
                    break;

                default:
                    break;
                }
            }
        }
예제 #3
0
        protected override void Actualizar()
        {
            try
            {
                z_voluntarios vol = new z_voluntarios().getObjectz_voluntarios((int)listActuales.SelectedValue);
                vol.rut = textRut.Text;
                vol.fecha_nacimiento = DateTime.Parse(textFechaNac.Text);
                vol.apellidos        = textApellidos.Text;
                vol.nombres          = textNombres.Text;
                //vol.tipo_sangre = textSangre.Text;
                //vol.alergia = textAlergia.Text;
                //vol.padece = textPadece.Text;
                //pictureFoto.Image = null;

                vol.direccion   = textDireccion.Text;
                vol.comuna      = textComuna.Text;
                vol.telefono    = textFono.Text;
                vol.celular     = textMovil.Text;
                vol.id_compania = (int)((DataRowView)comboCompania.SelectedItem).Row["id_compania"];
                vol.ingreso     = DateTime.Parse(textFechaIng.Text);
                vol.num_llamado = int.Parse(textNumLlamado.Text);
                //#f
                vol.urlimagen = UrlImagen;
                //#f
                //vol.modifyz_voluntarios(vol, pictureFoto.ImageLocation);
                vol.modifyz_voluntarios(vol, null);
                MessageBox.Show("Operación realizada correctamente.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
예제 #4
0
        //#f
        protected override void Insertar()
        {
            try
            {
                var vol = new z_voluntarios
                {
                    rut = textRut.Text,
                    fecha_nacimiento = DateTime.Parse(textFechaNac.Text),
                    apellidos        = textApellidos.Text,
                    nombres          = textNombres.Text,
                    direccion        = textDireccion.Text,
                    comuna           = textComuna.Text,
                    telefono         = textFono.Text,
                    celular          = textMovil.Text,
                    id_compania      = ((int)((DataRowView)comboCompania.SelectedItem).Row["id_compania"]),
                    ingreso          = DateTime.Parse(textFechaIng.Text),
                    num_llamado      = int.Parse(textNumLlamado.Text),
                    urlimagen        = UrlImagen
                };

                vol.addz_voluntarios(vol, pictureFoto.ImageLocation);
                Source = vol.Getz_voluntariosLista().Tables[0];
                MessageBox.Show("Operación realizada correctamente.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
        public static string ObtieneNombreDeConductor(int id_conductor, int tipo_conductor)
        {
            string        NombeConductor = "";
            string        reqSQL         = "";
            z_cuarteleros zcuarteleros   = new z_cuarteleros();
            z_voluntarios zvoluntarios   = new z_voluntarios();

            var myBase   = new CnxBase();
            var myD4MCnx = new CnxBase();

            if (tipo_conductor == 1)
            {
                //reqSQL = "SELECT nombres||' '||apellidos As nombre_completo FROM z_cuarteleros WHERE id_cuartelero=" + id_conductor + "";
                reqSQL = "SELECT nombres||' '||apellidos As nombre_completo FROM z_cuarteleros WHERE id_cuartelero IN (SELECT id_cuart_vol FROM z_conductores WHERE id_conductor=" + id_conductor + ")";
            }
            else
            {
                reqSQL = "SELECT nombres||' '||apellidos As nombre_completo FROM z_voluntarios WHERE id_voluntario IN (SELECT id_cuart_vol FROM z_conductores WHERE id_conductor=" + id_conductor + ")";
            }
            try
            {
                DataSet myResult = myD4MCnx.GetDataSet(reqSQL);
                foreach (DataRow r_conductor in myResult.Tables[0].Rows)
                {
                    NombeConductor = Convert.ToString(r_conductor["nombre_completo"]);
                }
            }
            catch (Exception myErr)
            {
                throw (new Exception(myErr + reqSQL));
            }
            return(NombeConductor);
        }
예제 #6
0
 protected override void Eliminar()
 {
     try
     {
         var vol = new z_voluntarios();
         vol.deletez_voluntarios((int)listActuales.SelectedValue);
         Source = vol.Getz_voluntariosLista().Tables[0];
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
예제 #7
0
        private void FillVoluntarios()
        {
            DataSet set = new z_voluntarios().Getz_voluntarios();

            nombres = new List <object>();
            foreach (DataRow dr in set.Tables[0].Rows)
            {
                var p =
                    new KeyValuePair <string, int>((string)dr["apellidos"] + " " + dr["nombres"],
                                                   (int)dr["id_voluntario"]);
                nombres.Add(p);
            }
            listNombres.Items.Clear();
            listNombres.Items.AddRange(nombres.ToArray());
        }
예제 #8
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);
            }
        }
예제 #9
0
 private void AdminVoluntarios_Load(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new z_voluntarios().Getz_voluntariosLista();
         listActuales.DisplayMember = "nombre_completo";
         listActuales.ValueMember   = "id_voluntario";
         Source = ds.Tables[0];
         comboCompania.DisplayMember = "id_compania";
         comboCompania.ValueMember   = "id_compania";
         comboCompania.DataSource    = new z_companias().Getz_companias().Tables[0];
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
예제 #10
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            int d;

            if (int.TryParse(textNum.Text, out d))
            {
                // buscar
                var       cargo = new z_cargos();
                DataRow[] dr    = cargo.Getz_cargos().Tables[0].Select("llamado_oficial=" + d);
                if (dr.GetLength(0) == 0)
                {
                    listInt.Items.Clear();
                    Interinos.Clear();
                    textNombre.Text       = "";
                    comboInter.DataSource = null;
                    comboInter.Enabled    = false;
                    return;
                }
                cargo = cargo.getObjectz_cargos((int)dr[0]["id_cargo"]);
                if (cargo.id_voluntario != 0)
                {
                    // mostrar nombre
                    z_voluntarios vol = new z_voluntarios().getObjectz_voluntarios(cargo.id_voluntario);
                    textNombre.Text = vol.apellidos + " " + vol.nombres;
                    //obtener y mostrar interinos
                    Interinos = Interinaje.ObtenerInterinaje(cargo);
                    listInt.Items.Clear();
                    foreach (Interinaje.Interino i in Interinos)
                    {
                        cargo = cargo.getObjectz_cargos(i.Reemplazo);
                        vol   = vol.getObjectz_voluntarios(cargo.id_voluntario);
                        var item = new ListViewItem(vol.apellidos + " " + vol.nombres);
                        cargo = cargo.getObjectz_cargos(i.Oficial);
                        vol   = vol.getObjectz_voluntarios(cargo.id_voluntario);
                        item.SubItems.Add(vol.apellidos + " " + vol.nombres);
                        listInt.Items.Add(item);
                    }

                    // combo
                    comboInter.DataSource = vol.Getz_voluntarios(-Interinos[Interinos.Count - 1].Reemplazo).Tables[0];
                    comboInter.Enabled    = true;
                }
            }
        }
예제 #11
0
        protected override void Mostrar(int id)
        {
            try
            {
                z_voluntarios vol = new z_voluntarios().getObjectz_voluntarios(id);
                textRut.Text       = vol.rut;
                textFechaNac.Text  = vol.fecha_nacimiento.ToShortDateString();
                textApellidos.Text = vol.apellidos;
                textNombres.Text   = vol.nombres;
                //textSangre.Text = vol.tipo_sangre;
                //textAlergia.Text = vol.alergia;
                //textPadece.Text = vol.padece;

                //#f   Comentar estas 3 Lineas
                //Image img = vol.getImagen(id);
                //pictureFoto.Image = img ?? Resources.cbms2;   //cbqn_logo;
                //pictureFoto.ImageLocation = null;

                //#f
                if (System.IO.File.Exists(vol.urlimagen))
                {
                    pictureFoto.ImageLocation = vol.urlimagen == string.Empty ? @"C:\ZEUS\Resources\Voluntarios\comodin.jpg" : vol.urlimagen;
                }
                else
                {
                    pictureFoto.ImageLocation = @"C:\ZEUS\Resources\Voluntarios\comodin.jpg";
                }


                textDireccion.Text          = vol.direccion;
                textComuna.Text             = vol.comuna;
                textFono.Text               = vol.telefono;
                textMovil.Text              = vol.celular;
                comboCompania.SelectedValue = vol.id_compania;
                textFechaIng.Text           = vol.ingreso.ToShortDateString();
                textNumLlamado.Text         = vol.num_llamado.ToString();
            }
            catch (Exception ex)
            {
                Log.ShowAndLog(ex);
            }
        }
예제 #12
0
 private void FillVoluntarios(int compania)
 {
     try
     {
         var vol = new z_voluntarios();
         ds      = compania == 0 ? vol.Getz_voluntarios() : vol.Getz_voluntarios(compania);
         nombres = new List <object>();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             var p =
                 new KeyValuePair <string, int>((string)dr["apellidos"] + " " + dr["nombres"],
                                                (int)dr["id_voluntario"]);
             nombres.Add(p);
         }
         listNombres.Items.Clear();
         listNombres.Items.AddRange(nombres.ToArray());
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
예제 #13
0
        //public static void InterinajeComandante(int id_cargo, int id_teniente3)
        //{
        //    // obtener reemplazo comandante
        //    // investigar como actualizar dataset
        //    // ojo: mover TODOS hacia arriba
        //    // oficiales inactivos en algun lado
        //    z_cargos cargo = new z_cargos().getObjectz_cargos(id_cargo);
        //    // desactivar
        //    cargo.activo = false;
        //    cargo.modifyz_cargos(cargo);

        //    DataSet ds = cargo.getReemplazo(cargo.grado, cargo.orden_antiguedad);
        //    z_cargos ultimo;
        //    //if (reemp.id_cargo!=0)
        //    //{
        //    //    // se obtuvo reemplazo, mover hacia arriba en su escalafon

        //    //}
        //    if (ds.Tables[0].Rows.Count==0)
        //    {
        //        // ultimo
        //        ultimo = cargo;
        //    }
        //    else
        //    {
        //        foreach (DataRow dr in ds.Tables[0].Rows)
        //        {
        //            dr["grado_int"] = cargo.grado;
        //            dr["antiguedad_int"] = ++cargo.cargo_antiguedad;
        //            ultimo = cargo.getObjectz_cargos((int)dr["id_cargo"]);
        //            // todo: commit changes
        //        }
        //    }


        //    // obtener capitan


        //    // teniente primero

        //    // teniente segundo

        //    // teniente 3º elegido

        //}

        public static List <Interino> ObtenerInterinaje(z_cargos cargo)
        {
            List <Interino> ints = new List <Interino>();
            z_cargos        c;

            switch (cargo.grado)
            {
            case 1:
                // comandante de reemplazo
                do
                {
                    c = cargo.getComandanteReemplazo(cargo.orden_antiguedad);
                    if (c.id_cargo == 0)
                    {
                        // no hay, buscar y agregar capitan
                        z_cargos cap = cargo.getCapitanAntiguo();
                        // se asume que hay de todo!!!
                        ints.Add(new Interino(cargo.id_cargo, cap.id_cargo));
                        cargo = cap;
                    }
                    else
                    {
                        // hay, agregar
                        ints.Add(new Interino(cargo.id_cargo, c.id_cargo));
                        cargo = c;
                    }
                } while (c.id_cargo != 0);
                // recursiva
                ints.AddRange(ObtenerInterinaje(cargo));
                break;

            case 40:
                // se reemplaza capitan
                z_voluntarios vol = new z_voluntarios().getObjectz_voluntarios(cargo.id_voluntario);
                c = cargo.getz_cargos(100, vol.id_compania);
                // agregar
                ints.Add(new Interino(cargo.id_cargo, c.id_cargo));
                // recursiva
                ints.AddRange(ObtenerInterinaje(c));
                break;

            case 100:
                // se reemplaza 1° tte
                z_voluntarios vol2 = new z_voluntarios().getObjectz_voluntarios(cargo.id_voluntario);
                c = cargo.getz_cargos(200, vol2.id_compania);
                // agregar
                ints.Add(new Interino(cargo.id_cargo, c.id_cargo));
                // recursiva
                ints.AddRange(ObtenerInterinaje(c));
                break;

            case 200:
                // se reemplaza 2° tte
                z_voluntarios vol3 = new z_voluntarios().getObjectz_voluntarios(cargo.id_voluntario);
                c = cargo.getz_cargos(300, vol3.id_compania);
                // agregar
                ints.Add(new Interino(cargo.id_cargo, c.id_cargo));
                // recursiva
                ints.AddRange(ObtenerInterinaje(c));
                break;

            case 300:
                z_voluntarios vol4 = new z_voluntarios().getObjectz_voluntarios(cargo.id_voluntario);
                // -id_compania, para que no muestre nada
                ints.Add(new Interino(cargo.id_cargo, -vol4.id_compania));
                break;

            default:
                break;
            }
            return(ints);
        }