private void BtnCStock_Click(object sender, RoutedEventArgs e) { ConsultaStock ventana = new ConsultaStock(); ventana.Owner = this; ventana.Show(); }
public void RegisterProduct(ConsultaStock consultastock) { NegocioConsulta auxNegocio = new NegocioConsulta(); auxNegocio.AgregarProducto(consultastock); }
public void actualizarStockService(ConsultaStock consultaStock) { NegocioConsulta auxNegocio = new NegocioConsulta(); auxNegocio.ActualizarStock(consultaStock); }
public IActionResult otroMetodo() { IList <ConsultaStock> lista = new List <ConsultaStock>(); ConsultaStock respuesta = null; string connectionString = "Data Source=192.168.1.115\\devbc;Initial Catalog=AdventureWorks2014; User Id = sa; Password=1234"; string queryString = @"SELECT PCS.ProductSubcategoryID, PCS.Name, SUM(CAST (WO.StockedQty AS bigint)) AS WorkOrderQty, SUM(CAST (WR.ActualCost*WO.OrderQty AS bigint)) AS WorkOrderCost, SUM(CAST (POD.OrderQty AS bigint)) PurchaseOrderQty, SUM(CAST (POD.UnitPrice*POD.OrderQty AS bigint)) AS PurchaseOrderCost FROM Purchasing.PurchaseOrderDetail POD INNER JOIN Production.Product P ON POD.ProductID=POD.ProductID INNER JOIN Production.ProductSubcategory PCS ON P.ProductSubcategoryID=PCS.ProductSubcategoryID INNER JOIN Production.WorkOrder WO ON P.ProductID=WO.ProductID INNER JOIN Production.WorkOrderRouting WR ON WR.WorkOrderID = WO.WorkOrderID where year(WO.StartDate)=2014 GROUP BY PCS.ProductSubcategoryID, PCS.Name;"; using (SqlConnection connection = new SqlConnection(connectionString)) { SqlCommand comando = new SqlCommand(queryString, connection); try { connection.Open(); SqlDataReader lector = comando.ExecuteReader(); while (lector.Read()) { respuesta = new ConsultaStock() { ProductSubcategoryID = Convert.ToInt32(lector.GetValue(0)), Name = lector.GetValue(1).ToString(), WorkOrderQty = Convert.ToInt32(lector.GetValue(2)), WorkOrderCost = Convert.ToInt32(lector.GetValue(3)), PurchaseOrderQty = Convert.ToInt32(lector.GetValue(4)), PurchaseOrderCost = Convert.ToInt32(lector.GetValue(5)) }; lista.Add(respuesta); } lector.Close(); return(Ok(lista)); } catch (Exception e) { return(BadRequest(e)); } } }