Example #1
0
        private void btnNuevo_Click(object sender, EventArgs e)
        {
            FormAgregarServicio frm = new FormAgregarServicio(true, false);

            AddOwnedForm(frm);
            frm.ShowDialog();
        }
Example #2
0
        private void btnEditar_Click(object sender, EventArgs e)            //Aqui estoy experimentando.....
        {
            FormAgregarServicio frm = new FormAgregarServicio(false, true); //Se crea el objeto del formulario Aux

            AddOwnedForm(frm);                                              //Se direcciona del form padre al hijo
            if (dataGridView1.SelectedRows.Count > 0)
            {
                frm.txtCV.Text = servicioBLL.CV;
                frm.IDCliente  = IDClienteDataGrid;
                frm.IDUnidad   = IDUnidadDataGrid;

                //frm.IDCliente = servicioBLL.IDCliente;
                frm.txtOrigen.Text = servicioBLL.Origen;
                //frm.IDUnidad = servicioBLL.IDUnidad;
                frm.IDAux = servicioBLL.ID;
                frm.ShowDialog();
            }
            else
            {
                MessageBox.Show("Seleccione una fila.");
            }
            #region for para ver si están vacias filas y celdas

            /////////////////////////////////////////////
            ///

            /*if (dataGridView1.RowCount > 0)
             * {
             *  bool bCampoVacio = false;
             *  foreach (DataGridViewRow dr in dataGridView1.Rows)
             *  {
             *      foreach (DataGridViewCell dc in dr.Cells)
             *      {
             *          if (dc.Value == null || string.IsNullOrEmpty(dc.Value.ToString()))
             *          {
             *              bCampoVacio = true;
             *          }
             *      }
             *  }
             *  if (bCampoVacio)
             *      MessageBox.Show("Hay algún campo vacío!. Crear nuevo Servicio.");
             * }*/
            ///////////////////////////
            #endregion
        }