コード例 #1
0
        private void Guardar_Via()
        {
            BLL.Tables.MED_VIA      _via  = new BLL.Tables.MED_VIA();
            Entities.Tables.MED_VIA _item = new Entities.Tables.MED_VIA();

            for (int i = 0; i < this.dataGridViewVias.Rows.Count - 0; i++)
            {
                _item.VIA_ID      = Convert.ToInt32(dataGridViewVias.Rows[i].Cells[(int)Col_Via.VIA_ID].Value);
                _item.DESCRIPCION = dataGridViewVias.Rows[i].Cells[(int)Col_Via.VIA].Value.ToString();
                DataGridViewCheckBoxCell cellSelecion = dataGridViewVias.Rows[i].Cells[(int)Col_Via.INACTIVO] as DataGridViewCheckBoxCell;
                if (Convert.ToBoolean(cellSelecion.Value) == true)
                {
                    _item.INACTIVO = true;
                }
                else
                {
                    _item.INACTIVO = false;
                }

                _via.UpdateItem(_item);
            }

            MessageBox.Show("Se actualizaron todas las vías", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
            Get_Via(inactivo);
        }
コード例 #2
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     try
     {
         BLL.Tables.MED_VIA      _via  = new BLL.Tables.MED_VIA();
         Entities.Tables.MED_VIA _item = new Entities.Tables.MED_VIA();
         _item.DESCRIPCION = txtAgregar.Text.ToUpper();
         _via.AddItem(_item);
         MessageBox.Show("Se agrego correctamente la vía", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Get_Via(inactivo);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }