public void Mostrar() { try { if (esPendiente == 1) { this.Dock = DockStyle.Fill; this.dataGridViewPedidosPendientes.DataSource = NPedidos.MostrarPedidosPendientes(numeroPaginaPedidosPendientes, registrosPorPagina); this.dataGridViewPedidosPendientes.Columns[1].Visible = false; this.dataGridViewPedidosPendientes.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; this.dataGridViewPedidosPendientes.Columns[8].DefaultCellStyle.Format = "0.00## $"; cantidadPaginasPedidosPendientes = NPedidos.TamañoPedidosPendientes(registrosPorPagina); this.labelPagina.Text = String.Format("Página {0} de {1}", numeroPaginaPedidosPendientes, cantidadPaginasPedidosPendientes); } else if (esPendiente == 0) { this.Dock = DockStyle.Fill; this.dataGridViewPedidosEntregados.DataSource = NPedidos.MostrarPedidosEntregados(numeroPaginaPedidosEntegados, registrosPorPagina); this.dataGridViewPedidosEntregados.Columns[1].Visible = false; this.dataGridViewPedidosEntregados.Columns[8].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; this.dataGridViewPedidosEntregados.Columns[8].DefaultCellStyle.Format = "0.00## $"; cantidadPaginasPedidosEntregados = NPedidos.TamañoPedidosEntregados(registrosPorPagina); this.labelPagina.Text = String.Format("Página {0} de {1}", numeroPaginaPedidosEntegados, cantidadPaginasPedidosEntregados); } } catch (Exception ex) { MensajeError(ex.Message); } }
private void buttonGuardar_Click(object sender, EventArgs e) { String mensaje = ""; try { if (this.textBoxCostoEnvio.Text == String.Empty) { this.textBoxCostoEnvio.Text = "0"; } if (this.dataGridViewProductos.Rows.Count > 0) { mensaje = NPedidos.Editar(Convert.ToInt32(_owner.ObtenerSeleccionPedidos().Cells[1].Value), this.comboBoxClientes.Text, this.comboBoxTransportes.Text, this.comboBoxEmpleados.Text, this.dateTimePickerFechaOrdenado.Text, null, this.dateTimePickerFechaEntregado.Text, Convert.ToDecimal(this.textBoxCostoEnvio.Text)); if (mensaje == "Y") { for (int fila = 0; fila < dataGridViewProductos.Rows.Count; fila++) { mensaje = NPedidoDetalles.Editar(Convert.ToInt32(_owner.ObtenerSeleccionPedidos().Cells[1].Value), dataGridViewProductos.Rows[fila].Cells["producto"].Value.ToString(), Convert.ToInt32(dataGridViewProductos.Rows[fila].Cells["cantidad"].Value.ToString()), Convert.ToDecimal(dataGridViewProductos.Rows[fila].Cells["precio"].Value.ToString().Replace("$", "")), Convert.ToDecimal(dataGridViewProductos.Rows[fila].Cells["descuento"].Value.ToString().Replace("%", ""))); } if (mensaje == "Y") { this._owner.Mensaje(String.Format("El Pedido {0} para {1} ha sido EDITADO", this._owner.ObtenerSeleccionPedidos().Cells["CÓDIGO"].Value, this.comboBoxClientes.Text)); this._owner.Refrescar(); this.Close(); } else { MensajeError(mensaje); } } else { MensajeError(mensaje); } } else { MensajeError("Debes añadir algún producto al pedido"); } } catch (Exception ex) { MensajeError(mensaje + ex.Message); } }
public void Buscar() { try { if (esPendiente == 1) { this.dataGridViewPedidosPendientes.DataSource = NPedidos.BuscarPedidoPendiente(this.textBoxBuscarNombre.Text); } else { this.dataGridViewPedidosEntregados.DataSource = NPedidos.BuscarPedidoEntregado(this.textBoxBuscarNombre.Text); } } catch (Exception ex) { MensajeError(ex.Message); } }
private void buttonFecha_Click(object sender, EventArgs e) { String mensaje = ""; mensaje = NPedidos.MarcarEntregadoPendiente( Convert.ToInt32(this._owner.ObtenerSeleccionPedidos().Cells[1].Value), this.dateTimePickerMarcarFecha.Value.ToString("dd/MM/yyyy")); if (mensaje == "Y") { this._owner.Mensaje(String.Format("El Pedido {0} para {1} ha sido marcado como ENTREGADO", this._owner.ObtenerSeleccionPedidos().Cells[2].Value.ToString(), this._owner.ObtenerSeleccionPedidos().Cells[3].Value.ToString())); this._owner.Refrescar(); this.Close(); } else { this._owner.MensajeError(mensaje); } }
private void buttonAceptar_Click(object sender, EventArgs e) { String mensaje = ""; mensaje = NPedidos.MarcarEntregadoPendiente( Convert.ToInt32(this._owner.ObtenerSeleccionPedidos().Cells[1].Value), null); if (mensaje == "Y") { this._owner.Mensaje(String.Format("El Pedido {0} para {1} ha sido marcado como PENDIENTE", this._owner.ObtenerSeleccionPedidos().Cells[2].Value.ToString(), this._owner.ObtenerSeleccionPedidos().Cells[3].Value.ToString())); this._owner.Refrescar(); this.Close(); } else { this._owner.MensajeError(mensaje); } }
private void Eliminar() { DialogResult confirmacion = MessageBox.Show("¿Seguro deseas eliminar este pedido?", "Eliminar Pedido", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (confirmacion == DialogResult.OK) { String mensaje = NPedidos.Eliminar(Convert.ToInt32(ObtenerSeleccionPedidos().Cells["ID"].Value)); if (mensaje == "Y") { Mensaje(String.Format("El Pedido {0} de {1} ha sido ELIMINADO", Convert.ToString(ObtenerSeleccionPedidos().Cells["CÓDIGO"].Value), Convert.ToString(ObtenerSeleccionPedidos().Cells["CLIENTE"].Value))); Refrescar(); } else { MensajeError(mensaje); Refrescar(); } } }
private void buttonGuardar_Click(object sender, EventArgs e) { String mensaje = ""; String fecha_requerido = ""; try { if (this.textBoxCostoEnvio.Text == String.Empty) { this.textBoxCostoEnvio.Text = "0"; } if (this.checkBoxSinFecha.Checked) { fecha_requerido = null; } else { fecha_requerido = this.dateTimePickerFechaRequerido.Value.ToString("dd/MM/yyyy"); } if (this.dataGridViewProductos.Rows.Count > 0) { mensaje = NPedidos.Insertar(this.comboBoxClientes.Text, this.comboBoxTransportes.Text, this.comboBoxEmpleados.Text, this.dateTimePickerFechaOrdenado.Value.ToString("dd/MM/yyyy"), fecha_requerido, Convert.ToDecimal(this.textBoxCostoEnvio.Text)); if (mensaje == "Y") { for (int fila = 0; fila < dataGridViewProductos.Rows.Count; fila++) { mensaje = NPedidoDetalles.Insertar(dataGridViewProductos.Rows[fila].Cells["producto"].Value.ToString(), Convert.ToInt32(dataGridViewProductos.Rows[fila].Cells["cantidad"].Value.ToString()), Convert.ToDecimal(dataGridViewProductos.Rows[fila].Cells["precio"].Value.ToString().Replace("$", "")), Convert.ToDecimal(dataGridViewProductos.Rows[fila].Cells["descuento"].Value.ToString().Replace("%", ""))); } if (mensaje == "Y") { this._owner.Mensaje(String.Format("El Pedido para {0} ha sido AGREGADO", this.comboBoxClientes.Text)); this._owner.Refrescar(); this.Close(); } else { MensajeError(String.Format("El Pedido para {0} ha sido agregado pero ocurrió un problema al agregar los productos. " + mensaje, this.comboBoxClientes.Text)); } } else { MensajeError(mensaje); } } else { MensajeError("Debes añadir algún producto al pedido"); } } catch (Exception ex) { MensajeError(ex.Message); } }