Ejemplo n.º 1
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
                case "addnew":
                    var discountcodes = new DiscountCodesData(_ctrlkey);
                    discountcodes.AddNewRule();
                    discountcodes.Save();
                    Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                    break;
                case "delete":
                    if (Utils.IsNumeric(cArg))
                    {
                        var discountcodes2 = new DiscountCodesData(_ctrlkey);
                        discountcodes2.RemoveRule(Convert.ToInt32(cArg));
                        discountcodes2.Save();
                    }
                    Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                    break;
                case "saveall":
                    Update();
                    Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                    break;
                case "cancel":
                    Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                    break;
            }
        }
Ejemplo n.º 2
0
        private void Update()
        {
            var discountCodes = new DiscountCodesData(_ctrlkey);

            discountCodes.Update(rpDataH);
            discountCodes.UpdateRule(rpData);
            discountCodes.Save();

            if (StoreSettings.Current.DebugMode) discountCodes.Info.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "\\debug_discountcodes.xml");

            //remove current setting from cache for reload
            Utils.RemoveCache("NBrightBuyDiscountCodes" + PortalSettings.Current.PortalId.ToString(""));
        }
Ejemplo n.º 3
0
        private void PageLoad()
        {
            if (UserId > 0) // only logged in users can see data on this module.
            {
                var discountcodes = new DiscountCodesData(_ctrlkey);
                rpData.DataSource = discountcodes.GetRuleList();
                rpData.DataBind();

                // display header
                base.DoDetail(rpDataH, discountcodes.Info);

                // display footer
                base.DoDetail(rpDataF);
            }
        }