public async Task initialKeyNew() { listMatrialView.ItemsSource = await sourcefirebaseHelper.GetAllMaterialSource(); Models.MaterialHeader header = await headerfirebaseHelper.GetMaterial(this.header_id); Models.Product product = await productbaseHelper.GetProduct(new Guid(header.ProductID)); Lbl_FoodLabel.Text = product.NameEn; }
async void OnListViewItemSelected(object sender, EventArgs e) { Xamarin.Forms.ListView listView1 = (Xamarin.Forms.ListView)sender; Models.MaterialDetail detail_select = (Models.MaterialDetail)listView1.SelectedItem; Utils utils = new Utils(); Models.MaterialHeader header_select = await headerfirebaseHelper.GetMaterial(new Guid(detail_select.HeaderID)); //header_select.ProductID if (this.materialHeader_id != header_select.ID) { ProductFirebaseHelper productbaseHelper = new ProductFirebaseHelper(); Models.Product product_select = await productbaseHelper.GetProduct(new Guid(header_select.ProductID)); await headerfirebaseHelper.AddMaterialHeader(utils.convertObject(product_select.Name), utils.convertObject(product_select.NameEn), utils.convertObject(product_select.ID)); await Navigation.PushAsync(new MaterialFoodDetail(utils.convertObject(product_select.ID))); } else { ProductFirebaseHelper productbaseHelper = new ProductFirebaseHelper(); Models.Product product_select = await productbaseHelper.GetProduct(new Guid(header_select.ProductID)); await Navigation.PushAsync(new MaterialFoodDetail(header_select.ID, "Update")); } }
public async Task InitAsyncDetail() { Utils utils = new Utils(); MaterialDetailFirebaseHelper detailFirebase = new MaterialDetailFirebaseHelper(); listMatrialView.ItemsSource = await detailbaseHelper.GetAllMaterialDetail(); try { Models.MaterialDetail detailObject = await detailbaseHelper.GetDetailById(this.detail_id); if (detailObject != null) { MaterialSourceFirebaseHelper sourceFirebase = new MaterialSourceFirebaseHelper(); MaterialSource sourceObject = await sourceFirebase.GetMaterialSourceByID(utils.convertObject(detailObject.MaterialID)); MaterialFirebaseHelper headerFirebase = new MaterialFirebaseHelper(); ProductFirebaseHelper productFirebase = new ProductFirebaseHelper(); MaterialHeader headerObject = await headerFirebase.GetMaterial(new Guid(detailObject.HeaderID)); Models.Product productObject = await productFirebase.GetProduct(new Guid(headerObject.ProductID)); Lbl_FoodLabel.Text = productObject.NameEn; Lbl_UnitDisplay.Text = detailObject.UnitName; Entry_Quantity.Text = detailObject.Quantity + ""; listMatrialView.ItemsSource = null; Lbl_MaterialLabel.Text = sourceObject.NameEn; } } catch (Exception ee) { } }
async Task initAsync() { try { Foods = new List <Food>(); List <Models.Product> listP = await productFirebaseHelper.GetAllProduct(); var itemSourceListStr = new List <string>(); for (int i = 0; i < listP.Count; i++) { Models.Product productM = listP[i]; itemSourceListStr.Add(productM.Name); int count = i + 1; Foods.Add(new Food { ID = count, Name = productM.Name, NameEn = productM.NameEn, Location = productM.Location, Details = productM.Details, // ImageUrl = "food1.jpg", ImageUrl = productM.ImageUrl, CostPerUnit = productM.CostPerUnit, Quantity = productM.Quantity, LevelSpicy = productM.LevelSpicy // }); } picker.ItemsSource = itemSourceListStr; if (this.GID != null) { Models.Product product = await productFirebaseHelper.GetProduct(GID); } } catch (Exception ee) { string error_str = ee.Message; DisplayAlert("Connection Problem", ee.Message, "OK"); } }
public async Task initAsync() { this.picker.SelectedIndex = 0; StockOnline.Models.Product productM = await firebaseHelper.GetProduct(this.product_id); Entry_ProductName.Text = productM.Name; Entry_ProductNameEn.Text = productM.NameEn; Entry_Detail.Text = productM.Details; Entry_Location.Text = productM.Location; Entry_ImageURL.Text = productM.ImageUrl; Entry_Cost.Text = productM.CostPerUnit + ""; Entry_Quantity.Text = productM.Quantity + ""; bt_Confirm.Text = "Confirm Update"; if (productM.ProductType == "LINE") { this.picker.SelectedIndex = 0; } else if (productM.ProductType == "WALK") { this.picker.SelectedIndex = 1; } }