protected void gvPrices_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var price = (ProductPriceOverviewModel)e.Row.DataItem; ProductPriceOverviewModel chosenPrice = null; if (ExistInChosenPrices(price)) { chosenPrice = ChosenPrices.Find(delegate(ProductPriceOverviewModel item) { return(item.Id == price.Id); }); } CheckBox cb = e.Row.FindControl("cbChosen") as CheckBox; if (chosenPrice != null) { TextBox txtWeight = e.Row.FindControl("txtWeight") as TextBox; TextBox txtPrice = e.Row.FindControl("txtPrice") as TextBox; TextBox txtStock = e.Row.FindControl("txtStock") as TextBox; TextBox txtBarcode = e.Row.FindControl("txtBarcode") as TextBox; cb.Checked = true; txtWeight.Text = chosenPrice.Weight.ToString(); txtPrice.Text = AdminStoreUtility.GetFormattedPrice(chosenPrice.Price, CurrencySettings.PrimaryStoreCurrencyCode, CurrencyType.None); txtStock.Text = chosenPrice.Stock.ToString(); txtBarcode.Text = chosenPrice.Barcode; } } }
protected void lbUpdateSelected_Click(object sender, EventArgs e) { SaveLastViewedPrices(); ProductService.UpdateProductPriceOverviewModels(ChosenPrices); enbNotice.Message = "Prices were updated successfully"; ChosenPrices.Clear(); NotChosenPrices.Clear(); LoadPrices(); }
private void SetChosenPrices(ProductPriceOverviewModel price, bool chosen) { if (price != null) { if (chosen) { if (ExistInChosenPrices(price)) { ChosenPrices.RemoveAll(delegate(ProductPriceOverviewModel arg) { return(arg.Id == price.Id); }); } ChosenPrices.Add(price); NotChosenPrices.RemoveAll(delegate(ProductPriceOverviewModel arg) { return(arg.Id == price.Id); }); } else { ChosenPrices.RemoveAll(delegate(ProductPriceOverviewModel arg) { return(arg.Id == price.Id); }); if (ExistInNotChosenPrices(price)) { NotChosenPrices.RemoveAll(delegate(ProductPriceOverviewModel arg) { return(arg.Id == price.Id); }); } NotChosenPrices.Add(price); } } }