Beispiel #1
0
        private string GetReturnTemplate(OrderData orderData, bool paymentok, string paymenterror)
        {
            var info = ProviderUtils.GetProviderSettings();

            info.UserId = UserController.Instance.GetCurrentUserInfo().UserID;
            var templ        = "";
            var passSettings = NBrightBuyUtils.GetPassSettings(info);

            if (passSettings.ContainsKey("paymenterror"))
            {
                passSettings.Add("paymenterror", paymenterror);
            }
            var displaytemplate = "payment_ok.cshtml";

            if (paymentok)
            {
                info.SetXmlProperty("genxml/ordernumber", orderData.OrderNumber);
                templ = NBrightBuyUtils.RazorTemplRender(displaytemplate, 0, "", info, "/DesktopModules/NBright/NBrightPayBox", "config", Utils.GetCurrentCulture(), passSettings);
            }
            else
            {
                displaytemplate = "payment_fail.cshtml";
                templ           = NBrightBuyUtils.RazorTemplRender(displaytemplate, 0, "", info, "/DesktopModules/NBright/NBrightPayBox", "config", Utils.GetCurrentCulture(), passSettings);
            }

            return(templ);
        }
Beispiel #2
0
        public static String PluginAddNew(HttpContext context)
        {
            try
            {
                if (NBrightBuyUtils.CheckRights())
                {
                    var ajaxInfo = NBrightBuyUtils.GetAjaxInfo(context);

                    var strOut      = "";
                    var themeFolder = ajaxInfo.GetXmlProperty("genxml/hidden/themefolder");
                    if (themeFolder == "")
                    {
                        themeFolder = "config";
                    }
                    var razortemplate = ajaxInfo.GetXmlProperty("genxml/hidden/razortemplate");

                    var passSettings = NBrightBuyUtils.GetPassSettings(ajaxInfo);

                    var info = new NBrightInfo(true);
                    info.ItemID   = -1;
                    info.PortalId = PortalSettings.Current.PortalId;
                    info.Lang     = Utils.GetCurrentCulture();
                    info.SetXmlProperty("genxml/hidden/index", "99");
                    info.TypeCode = "PLUGIN";
                    info.GUIDKey  = Utils.GetUniqueKey(12);
                    var objCtrl = new NBrightBuyController();
                    info.ItemID = objCtrl.Update(info);
                    var pluginRecord = new PluginRecord(info);

                    strOut = NBrightBuyUtils.RazorTemplRender(razortemplate, 0, "", pluginRecord, TemplateRelPath, themeFolder, Utils.GetCurrentCulture(), passSettings);
                    return(strOut);
                }
                return("");
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
        public static String PluginAdminDetail(HttpContext context)
        {
            try
            {
                if (NBrightBuyUtils.CheckRights())
                {
                    var ajaxInfo = NBrightBuyUtils.GetAjaxInfo(context);

                    var strOut         = "";
                    var selecteditemid = ajaxInfo.GetXmlProperty("genxml/hidden/selecteditemid");
                    if (Utils.IsNumeric(selecteditemid))
                    {
                        var themeFolder = ajaxInfo.GetXmlProperty("genxml/hidden/themefolder");
                        if (themeFolder == "")
                        {
                            themeFolder = "config";
                        }
                        var razortemplate = ajaxInfo.GetXmlProperty("genxml/hidden/razortemplate");

                        var passSettings = NBrightBuyUtils.GetPassSettings(ajaxInfo);

                        var objCtrl      = new NBrightBuyController();
                        var info         = objCtrl.GetData(Convert.ToInt32(selecteditemid));
                        var pluginRecord = new PluginRecord(info);

                        strOut = NBrightBuyUtils.RazorTemplRender(razortemplate, 0, "", pluginRecord, TemplateRelPath, themeFolder, Utils.GetCurrentCulture(), passSettings);
                    }
                    return(strOut);
                }
                return("");
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Beispiel #4
0
        private static string GetShippingProviderTemplates(HttpContext context)
        {
            var ajaxInfo       = NBrightBuyUtils.GetAjaxInfo(context);
            var activeprovider = ajaxInfo.GetXmlProperty("genxml/radiobuttonlist/shippingprovider");
            var currentcart    = new CartData(PortalSettings.Current.PortalId);

            var shipoption = currentcart.GetShippingOption(); // we don't want to overwrite the selected shipping option.

            currentcart.AddExtraInfo(ajaxInfo);
            currentcart.SetShippingOption(shipoption);
            currentcart.Save();

            if (activeprovider == "")
            {
                activeprovider = currentcart.PurchaseInfo.GetXmlProperty("genxml/extrainfo/genxml/radiobuttonlist/shippingprovider");
            }


            var strRtn     = "";
            var pluginData = new PluginData(PortalSettings.Current.PortalId);
            var provList   = pluginData.GetShippingProviders();

            if (provList != null && provList.Count > 0)
            {
                if (activeprovider == "")
                {
                    activeprovider = provList.First().Key;
                }
                foreach (var d in provList)
                {
                    if (activeprovider == d.Key)
                    {
                        var p           = d.Value;
                        var shippingkey = p.GetXmlProperty("genxml/textbox/ctrl");
                        var shipprov    = ShippingInterface.Instance(shippingkey);
                        if (shipprov != null)
                        {
                            var razorTempl = shipprov.GetTemplate(currentcart.PurchaseInfo);
                            if (razorTempl != "")
                            {
                                var objList = new List <NBrightInfo>();
                                objList.Add(currentcart.PurchaseInfo);

                                var nbRazor = new NBrightRazor(objList.Cast <object>().ToList(), NBrightBuyUtils.GetPassSettings(ajaxInfo), HttpContext.Current.Request.QueryString);
                                nbRazor.ModuleId         = -1;
                                nbRazor.FullTemplateName = "";
                                nbRazor.TemplateName     = "";
                                nbRazor.ThemeFolder      = "";
                                nbRazor.Lang             = Utils.GetCurrentCulture();

                                strRtn += NBrightBuyUtils.RazorRender(nbRazor, razorTempl, shippingkey + "shippingtemplate", true);
                            }
                        }
                    }
                }
            }
            return(strRtn);
        }