Example #1
0
        protected void PaymentMethodsGrid_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            DisplayPaymentMethod m = (DisplayPaymentMethod)e.Row.DataItem;

            if (m != null)
            {
                CheckBox chkEnabled = (CheckBox)e.Row.FindControl("chkEnabled");
                if (chkEnabled != null)
                {
                    if (MTApp.CurrentStore.Settings.PaymentMethodsEnabled.ContainsKey(m.MethodId))
                    {
                        chkEnabled.Checked = true;
                    }
                    else
                    {
                        chkEnabled.Checked = false;
                    }
                }

                // Check for Editor
                ImageButton btnEdit = (ImageButton)e.Row.FindControl("btnEdit");
                if (btnEdit != null)
                {
                    btnEdit.Visible = false;
                    System.Web.UI.Control editor = ModuleController.LoadPaymentMethodEditor(m.MethodName, this.Page);
                    if (editor != null)
                    {
                        if (editor is BVModule)
                        {
                            btnEdit.Visible = true;
                        }
                    }
                }
            }
        }
        protected override void OnInit(System.EventArgs e)
        {
            base.OnInit(e);

            if (Request.QueryString["id"] != null)
            {
                this.MethodIdField.Value = Request.QueryString["id"];
            }
            for (int i = 0; i <= availablePayments.Methods.Count - 1; i++)
            {
                if (string.Compare(availablePayments.Methods[i].MethodId, this.MethodIdField.Value, true) == 0)
                {
                    m = availablePayments.Methods[i];
                }
            }
            LoadEditor();
        }
        protected override void OnInit(System.EventArgs e)
        {
            base.OnInit(e);

            if (Request.QueryString["id"] != null)
            {
                this.MethodIdField.Value = Request.QueryString["id"];
            }
            for (int i = 0; i <= availablePayments.Methods.Count - 1; i++)
            {
                if (string.Compare(availablePayments.Methods[i].MethodId, this.MethodIdField.Value, true) == 0)
                {
                    m = availablePayments.Methods[i];
                }
            }
            LoadEditor();
        }
        private void LoadView()
        {
            this.phOptions.Controls.Clear();

            DisplayPaymentMethod m = FindMethod(this.lstPaymentMethods.SelectedValue);

            System.Web.UI.Control tempControl = ModuleController.LoadPaymentMethodView(m.MethodName, this.Page);
            if (tempControl is BVModule)
            {
                BVModule view;
                view = (BVModule)tempControl;
                if (!(view == null))
                {
                    view.BlockId = m.MethodId;
                    this.phOptions.Controls.Add(view);
                }
            }
            else
            {
                //Me.phOptions.Controls.Add(New LiteralControl("Error, editor is not based on Content.BVModule class"))
            }
        }