private void pbxEditar_Click(object sender, EventArgs e) { if (tbxProyecto.Text != "" || tbxDescripcion.Text != "" || cb_cliente.Text != "" || comBox_supervisor.Text != "" || comBox_responsable.Text != "" || cbxServicio.Text != "" || tbxFolio.Text != "" || tbxInversión.Text != "") { if (MessageBox.Show("¿Esta seguro de realizar este cambio?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { Proyecto newProyecto = new Proyecto(); newProyecto.Id = Int16.Parse(lb_id.Text); newProyecto.Proyecto_name = tbxProyecto.Text; newProyecto.Descripcion = tbxDescripcion.Text; newProyecto.Cliente = ((KeyValuePair <int, string>)cb_cliente.SelectedItem).Key; newProyecto.Supervisor = ((KeyValuePair <int, string>)comBox_supervisor.SelectedItem).Key; newProyecto.Responsable = ((KeyValuePair <int, string>)comBox_responsable.SelectedItem).Key; newProyecto.Tipo_servicio = cbxServicio.SelectedItem.ToString(); newProyecto.Folio_volumetria = tbxFolio.Text; newProyecto.Costo_inversion = float.Parse(tbxInversión.Text); newProyecto.Fecha_inicio = dateInicio.Value.ToString("yyyy-MM-dd"); newProyecto.Fecha_asignacion = dateAsignación.Value.ToString("yyyy-MM-dd"); newProyecto.Fecha_cierre = dateCierre.Value.ToString("yyyy-MM-dd"); string resultado = Crud_Proyectos.ActualizarProyecto(newProyecto); MessageBox.Show(resultado); } } else { MessageBox.Show("Por favor ingresa todos los campos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void tbxBuscar_TextChanged(object sender, EventArgs e) { if (tbxBuscar.Text != "") { List <Proyecto> listAux = Crud_Proyectos.Read(tbxBuscar.Text); dg_proyectos.DataSource = listAux; } }
private void loadClientes() { Dictionary <int, string> comboSourceClientes = Crud_Proyectos.getClientes(); if (comboSourceClientes.Count > 0) { cb_cliente.DataSource = new BindingSource(comboSourceClientes, null); } }
private void loadSupervisor() { Dictionary <int, string> comboSourceSuper = Crud_Proyectos.getEmpleados(); if (comboSourceSuper.Count > 0) { comBox_supervisor.DataSource = new BindingSource(comboSourceSuper, null); } }
private void loadResponsables() { Dictionary <int, string> comboSource = Crud_Proyectos.getEmpleados(); if (comboSource.Count > 0) { comBox_responsable.DataSource = new BindingSource(comboSource, null); } }
private void pbxEliminar_Click(object sender, EventArgs e) { if (MessageBox.Show("¿Esta seguro de realizar este cambio?", "Salir", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes) { if (dg_proyectos.SelectedRows.Count > 0 && Int16.Parse(lb_id.Text) > 0) { string resultado = Crud_Proyectos.EliminarProyecto(Int16.Parse(lb_id.Text)); MessageBox.Show(resultado, "Info", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }