Exemplo n.º 1
0
 private void CargarComandantesGuardia()
 {
     // cargar comandantes de guardia
     try
     {
         tableLayoutPanel1.Controls.Clear();
         tableLayoutPanel1.ColumnCount = 1;
         DataSet ds = new z_guardia().Getz_guardia();
         int     i  = 0;
         foreach (DataRow dr in ds.Tables[0].Rows)
         {
             if ((bool)dr["mostrar"] != true)
             {
                 continue;
             }
             var l = new Label {
                 AutoSize = true, Text = ((string)dr["oficial"])
             };
             var ll = new LinkLabel {
                 Text = ((string)dr["tipo_oficial"]), Tag = dr["responsabilidades"]
             };
             ll.Click   += delegate { MessageBox.Show((string)ll.Tag, "Responsabilidades para este Oficial"); };
             ll.AutoSize = true;
             tableLayoutPanel1.ColumnCount++;
             tableLayoutPanel1.Controls.Add(ll, 0, i);
             tableLayoutPanel1.Controls.Add(l, 1, i);
             i++;
         }
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Exemplo n.º 2
0
 private void AdminGuardia_Load(object sender, EventArgs e)
 {
     try
     {
         DataSet ds = new z_guardia().Getz_guardia();
         listActuales.DisplayMember = "tipo_oficial";
         listActuales.ValueMember   = "id_guardia";
         Source = ds.Tables[0];
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Exemplo n.º 3
0
 protected override void Mostrar(int id)
 {
     try
     {
         z_guardia guardia = new z_guardia().getObjectz_guardia(id);
         textTipoOficial.Text       = guardia.tipo_oficial;
         textOficial.Text           = guardia.oficial;
         textResponsabilidades.Text = guardia.responsabilidades;
         checkMostrar.Checked       = guardia.mostrar;
     }
     catch (Exception ex)
     {
         Log.ShowAndLog(ex);
     }
 }
Exemplo n.º 4
0
 protected override void Actualizar()
 {
     try
     {
         z_guardia guardia = new z_guardia().getObjectz_guardia((int)listActuales.SelectedValue);
         guardia.tipo_oficial      = textTipoOficial.Text;
         guardia.oficial           = textOficial.Text;
         guardia.responsabilidades = textResponsabilidades.Text;
         guardia.mostrar           = checkMostrar.Checked;
         guardia.modifyz_guardia(guardia);
         MessageBox.Show("Operación realizada correctamente.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Source = guardia.Getz_guardia().Tables[0];
     }
     catch (Exception e)
     {
         Log.ShowAndLog(e);
     }
 }
Exemplo n.º 5
0
 protected override void Insertar()
 {
     try
     {
         var guardia = new z_guardia
         {
             tipo_oficial      = textTipoOficial.Text,
             oficial           = textOficial.Text,
             responsabilidades = textResponsabilidades.Text,
             mostrar           = checkMostrar.Checked
         };
         guardia.addz_guardia(guardia);
         MessageBox.Show("Operación realizada correctamente.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Source = guardia.Getz_guardia().Tables[0];
     }
     catch (Exception e)
     {
         Log.ShowAndLog(e);
     }
 }