예제 #1
0
 private void CargarSectores()
 {
     try
     {
         DataSet ds = new s_sector().Gets_sector();
         flowLayoutPanel1.Controls.Clear();
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             var es = new EditSector
             {
                 IdSector    = ((int)dr["id_sector"]),
                 Descripcion = ((string)dr["descripcion"]),
                 Areas       = ((string)dr["id_areas"])
             };
             flowLayoutPanel1.Controls.Add(es);
         }
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
예제 #2
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (Validar())
     {
         // guardar cambios!
         try
         {
             foreach (Control c in flowLayoutPanel1.Controls)
             {
                 var es = c as EditSector;
                 if (es != null)
                 {
                     var sect = new s_sector
                     {
                         id_sector   = es.IdSector,
                         id_areas    = es.Areas.Replace(" ", "").Trim(','),
                         descripcion = es.Descripcion
                     };
                     if (sect.id_sector != 0)
                     {
                         sect.modifys_sector(sect);
                     }
                     else
                     {
                         sect.adds_sector(sect);
                     }
                 }
             }
             CargarSectores();
             MessageBox.Show("Operación Realizada Exitosamente.", "Mensaje de Zeus", MessageBoxButtons.OK,
                             MessageBoxIcon.Information);
         }
         catch (Exception ex)
         {
             Log.ShowAndLog(ex);
         }
     }
 }
        private void comboEspecialidad_SelectedIndexChanged(object sender, EventArgs e)
        {
            var sector = new s_sector();

            if (!checkBox1.Checked)
            {
                if (comboExpediente.SelectedIndex != -1)
                {
                    sector =
                        sector.getObjects_sector_area((int)((DataRowView)comboExpediente.SelectedItem).Row["id_area"]);
                }
                else
                {
                    MessageBox.Show("Debe seleccionar un expediente", "Error de Selección", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return;
                }
            }
            switch (comboEspecialidad.SelectedIndex)
            {
            case 0:
                var haz = new s_hazmat();
                fillCarros(haz.Gets_hazmat_sector(sector.id_sector));
                break;

            case 1:
                var mec = new s_mecanica();
                fillCarros(mec.Gets_mecanica_sector(sector.id_sector));
                break;

            case 2:
                var bom = new s_bomba();
                fillCarros(bom.Gets_bomba_sector(sector.id_sector));
                break;

            case 3:
                var res = new s_rescate();
                fillCarros(res.Gets_rescate_sector(sector.id_sector));
                break;

            case 4:
                var pa = new s_puesto_aire();
                fillCarros(pa.Gets_puesto_aire_sector(sector.id_sector));
                break;

            case 5:
                var ru = new s_rescate_urbano();
                fillCarros(ru.Gets_rescate_urbano_sector(sector.id_sector));
                break;

            case 6:
                var cis = new s_cisternas_z();
                fillCarros(cis.Gets_cisternas_z_sector(sector.id_sector));
                break;

            case 7:
                var alj = new s_aljibe();
                fillCarros(alj.Gets_aljibe_sector(sector.id_sector));
                break;

            default:
                break;
            }
        }