Пример #1
0
        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;
            }
        }
Пример #2
0
        private void LoadShippingMethodEditor(ShippingMethod shippingMethod)
        {
            var p = AvailableServices.FindById(shippingMethod.ShippingProviderId, HccApp.CurrentStore);

            var editor = (HccShippingPart)HccPartController.LoadShippingEditor(p.Name, Page);

            if (editor != null)
            {
                ClearEditorsInfo();
                if (string.IsNullOrEmpty(shippingMethod.Bvin))
                {
                    NewShippingMethod = shippingMethod;
                }
                else
                {
                    EditedShippingMethodId = shippingMethod.Bvin;
                }
                editor.ShippingMethod = shippingMethod;
                editor.ID             = string.Format("ShippingMethod_{0}_{1}", shippingMethod.ShippingProviderId,
                                                      shippingMethod.Bvin);
                editor.EditingComplete += ShippingMethodEditor_EditingComplete;
                AddCloseDialogScript(editor);
                phrEditor.Controls.Add(editor);
            }
        }
        protected void gvBlocks_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var b = (ContentBlock)e.Row.DataItem;

                var controlFound = false;

                var cell = e.Row.Cells[1];

                e.Row.Attributes["id"] = b.Bvin;

                // Control name gets spaces replaced for backwards compatibility
                var viewControl = HccPartController.LoadContentBlockAdminView(b.ControlName.Replace(" ", string.Empty), Page);
                if (viewControl == null)
                {
                    //No admin view, try standard view

                    // Block views are now MVC partial so we need a way to render them here
                    // There are some tricks but since this page will eventually go MVC itself
                    // we'll just put in placeholders for now.
                    //viewControl = HccPartController.LoadContentBlock(b.ControlName, Page);
                    viewControl = new BlankBlock {
                        bvin = b.Bvin, Text = "<div>Block: " + b.ControlName + "</div>"
                    };
                }

                if (viewControl is HccContentBlockPart || viewControl is BlankBlock)
                {
                    if (viewControl is HccContentBlockPart)
                    {
                        ((HccContentBlockPart)viewControl).BlockId = b.Bvin;
                    }
                    controlFound = true;
                    cell.Controls.Add(viewControl);
                }

                if (controlFound)
                {
                    // Check for Editor
                    var lnkEdit = (HyperLink)e.Row.FindControl("lnkEdit");
                    if (lnkEdit != null)
                    {
                        lnkEdit.Visible = EditorExists(b.ControlName);
                    }
                }
                else
                {
                    cell.Controls.Add(new LiteralControl("Control " + b.ControlName + "could not be located"));
                }
            }
        }
        private bool EditorExists(string controlName)
        {
            var     result = false;
            Control editorControl;

            editorControl = HccPartController.LoadContentBlockEditor(controlName.Replace(" ", string.Empty), Page);
            if (editorControl != null)
            {
                if (editorControl is HccPart)
                {
                    result = true;
                }
            }
            return(result);
        }
Пример #5
0
        private void LoadShippingZoneEditor(long shippingZoneId)
        {
            var editor = (Edit)HccPartController.LoadShippingZoneEditor(Page);

            if (editor == null)
            {
                return;
            }

            ClearEditorsInfo();
            EditedShippingZoneId    = shippingZoneId;
            editor.ShippingZoneId   = shippingZoneId;
            editor.ID               = string.Format("ShippingZone_{0}", shippingZoneId);
            editor.EditingComplete += ShippingZoneEditor_EditingComplete;
            AddCloseDialogScript(editor);
            phrEditor.Controls.Add(editor);
        }
        private void LoadEditor()
        {
            var p = AvailableServices.FindById(m.ShippingProviderId, HccApp.CurrentStore);

            var editor = HccPartController.LoadShippingEditor(p.Name, this) as HccShippingPart;

            if (editor != null)
            {
                editor.ShippingMethod = m;
                phEditor.Controls.Add(editor);
                editor.EditingComplete += editor_EditingComplete;
            }
            else
            {
                phEditor.Controls.Add(new LiteralControl(Localization.GetString("EditorLoadError")));
            }
        }
        private void LoadEditor()
        {
            var editor =
                HccPartController.LoadContentBlockEditor(Block.ControlName.Replace(" ", string.Empty), this) as
                HccContentBlockPart;

            if (editor != null)
            {
                editor.BlockId  = Block.Bvin;
                TitleLabel.Text = "Edit Content Block - " + Block.ControlName;
                phEditor.Controls.Add(editor);
            }
            else
            {
                msg.ShowError("Error, editor is not based on HccContentBlockPart class");
            }

            editor.EditingComplete += editor_EditingComplete;
        }
        public void LoadEditor(string gatewayId)
        {
            var gateway = PaymentGateways.Find(gatewayId);

            Editor = HccPartController.LoadCreditCardGatewayEditor(gateway.Name, Page) as HccCreditCardGatewayPart;

            if (Editor != null)
            {
                Editor.ID        = "GatewayEditor_" + gateway.Name;
                Editor.GatewayId = gateway.Id;
                phEditor.Controls.Clear();
                phEditor.Controls.Add(Editor);
                Editor.EditingComplete += Editor_EditingComplete;
                Editor.LoadData();
            }
            else
            {
                msg.ShowError("Error, editor is not based on HccCreditCardGatewayPart class");
            }
        }
        public void LoadEditor(string gatewayId)
        {
            Visible = true;
            var gateway = GiftCardGateways.Find(gatewayId);

            Editor = HccPartController.LoadGiftCardGatewayEditor(gateway.Name, Page) as HccGiftCardGatewayPart;

            if (Editor != null)
            {
                Editor.ID        = "GatewayEditor_" + gateway.Name;
                Editor.GatewayId = gateway.Id;
                phEditor.Controls.Clear();
                phEditor.Controls.Add(Editor);
                Editor.EditingComplete += Editor_EditingComplete;
                Editor.LoadData();
            }
            else
            {
                msg.ShowError(Localization.GetString("GatewayTypeError"));
            }
        }
Пример #10
0
        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"));
            }
        }
Пример #11
0
        public void LoadEditor(string providerID)
        {
            Visible = true;
            var provider = TaxProviders.Find(providerID, HccApp.CurrentStore);

            Editor = HccPartController.LoadTaxProviderEditor(provider.ProviderName, Page) as HccTaxProviderPart;

            if (Editor != null)
            {
                ulActions.Visible = !Editor.HasOwnButtons;

                Editor.ID         = "TaxProviderEditor_" + provider.ProviderName;
                Editor.ProviderId = provider.ProviderId;
                phEditor.Controls.Clear();
                phEditor.Controls.Add(Editor);
                Editor.EditingComplete += Editor_EditingComplete;
                Editor.LoadData();
            }
            else
            {
                msg.ShowError(Localization.GetString("TaxProviderEditorError"));
            }
        }
 private void LoadBlockList()
 {
     lstBlocks.DataSource = HccPartController.FindContentBlocks();
     lstBlocks.DataBind();
 }
Пример #13
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     _Editor = (TextEditorBase)HccPartController.LoadDefaultEditor(Page);
     phEditor.Controls.Add(_Editor);
 }