Ejemplo n.º 1
0
 private void dgvConductoresEquipoGas_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         ConductorEquipo          egc = lConductoresEquipos[e.RowIndex];
         AgregaConductorEquipoGas frm = new AgregaConductorEquipoGas();
         frm.Registro = egc;
         DialogResult r = frm.ShowDialog();
         btnConsultar_Click(null, null);
     }
 }
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (Registro == null)
     {
         Registro            = new ConductorEquipo();
         Registro.Id         = null;
         Registro.Conductor  = (Conductor)cmbConductor.SelectedItem;
         Registro.Equipo_Gas = (Equipo)cmbEquipo.SelectedItem;
     }
     Registro.FechaInicio = dteFechaInicio.Value;
     Registro.FechaFin    = dteFechaFin.Value;
     Registro.MontoDiario = Convert.ToDouble(Registro.Equipo_Gas.MontoDiario);
     Registro.CobroActivo = chkCobroActivo.Checked;
     if (!Entities.EquipoGas.ConductorEquipo.InsertaConductorEquipoGas(Registro))
     {
         MessageBox.Show("Ocurrió un error al realizar la operación.");
         return;
     }
     MessageBox.Show("El registro se guardo con éxito.");
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
     Close();
 }