private void LoadUpdate() { HideAlertMessage(divMessage); recipeID = int.Parse(Request.QueryString["id"]); RecipeDataBaseRepository repo = new RecipeDataBaseRepository(); Recipe recipe = repo.GetRecipe(recipeID); //check Authenticate if (isAuthenticated(recipe.submitBy)) { plDetails.Visible = false; plUpdate.Visible = true; // ShowAlertMessage(divMessage); txtName.Text = recipe.name; txtSubmitBy.Text = recipe.submitBy; txtSubmitBy.ReadOnly = true; txtSubmitBy.CssClass = "form-control"; txtCookingTime.Text = recipe.cookingTime.ToString(); txtNumberOfServings.Text = recipe.numberOfServings.ToString(); txtDescription.Text = recipe.description; ucCategories1.Value = recipe.category; ucListEditIngedient1.Initialize(recipe.ingredients); } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { //show Recipe details recipeID = int.Parse(Request.QueryString["id"]); RecipeDataBaseRepository repo = new RecipeDataBaseRepository(); Recipe recipe = repo.GetRecipe(recipeID); divTitle.InnerText = "Recipe Details: " + recipe.name; divCategory.InnerHtml = String.Format("<h5>{0}</h5>", recipe.category); divCookingTime.InnerHtml = String.Format("<h5>{0}</h5>", recipe.cookingTime.ToString()); divNumberOfServings.InnerHtml = String.Format("<h5>{0}</h5>", recipe.numberOfServings.ToString()); divSubmitBy.InnerHtml = String.Format("<h5>{0}</h5>", recipe.submitBy); divDescription.InnerHtml = String.Format("<h5>{0}</h5>", recipe.description); //show Ingredients details foreach (Ingredient ing in recipe.ingredients) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = ing.name; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = ing.quantity; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = ing.unit; row.Cells.Add(cell); tbl.Rows.Add(row); } } }
private void LoadDeitals() { //show Recipe details plDetails.Visible = true; plUpdate.Visible = false; if (Request.QueryString["success"] == "true") { ShowAlertMessage(divMessage); } else { HideAlertMessage(divMessage); } recipeID = int.Parse(Request.QueryString["id"]); RecipeDataBaseRepository repo = new RecipeDataBaseRepository(); Recipe recipe = repo.GetRecipe(recipeID); divTitle.InnerText = recipe.name; divCategory.InnerHtml = String.Format("<h5>{0}</h5>", recipe.category); divCookingTime.InnerHtml = String.Format("<h5>{0}</h5>", recipe.cookingTime.ToString()); divNumberOfServings.InnerHtml = String.Format("<h5>{0}</h5>", recipe.numberOfServings.ToString()); divSubmitBy.InnerHtml = String.Format("<h5>{0}</h5>", recipe.submitBy); divDescription.InnerHtml = String.Format("<h5>{0}</h5>", recipe.description); //show Ingredients details foreach (Ingredient ing in recipe.ingredients) { HtmlTableRow row = new HtmlTableRow(); HtmlTableCell cell = new HtmlTableCell(); cell.InnerText = ing.name; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = ing.quantity; row.Cells.Add(cell); cell = new HtmlTableCell(); cell.InnerText = ing.unit; row.Cells.Add(cell); tbl.Rows.Add(row); } //if user does not login, can not modify the data btnModify.Visible = isAuthenticated(recipe.submitBy); }