protected void repItems_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Expand") { DetalleOC det = (DetalleOC)e.Item.FindControl("ucDetalle"); det.Visible = true; det.LoadInformation(); } }
protected void repItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } PurchaseOrderInformation po = (PurchaseOrderInformation)e.Item.DataItem; DetalleOC det = (DetalleOC)e.Item.FindControl("ucDetalle"); det.POId = po.Id; }
private void InsertarDetalle(DetalleOC detalleOC, ConexionBD conexion) { //bool resultado = false; //ConexionBD conexion = new ConexionBD(); try { string sql = "INSERT INTO DetalleOrdenCompra VALUES ('" + detalleOC.NroOC + "','" + detalleOC.IdProducto + "','" + detalleOC.Cantidad + "','" + detalleOC.UnidadMedida + "','" + detalleOC.Precio + "','" + detalleOC.IdUrgencia + "')"; conexion.insertar(sql); //resultado = true; } catch (Exception) { MessageBox.Show("Error al insertar datos"); } //return resultado; }
protected void repItems_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } if (Roles.IsUserInRole(UserType.Lectores.ToString())) { CheckBox cbtemp = (CheckBox)e.Item.FindControl("chkbItemStatus"); cbtemp.Enabled = false; } PurchaseOrderInformation po = (PurchaseOrderInformation)e.Item.DataItem; DetalleOC det = (DetalleOC)e.Item.FindControl("ucDetalle"); det.POId = po.Id; det.POS = Convert.ToInt32(ddlEstados.SelectedValue); }
private void btnGuardar_Click(object sender, EventArgs e) { DialogResult volver = MessageBox.Show("Esta seguro que desea emitir esta orden de compra?", "Guardar Orden de Compra", MessageBoxButtons.YesNo); if (volver == DialogResult.Yes) { if (dgrDetalleOC.Rows.Count > 0) { ConexionBD conexion = new ConexionBD(); conexion.iniciar_transaccion(); nuevaOrden.Total = float.Parse(lblTotalCalculado.Text); if (InsertarOC(nuevaOrden, conexion)) { foreach (DataGridViewRow r in dgrDetalleOC.Rows) { int nroOrdenCompra = (int)r.Cells["numOrdenCompra"].Value; int idProducto = (int)r.Cells["producto"].Value; int cantidad = (int)r.Cells["cantidad"].Value; int idUnidadMedida = (int)r.Cells["uniMedida"].Value; float precio = (float)r.Cells["precio"].Value; int idUrgencia = (int)r.Cells["idUrgencia"].Value; DetalleOC nuevoDetalle = new DetalleOC(nroOrdenCompra, idProducto, cantidad, idUnidadMedida, precio, idUrgencia); InsertarDetalle(nuevoDetalle, conexion); } MessageBox.Show("Orden de Compra creada con exito!"); conexion.cerrar_transaccion(); } LimpiarGrilla(); LimpiarCampos(groupBoxDatosOC); BuscarNroOrden(); groupBoxDatosOC.Enabled = true; lblTotalCalculado.Text = "$0"; } else { MessageBox.Show("Debe agregar productos a la orden de compra"); } } }