public bool llenarListaLaptops() { bool flag = false; int filas = tablaLaptops.Rows.Count; for (int i = 0; i < filas; i++) { if (((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 0))).Value != null) { if (Convert.ToBoolean(((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 0))).Value.ToString()) == true) { detalle = new DevolucionDetalle(); detalle.IdLC = int.Parse(((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 9))).Value.ToString()); detalle.CodigoLC = ((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 1))).Value.ToString(); detalle.MarcaLC = ((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 2))).Value.ToString(); detalle.ModeloLC = ((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 3))).Value.ToString(); detalle.IdSalidaDetalle = int.Parse(((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 12))).Value.ToString()); detalle.IdSucursal = int.Parse(((GridCell)(dgvLaptops.PrimaryGrid.GetCell(i, 13))).Value.ToString()); detalles.Add(detalle); flag = true; } } } return(flag); }
public void Inicializado() { clienteDA = new ClienteDA(); alquilerDA = new AlquilerDA(); devolucionDA = new DevolucionDA(); devolucion = new Devolucion(); detalleTemp = new DevolucionDetalle(); dtpFechaIngreso.Value = DateTime.Now; tablaCliente = clienteDA.ListarClientes(); cmbCliente.DataSource = tablaCliente; cmbCliente.DisplayMember = "nombre_razonSocial"; cmbCliente.ValueMember = "idCliente"; cmbCliente.SelectedIndex = 0; int i = cmbCliente.SelectedIndex; int idCliente = Convert.ToInt32(tablaCliente.Rows[i]["idCliente"].ToString()); txtNroDocumento.Text = tablaCliente.Rows[i]["nroDocumento"].ToString(); tablaLaptops = devolucionDA.ListarLaptopsClientesEstadoAlquilado(idCliente); ObtenerDatosDevolucion(); devolucion.LlenarDatos(tablaLaptops); dgvLaptopsSeleccionados.PrimaryGrid.DataSource = tablaLaptops; dgvLaptopsSeleccionados.PrimaryGrid.AutoGenerateColumns = false; }
public Devolucion LlamarDevolucionModificable(int idDevolucion) { Devolucion devolucion = new Devolucion(); MySqlDataReader reader; string sql = ""; sql = "Select * From devolucion where idDevolucion=" + idDevolucion + " ;"; reader = objManager.MostrarInformacion(sql); while (reader.Read()) { devolucion.IdDevolucion = reader.GetInt32("idDevolucion"); devolucion.IdCliente = reader.GetInt32("idCliente"); devolucion.RucDni = reader.GetString("rucDni"); devolucion.GuiaDevolucion = reader.GetString("guiaDevolucion"); devolucion.FechaDevolucion = reader.GetDateTime("fechaDevolucion"); devolucion.Observacion = reader.GetString("observacion"); devolucion.Estado = reader.GetInt32("estado"); } objManager.conexion.Close(); objManager.conexion.Dispose(); objManager.cmd.Dispose(); sql = "Select * From devolucion_det where idDevolucion=" + idDevolucion + " ;"; reader = objManager.MostrarInformacion(sql); while (reader.Read()) { DevolucionDetalle det = new DevolucionDetalle(); det.IdDetalle = reader.GetInt32("idDevolucionDet"); det.IdDevolucion = reader.GetInt32("idDevolucion"); det.IdSalidaDetalle = reader.GetInt32("idSalidaDet"); det.IdSucursal = reader.GetInt32("idSucursal"); det.IdLC = reader.GetInt32("idLC"); det.CodigoLC = reader.GetString("codigoLC"); det.MarcaLC = reader.GetString("marcaLC"); det.ModeloLC = reader.GetString("modeloLC"); det.Cobrar = reader.GetInt32("pagaraCliente"); det.Danado = reader.GetInt32("danoLC"); det.Caracteristicas = reader.GetString("caracteristicas"); det.EstadoLC = reader.GetInt32("estadoLC"); det.Observacion = reader.GetString("observacion"); det.Estado = reader.GetInt32("estado"); devolucion.Detalles.Add(det); } objManager.conexion.Close(); objManager.conexion.Dispose(); objManager.cmd.Dispose(); return(devolucion); }
public void Inicializado() { clienteDA = new ClienteDA(); alquilerDA = new AlquilerDA(); devolucionDA = new DevolucionDA(); devolucion = new Devolucion(); ingresoDA = new IngresoDA(); ingreso = new Ingreso(); detalleTemp = new DevolucionDetalle(); dtpFechaIngreso.Value = DateTime.Now; tablaCliente = clienteDA.ListarClientes(); cmbCliente.DataSource = tablaCliente; cmbCliente.DisplayMember = "nombre_razonSocial"; cmbCliente.ValueMember = "idCliente"; cmbCliente.SelectedIndex = 0; int i = cmbCliente.SelectedIndex; int idCliente = Convert.ToInt32(tablaCliente.Rows[i]["idCliente"].ToString()); txtNroDocumento.Text = tablaCliente.Rows[i]["nroDocumento"].ToString(); tablaLaptops = devolucionDA.ListarLaptopsClientesEstadoAlquilado(idCliente); //=============================================== tablaSede = ingresoDA.ListarSede(); cmbSede.DataSource = tablaSede; cmbSede.DisplayMember = "nombreSede"; cmbSede.ValueMember = "idSede"; cmbSede.SelectedIndex = -1; //=============================================== ObtenerDatosDevolucion(); devolucion.LlenarDatos(tablaLaptops); dgvLaptopsSeleccionados.DataSource = tablaLaptops; vistaEquipos.OptionsBehavior.AutoPopulateColumns = false; vistaEquipos.OptionsSelection.MultiSelect = true; lblContador.Text = $"CANTIDAD REGISTRO: {devolucion.Detalles.Count.ToString()}"; }
private void btnAgregarProducto_Click(object sender, EventArgs e) { if (cmbCliente.SelectedValue == null) { MessageBox.Show("No se puede agregar productos\n si no se ha seleccionado un cliente correcto.", "◄ AVISO | LEASEIN ►", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } using (frmProcesoDevolucionAgregarProducto frm = new frmProcesoDevolucionAgregarProducto(devolucion.IdCliente)) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { BindingList <DevolucionDetalle> auxiliares = new BindingList <DevolucionDetalle>(); foreach (DevolucionDetalle aux in devolucion.Detalles) { auxiliares.Add(aux); } foreach (DevolucionDetalle detalleTraido in frm.DETALLES) { DevolucionDetalle dp = new DevolucionDetalle(); dp.IdLC = detalleTraido.IdLC; bool exists = auxiliares.Any(x => x.IdLC.Equals(dp.IdLC)); if (!(exists)) { auxiliares.Add(detalleTraido); } } devolucion.Detalles = auxiliares; } } dgvLaptopsSeleccionados.DataSource = devolucion.Detalles; if (devolucion.Detalles.Count > 0) { btnObservacion.Enabled = true; } lblContador.Text = $"CANTIDAD REGISTRO: {devolucion.Detalles.Count.ToString()}"; }
public bool llenarListaLaptops() { vistaEquipos.ClearColumnsFilter(); bool flag = false; for (int i = 0; i < vistaEquipos.RowCount; i++) { bool aux2 = bool.Parse(vistaEquipos.GetRowCellValue(i, "Seleccionar").ToString()); if (aux2) { detalle = new DevolucionDetalle(); detalle.IdLC = int.Parse(vistaEquipos.GetRowCellValue(i, "IdLC").ToString()); detalle.CodigoLC = vistaEquipos.GetRowCellValue(i, "Codigo").ToString(); detalle.MarcaLC = vistaEquipos.GetRowCellValue(i, "MarcaLC").ToString(); detalle.ModeloLC = vistaEquipos.GetRowCellValue(i, "NombreModeloLC").ToString(); detalle.IdSalidaDetalle = int.Parse(vistaEquipos.GetRowCellValue(i, "IdSalidaDetalle").ToString()); detalle.IdSucursal = int.Parse(vistaEquipos.GetRowCellValue(i, "IdSucursal").ToString()); detalle.Observacion = vistaEquipos.GetRowCellValue(i, "Observacion").ToString(); detalle.Cobrar = int.Parse(vistaEquipos.GetRowCellValue(i, "PagaraCliente").ToString()); int aux = int.Parse(vistaEquipos.GetRowCellValue(i, "EquipoDanado").ToString()); detalle.Danado = aux; detalle.EstadoLC = (aux == 1) ? 3 : 2; detalles.Add(detalle); flag = true; } } return(flag); }