/// <summary> /// Handles the ChangeAction event of the lueAddProduct control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void lueAddProduct_ChangeAction(object sender, EventArgs e) { if (lueAddProduct.LookupResultValue != null) { ITargetResponse targetResponse = BindingSource.Current as ITargetResponse; IProduct product = lueAddProduct.LookupResultValue as IProduct; if ((targetResponse != null) && (product != null)) { IResponseProduct responseProduct = EntityFactory.Create <IResponseProduct>(); responseProduct.TargetResponse = targetResponse; responseProduct.Product = product; targetResponse.ResponseProducts.Add(responseProduct); _dtsProducts2 = null; } } }
protected void grdProducts_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Page") { return; } int rowIndex; if (Int32.TryParse(e.CommandArgument.ToString(), out rowIndex)) { dtsProducts.SelectedIndex = rowIndex; if (e.CommandName.Equals("Delete")) { if (grdProducts.DataKeys[0].Values.Count > 0) { ITargetResponse targetResponse = BindingSource.Current as ITargetResponse; if (targetResponse != null) { IResponseProduct responseProduct = EntityFactory.GetRepository <IResponseProduct>().Get(grdProducts.DataKeys[rowIndex].Values[0].ToString()); if (responseProduct != null) { targetResponse.ResponseProducts.Remove(responseProduct); responseProduct.Delete(); if (PageWorkItem != null) { IPanelRefreshService refresher = PageWorkItem.Services.Get <IPanelRefreshService>(); if (refresher != null) { refresher.RefreshAll(); } } } } } } } }