private void Update_Venta(object sender, EventArgs e) { Product producto = Product_List[Picker_Productos.SelectedIndex]; Client cliente = Client_List[Picker_Clientes.SelectedIndex]; int cantidad = int.Parse(Quantity.Text); int diff = Venta_Info.Amount - cantidad; producto.Quantity += diff; producto.Update(); Venta_Info.Client_Id = cliente.Id; Venta_Info.Product_Id = producto.Id; Venta_Info.Amount = cantidad; Venta_Info.Total = producto.Price * cantidad; Venta_Info.Earnings = (producto.Price - producto.Cost) * cantidad; Venta_Info.Timestamp = DateTime.Now; Venta_Info.Photo_Path = producto.Photo_Url; Venta_Info.Update(); Return_To_List(); }
private async void Register_Clicked(object sender, EventArgs e) { Product producto = Product_List[Picker_Productos.SelectedIndex]; Client cliente = Client_List[Picker_Clientes.SelectedIndex]; int cantidad = int.Parse(Quantity_Entry.Text); Sell sell = new Sell { Client_Id = cliente.Id, Product_Id = producto.Id, Amount = cantidad, Total = producto.Price * cantidad, Earnings = (producto.Price - producto.Cost) * cantidad, Timestamp = DateTime.Now, Photo_Path = producto.Photo_Url }; producto.Quantity -= cantidad; producto.Update(); sell.Insert(); await Application.Current.MainPage.Navigation.PopAsync(); }