private void AceptarButton_Click(object sender, EventArgs e) { if (lstReturnType.SelectedIndex == -1) { MessageBox.Show("Se debe seleccionar el tipo retorno", Program.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ReturnDataTypeComboBox.SelectedIndex == -1) { MessageBox.Show("Se debe seleccionar el tipo de dato a retornar", Program.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (_returnRow == null) { _returnRow = DtsDataBase.TBL_SP_Return.NewTBL_SP_ReturnRow(); _returnRow.fk_Object = _selectedObject.id_Object; DtsDataBase.TBL_SP_Return.AddTBL_SP_ReturnRow(_returnRow); } _returnRow.Return_Type = lstReturnType.SelectedItem.ToString(); switch ((CMData.Schemas.ReturnType)(Enum.Parse(typeof(CMData.Schemas.ReturnType), lstReturnType.SelectedItem.ToString()))) { case CMData.Schemas.ReturnType.TablaGenerica: DtsDataBase.TBL_SP_Return.RemoveTBL_SP_ReturnRow(_returnRow); break; case CMData.Schemas.ReturnType.Escalar: _returnRow.SetSchema_Name_ReturnedNull(); _returnRow.SetObject_Name_ReturnedNull(); _returnRow.Data_Type_Returned = ReturnDataTypeComboBox.SelectedItem.ToString(); break; case CMData.Schemas.ReturnType.TablaTipada: var idObj = (int)(((ComboBoxListItem)(ReturnDataTypeComboBox.SelectedItem)).Value); var returns = (CMData.Schemas.XsdDataBase.TBL_ObjectRow[])(DtsDataBase.TBL_Object.Select("id_Object = " + idObj)); _returnRow.Schema_Name_Returned = returns[0].Schema_Name; _returnRow.Object_Name_Returned = returns[0].Object_Name; _returnRow.Data_Type_Returned = DbType.Object.ToString(); break; case CMData.Schemas.ReturnType.Nada: _returnRow.SetSchema_Name_ReturnedNull(); _returnRow.SetObject_Name_ReturnedNull(); _returnRow.Data_Type_Returned = DbType.Object.ToString(); break; } DialogResult = DialogResult.OK; this.Close(); }
private void FormConfigStoredProcedure_Load(object sender, EventArgs e) { if (_dtsDataBase == null) { MessageBox.Show("No es posible configurar los filtros del objeto, utilice la función SetDataSource ", Program.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.Abort; Close(); return; } if (_selectedObject == null) { MessageBox.Show("Seleccione primero el procedimiento almacenado ", Program.AssemblyTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); DialogResult = DialogResult.Abort; Close(); return; } IgnoreSelectedIndexChanged = true; // ReSharper disable CoVariantArrayConversion lstReturnType.Items.AddRange(Enum.GetNames(typeof(CMData.Schemas.ReturnType))); // ReSharper restore CoVariantArrayConversion var spRows = (CMData.Schemas.XsdDataBase.TBL_SP_ReturnRow[])(DtsDataBase.TBL_SP_Return.Select("fk_Object = " + _selectedObject.id_Object)); if (spRows.Length > 0) { _returnRow = spRows[0]; lstReturnType.SelectedItem = _returnRow.Return_Type; if (_returnRow.IsObject_Name_ReturnedNull()) { FillReturnDataType(_returnRow.Data_Type_Returned, "", ""); } else { FillReturnDataType(_returnRow.Data_Type_Returned, _returnRow.Schema_Name_Returned, _returnRow.Object_Name_Returned); } } else { lstReturnType.SelectedItem = CMData.Schemas.ReturnType.TablaGenerica.ToString(); FillReturnDataType(); } IgnoreSelectedIndexChanged = false; }