private void btn_aceptar_Click(object sender, EventArgs e) { if (CheckIntegrity()) { DialogResult _decision = MessageBox.Show("¿Todos los datos son correctos?", "", MessageBoxButtons.YesNo); if (_decision == DialogResult.Yes) { Proyecto _proyecto = new Proyecto() { Id = _obra.idobra, Nombre = _obra.nombre, Cod = _obra.codigo, Localizacion = _obra.localizacion, Superficie_Parcela = double.Parse(txt_superficieParcela.Text), Categoria = Convert.ToInt32(numeric_categoria.Value), Cant_Habitaciones = Convert.ToInt32(numeric_cantHabitaciones.Value), Tipo_Hotel = cmb_TipoHotel.Text, Subtipo_Alojamiento = cmb_SubtipoAlojamiento.Text, Tipo_Alojamiento = cmb_TipoAlojamiento.Text, Maxima_Altura = Convert.ToInt32(numeric_MaximaAltura.Value) }; new DB_BIM().AddElemento <Proyecto>(typeof(Proyecto), _proyecto); Form _managementForm = new ProjectManagementForm(_proyecto); _managementForm.ShowDialog(); this.Hide(); } } else { MessageBox.Show("Existen datos incompletos"); } }
void MostrarDetalles(object sender, EventArgs e) { if (ProyectoController.IsNewProject(obra.idobra)) { Form _addProject = new AddProjectForm(obra); _addProject.ShowDialog(); } else { var _proyecto = ProyectoController.UpdateProyecto(obra); Form _projectManagement = new ProjectManagementForm(_proyecto); _projectManagement.ShowDialog(); } }
public ProjectManagementForm(Proyecto proyecto) { InitializeComponent(); //gridControl1.ForceInitialize(); _proyecto = new DB_BIM().GetSingleElement <Proyecto>(x => x.Id == proyecto.Id); this.Text = string.Format("{0} - {1}", _proyecto.Cod, _proyecto.Nombre); backgroundWorker1.WorkerReportsProgress = true; txt_nombre.Text = _proyecto.Nombre; txt_codigo.Text = _proyecto.Cod; txt_Localizacion.Text = _proyecto.Localizacion; txt_tipoAlojamiento.Text = _proyecto.Tipo_Alojamiento; txt_subtipoAlojamiento.Text = _proyecto.Subtipo_Alojamiento; txt_TipoHotel.Text = _proyecto.Tipo_Hotel; numeric_cantHabitaciones.Value = Convert.ToDecimal(_proyecto.Cant_Habitaciones); numeric_Categoria.Value = Convert.ToDecimal(_proyecto.Categoria); numeric_MaximaAltura.Value = Convert.ToDecimal(_proyecto.Maxima_Altura); _projectManagementForm = this; var _locales = new DB_PLANTILLA().GetAllRecords <T_Local>(); foreach (var item in _locales) { cmb_LocalTipo.Items.Add(item.Key_Name); } //var _desgloses = new DB_BIM().GetElements<Desglose>(x => x.Proyecto == _proyecto.Id); var _desgloses = new DB_BIM().GetElements <Desglose>(x => x.Proyecto == _proyecto.Id).GroupBy(x => x.Value).Select(x => x.FirstOrDefault()).OrderBy(x => x.Value).ToList();; cmb_Desglose.Items.Clear(); foreach (var item in _desgloses) { cmb_Desglose.Items.Add(item.Value); } }