protected void gvPaymentMethods_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var method = (PaymentMethod)e.Row.DataItem; var chkEnabled = e.Row.FindControl("chkEnabled") as CheckBox; var lblMethodName = e.Row.FindControl("lblMethodName") as Label; var btnEdit = e.Row.FindControl("btnEdit") as LinkButton; var contains = HccApp.CurrentStore.Settings.PaymentMethodsEnabled.Contains(method.MethodId); chkEnabled.Checked = contains; if (string.IsNullOrEmpty(LocalizationUtils.GetPaymentMethodFriendlyName(method.MethodName))) { lblMethodName.Text = method.MethodName; } else { lblMethodName.Text = LocalizationUtils.GetPaymentMethodFriendlyName(method.MethodName); } var editor = HccPartController.LoadPaymentMethodEditor(method.MethodName, Page) as HccPart; var editorExists = editor != null; btnEdit.Visible = editorExists; } }
public void LoadEditor(string methodId) { Visible = true; var method = PaymentMethods.Find(methodId); Editor = HccPartController.LoadPaymentMethodEditor(method.MethodName, Page) as HccPaymentMethodPart; if (Editor != null) { ulActions.Visible = !Editor.HasOwnButtons; Editor.ID = "MethodEditor_" + method.MethodName; Editor.MethodId = method.MethodId; phEditor.Controls.Clear(); phEditor.Controls.Add(Editor); Editor.EditingComplete += Editor_EditingComplete; Editor.LoadData(); } else { msg.ShowError(Localization.GetString("PaymentEditorError")); } }