public void recargarTabla() { FacadePedido FC = new FacadePedido(); DataSet dset = FC.allpedidos(); gridHistorial.DataSource = dset; gridHistorial.DataBind(); }
private void btnSiguienteTab2_Click(object sender, EventArgs e) { // Obtener lista de pedido lista = new List <Producto>(); var items = listaPedido.Items; foreach (var prod in items) { if (lista.Contains((Producto)prod)) { int i = lista.IndexOf((Producto)prod); lista[i].Cantidad += 1; } else { lista.Add((Producto)prod); int i = lista.IndexOf((Producto)prod); lista[i].Cantidad = 1; } } if (lista.Count > 0) { tabControl1.SelectedIndex = 2; // Crear Factura con Gestor _Factura = new GestorFactura(); _Factura.AsignarNegocio(_Negocio); _Factura.AsignarCliente(MenuCliente._Cliente); _Factura.AsignarFecha(DateTime.Now); _Factura.AsignarEstadoFactura("Pendiente"); _Factura.AsignarEstadoPedido("En espera"); // Crear Pedido fPedido = new FacadePedido() { ListaProductos = lista }; // Asignar el pedido a la factura _Factura.AsignarPedido(fPedido); // Asignar valores a los textos de el panel con la iformacion del pedido txtCostoNormal.Text = "¢" + fPedido.CostoSinCupones(); txtImpuesto.Text = "¢" + fPedido.ImpuestoVentas(); txtCostoTotal.Text = "¢" + _Factura.CostoTotal(); txtCostoExpress.Text = "¢" + _Factura.CostoExpress(); txtCostoTotalDolares.Text = "$" + _Factura.CostoTotalDolares(); } else { MessageBox.Show(this, "Debe agregar productos a la lista", "Agregue productos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
protected void btn_Actualizar_Click(object sender, EventArgs e) { FacadePedido actualiza = new FacadePedido(); string estado = DropDownList1.SelectedValue; Response.Write("<script language=javascript>alert('" + txt_cliente.Text+ "');</script>)"); actualiza.actualizdaEstadoPedido(txt_cliente.Text, estado, Convert.ToInt32(gridHistorial.SelectedRow.Cells[0].Text)); Response.Write("<script language=javascript>alert('Estado Actualizado');</script>)"); Div_ActualizarPedido.Visible = false; div_Pedidos.Visible = true; recargarTabla(); }
private void btnVerPedido_Click_1(object sender, EventArgs e) { try { int index = dgvPedidos.SelectedRows[0].Index; FacadePedido pedido = (FacadePedido)dgvPedidos.Rows[index].Cells["_PEDIDO"].Value; dgvDetalle.DataSource = pedido.ListaProductos; dgvDetalle.Columns["Precio"].Visible = false; dgvDetalle.Columns["Id"].Visible = false; dgvDetalle.Columns["UsuarioId"].Visible = false; dgvDetalle.Columns["Activo"].Visible = false; // Cambiar el tamaño de las imagenes foreach (DataGridViewRow row in dgvDetalle.Rows) { Image imagen = (Image)row.Cells["Fotografia"].Value; row.Cells["Fotografia"].Value = Util.CambiarTamanoImagen(imagen, 60, 55); } tabControl1.SelectedIndex = 1; } catch (Exception error) { MessageBox.Show(this, "Usted no cuenta con pedidos", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); StringBuilder msg = new StringBuilder(); msg.AppendFormat("Error al visualizar el detalle factura\n"); msg.AppendFormat("Message: {0}\n", error.Message); msg.AppendFormat("Source: {0}\n", error.Source); msg.AppendFormat("Data: {0}\n", error.Data); //Salvar el error en el log log.Error(msg.ToString()); } }
public static FacadePedido PA_SeleccionarPedidoPorFacturaID(int id) { using (IDataBase db = FactoryDatabase.CreateDefaultDataBase()) { SqlCommand comando = new SqlCommand(); comando.CommandType = System.Data.CommandType.StoredProcedure; comando.CommandText = "PA_SeleccionarPedidoPorFacturaID"; comando.Parameters.AddWithValue("@id", id); DataSet ds = db.ExecuteDataSet(comando); foreach (DataRow dr in ds.Tables[0].Rows) { FacadePedido pedido = new FacadePedido();; pedido.ListaProductos = PA_SeleccionarDetalleFactura(id); pedido._Cupon = PA_SeleccionarCuponPorFacturaID(id); return(pedido); } } return(null); }
protected void btn_buscar_Click(object sender, EventArgs e) { string columna = ColBuscada.SelectedValue; string by=""; if (columna == "Cliente") { by = "busca_PedidoByNombreCliente"; }else if(columna=="Producto"){ by="busca_PedidoByProducto"; } else if(columna=="Cantidad"){ by="busca_PedidoByCantidad"; } string txtBusca = txt_texto.Text; FacadePedido busca = new FacadePedido(); DataSet dset = busca.PedidosBy(by, txtBusca); gridHistorial.DataSource = dset; gridHistorial.DataBind(); }
/// <summary> /// Asigna el pedido a la factura /// </summary> /// <param name="pedido"></param> public void AsignarPedido(FacadePedido pedido) { _Factura._Pedido = pedido; }
protected void btn_crearPedido_Click(object sender, EventArgs e) { string sesion = Convert.ToString(Session["usuario"]); int nPedido = gvSelected.Rows.Count; if (nPedido > 5) { Response.Write("<script language=javascript>alert('Solo puede elegir 5 productos.');</script>)"); } else if (nPedido == 0) { Response.Write("<script language=javascript>alert('Elegir producto para hacer pedido.');</script>)"); } else { List<int> codProducto = new List<int>(); List<int> preProducto = new List<int>(); string id = gvSelected.Rows[0].Cells[0].Text; string estado = gvSelected.Rows[0].Cells[4].Text; for (int i = 0; i < nPedido; i++) { codProducto.Add(Convert.ToInt32(gvSelected.Rows[i].Cells[0].Text)); preProducto.Add(Convert.ToInt32(Convert.ToDecimal(gvSelected.Rows[i].Cells[3].Text))); } FacadePedido newpedido = new FacadePedido(); newpedido.ingresarPedido(sesion, "PENDIENTE", codProducto, preProducto); Response.Write("<script language=javascript>alert('Pedido Ingresado correctamente.');</script>)"); div_CrearPedido.Visible = false; div_detallePedido.Visible = true; DataTable dt = new DataTable(); dt.Columns.AddRange(new DataColumn[5] { new DataColumn("ID", typeof(int)), new DataColumn("Nombre", typeof(string)), new DataColumn("Stock",typeof(string)) , new DataColumn("Precio",typeof(string)) , new DataColumn("Estado",typeof(string)) }); int total = 0; for (int i = 0; i < nPedido; i++) { codProducto.Add(Convert.ToInt32(gvSelected.Rows[i].Cells[0].Text)); preProducto.Add(Convert.ToInt32(Convert.ToDecimal(gvSelected.Rows[i].Cells[3].Text))); string stock = gvSelected.Rows[i].Cells[2].Text; string nombre = gvSelected.Rows[i].Cells[1].Text; int precio = Convert.ToInt32(Convert.ToDecimal(gvSelected.Rows[i].Cells[3].Text)); total = total + precio; dt.Rows.Add(i, codProducto[i], nombre, stock, preProducto[i]); } dt.Rows.Add(nPedido, "", "", "Subtotal", total); gridDetalles.DataSource = dt; gridDetalles.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { FacadePedido FC = new FacadePedido(); DataSet dset = FC.allpedidos(); gridHistorial.DataSource = dset; gridHistorial.DataBind(); Div_ActualizarPedido.Visible = false; } }
protected void btn_status_Click(object sender, EventArgs e) { string status = rbtLstRating.SelectedItem.Text; string by = ""; if (status == "PENDIENTE") { by = "PENDIENTE"; } else if (status == "ENTREGADO") { by = "ENTREGADO"; } else if (status == "ANULADO") { by = "ANULADO"; } FacadePedido BUSCAR = new FacadePedido(); DataSet dset = BUSCAR.PedidosByStatus(by); ; gridHistorial.DataSource = dset; gridHistorial.DataBind(); }