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 "import":
                param[0] = "";
                var importXML = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderUploadsMapPath);
                var nbi       = new NBrightInfo(false);
                nbi.XMLData  = importXML;
                _recordXref  = new Dictionary <int, int>();
                _productList = new Dictionary <int, string>();
                DoImport(nbi);
                DoImportImages(nbi);
                DoImportDocs(nbi);

                /*
                 * Validation removed as it impact the performance of the import.
                 * A validation can be done by the store manager through the UI Admin Tools after the import.
                 */
//                    Validate();

                NBrightBuyUtils.RemoveModCachePortalWide(PortalId);
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, "completed", NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 2
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "save":
                Update();
                ShareProducts();
                param[0] = "ctrl=settings";
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "removelogo":
                var settings = ModCtrl.GetByGuidKey(PortalSettings.Current.PortalId, 0, "SETTINGS", "NBrightBuySettings");
                if (settings != null && settings.GetXmlProperty("genxml/hidden/hidemaillogo") != "")
                {
                    settings.SetXmlProperty("genxml/hidden/hidemaillogo", "");
                    settings.SetXmlProperty("genxml/hidden/emaillogourl", "");
                    settings.SetXmlProperty("genxml/hidden/emaillogopath", "");
                    ModCtrl.Update(settings);
                }
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 3
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "export":
                param[0] = "";
                DoExport();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "exportimages":
                param[0] = "";
                DoExportImages();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "exportdocs":
                param[0] = "";
                DoExportDocs();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 4
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "cleardownstore":
                param[0] = "";
                DoClearDown();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "validatestore":
                param[0] = "";
                NBrightBuyUtils.ValidateStore();
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, "validatecompleted", NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "purgecarts":
                param[0] = "";
                PurgeCarts();
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, "completed", NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetlangauge":
                param[0] = "";
                ResetLanguage();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetportalmenu":
                param[0] = "";
                ResetPortalMenu();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "purgeimages":
                param[0] = "";
                PurgeImages();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "runcustomprovider":
                var msg = RunCustomProvider();
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, "completed", NotifyCode.ok);
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 5
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "import":
                param[0] = "";
                var importXML = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderTempMapPath);
                var nbi       = new NBrightInfo(false);
                nbi.XMLData = importXML;

                // we're going to loop the records 2 times.
                // This is becuase the order of import could mean the xrefitemid and parentitemid cannot be updated on first pass.
                // doing this import 2 times ensures we get all records existing and hence we can create valid  xrefitemid and parentitemid fields.

                for (int i = 0; i < 2; i++)
                {
                    DoImport(nbi);
                }

                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "update":
                param[0] = "";
                var importXML2 = GenXmlFunctions.GetGenXml(rpData, "", StoreSettings.Current.FolderTempMapPath);
                var nbi2       = new NBrightInfo(false);
                nbi2.XMLData = importXML2;

                // this is a update to existsing data, so only need run once.
                DoImport(nbi2);

                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "cancel":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 6
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            if (_uid != "")
            {
                param[0] = "uid=" + _uid;
            }

            switch (e.CommandName.ToLower())
            {
            case "saveaddress":
                _addressData.AddAddress(rpAddr);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "deleteaddress":
                _addressData.RemoveAddress(e.Item.ItemIndex);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "editaddress":
                param[1] = "addressid=" + e.Item.ItemIndex.ToString("");
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "newaddress":
                param[1] = "addressid=-1";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "viewclient":
                param[1] = "ctrl=clients";
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "cancel":
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 7
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 groupData = new GroupData(-1, EditLanguage);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "delete":
                if (Utils.IsNumeric(cArg))
                {
                    ModCtrl.Delete(Convert.ToInt32(cArg));
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "saveall":
                SaveAll();
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + "save", NotifyCode.ok);
                NBrightBuyUtils.RemoveModCache(-1);     //clear any cache
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "move":
                if (Utils.IsNumeric(cArg))
                {
                    MoveRecord(Convert.ToInt32(cArg));
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 8
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg           = e.CommandArgument.ToString();
            var param          = new string[3];
            var navigationData = new NavigationData(PortalId, "ClientsAdmin");

            switch (e.CommandName.ToLower())
            {
            case "entrydetail":
                param[0] = "uid=" + cArg;
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "return":
                param[0] = "";
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "search":
                navigationData.XmlData = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.Save();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetsearch":
                // clear cookie info
                navigationData.Delete();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "unlockuser":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    clientData.UnlockUser();
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "deleteuser":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    clientData.DeleteUser();
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "restoreuser":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    clientData.RestoreUser();
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "removeuser":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    var ok         = clientData.RemoveUser();
                    if (!ok)
                    {
                        NBrightBuyUtils.SetNotfiyMessage(ModuleId, "removeuser", NotifyCode.fail);
                        param[0] = "uid=" + cArg;
                    }
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "validateuser":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    clientData.AuthoriseClient();
                    clientData.AddClientEditorRole();
                    if (StoreSettings.Current.Get("resetpasswordonclientvalidate") == "True")
                    {
                        clientData.ResetPassword();
                    }
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "unauthoriseuser":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    clientData.UnAuthoriseClient();
                    clientData.RemoveClientEditorRole();
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetpass":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    clientData.ResetPassword();
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "viewaddressbook":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    param[0] = "ctrl=addressbook";
                    param[1] = "uid=" + cArg;
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "vieworders":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    param[0] = "ctrl=orders";
                    param[1] = "uid=" + cArg;
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "createorder":
                param[0] = "";
                var tabId = TabId;
                if (Utils.IsNumeric(cArg))
                {
                    var cart = new CartData(PortalId);
                    cart.UserId   = Convert.ToInt32(cArg);
                    cart.EditMode = "C";
                    cart.Save();
                    tabId = StoreSettings.Current.GetInt("productlisttab");
                    if (tabId == 0)
                    {
                        tabId = TabId;
                    }
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(tabId, param), true);
                break;

            case "save":
                if (Utils.IsNumeric(cArg))
                {
                    var clientData = new ClientData(PortalId, Convert.ToInt32(cArg));
                    if (clientData.Exists)
                    {
                        clientData.Update(rpData);
                        clientData.Save();
                    }
                }
                param[0] = "uid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 9
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var param = new string[3];

            var navigationData = new NavigationData(PortalId, "CategoryAdmin");

            switch (e.CommandName.ToLower())
            {
            case "entrydetail":
                SaveAll();
                param[1] = "eid=" + cArg;
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "return":
                param[1] = "";
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "search":
                var strXml = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.XmlData = strXml;
                if (StoreSettings.Current.DebugModeFileOut)
                {
                    strXml = "<root><sql><![CDATA[" + navigationData.Criteria + "]]></sql>" + strXml + "</root>";
                    var xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.LoadXml(strXml);
                    xmlDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_search.xml");
                }
                navigationData.Save();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetsearch":
                // clear cookie info
                navigationData.Delete();
                param[2] = "catid=0";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "addnew":
                var strXml2 = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.XmlData = strXml2;
                navigationData.Save();
                var categoryData = CategoryUtils.GetCategoryData(-1, EditLanguage);
                if (!String.IsNullOrEmpty(Edittype) && Edittype.ToLower() == "group")
                {
                    categoryData.GroupType = GenXmlFunctions.GetGenXmlValue(navigationData.XmlData, "genxml/dropdownlist/groupsel");
                    if (categoryData.GroupType == "")
                    {
                        categoryData.GroupType = "cat";
                    }
                    var grpCtrl = new GrpCatController(Utils.GetCurrentCulture());
                    var grp     = grpCtrl.GetGrpCategoryByRef(categoryData.GroupType);
                    if (grp != null)
                    {
                        categoryData.DataRecord.SetXmlProperty("genxml/dropdownlist/ddlparentcatid", grp.categoryid.ToString(""));
                    }
                    categoryData.DataRecord.SetXmlProperty("genxml/checkbox/chkishidden", "False");     // don't hide property groups by default
                }
                categoryData.ParentItemId = _openid;
                categoryData.Save();
                NBrightBuyUtils.RemoveModCachePortalWide(PortalId);

                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "delete":
                if (Utils.IsNumeric(cArg))
                {
                    var catid = Convert.ToInt32(cArg);
                    if (catid > 0)
                    {
                        var delCatData = CategoryUtils.GetCategoryData(catid, EditLanguage);
                        if (delCatData.Exists && delCatData.GetDirectChildren().Count == 0)     // only delete end leaf
                        {
                            var productidlist = new ArrayList();
                            foreach (var dc in delCatData.GetDirectArticles())
                            {
                                productidlist.Add(dc.ParentItemId);
                            }

                            var parentCatList = new List <CategoryData>();
                            var loopCat       = CategoryUtils.GetCategoryData(catid, EditLanguage);
                            while (loopCat.Exists && loopCat.ParentItemId > 0)
                            {
                                loopCat = CategoryUtils.GetCategoryData(loopCat.ParentItemId, EditLanguage);
                                parentCatList.Add(loopCat);
                            }

                            foreach (var pCat in parentCatList)
                            {
                                foreach (var prodxref in pCat.GetCascadeArticles())
                                {
                                    if (productidlist.Contains(prodxref.ParentItemId))
                                    {
                                        // delete CATCASCADE record
                                        if (prodxref.TypeCode == "CATCASCADE")     // just check we have correct record. (stop nasty surprises)
                                        {
                                            ModCtrl.Delete(prodxref.ItemID);
                                        }
                                    }
                                }
                            }

                            foreach (var dc in delCatData.GetDirectArticles())
                            {
                                // delete CATXREF record
                                if (dc.TypeCode == "CATXREF")     // just check we have correct record. (stop nasty surprises)
                                {
                                    ModCtrl.Delete(dc.ItemID);
                                }
                            }
                            // delete CATEGORY record (constrants remove LANG records.)
                            ModCtrl.Delete(catid);
                        }
                        else
                        {
                            NBrightBuyUtils.SetNotfiyMessage(ModuleId, "onlyleafcat", NotifyCode.fail);
                        }
                    }
                }
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "saveall":
                SaveAll();
                NBrightBuyUtils.RemoveModCachePortalWide(PortalId);     //clear any cache
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "move":
                SaveAll();
                if (Utils.IsNumeric(cArg))
                {
                    MoveRecord(Convert.ToInt32(cArg));
                }
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "open":
                param[1] = "catid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "close":
                var catData = CategoryUtils.GetCategoryData(_openid, EditLanguage);
                if (catData.DataRecord == null)
                {
                    param[1] = "catid=0";
                }
                else
                {
                    param[1] = "catid=" + catData.DataRecord.ParentItemId.ToString("");
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "save":
                UpdateRecord();
                param[1] = "eid=" + cArg;
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "saveexit":
                UpdateRecord();
                param[2] = "catid=" + _openid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 10
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg   = e.CommandArgument.ToString();
            var rtntab = Utils.RequestQueryStringParam(Request, "rtntab");
            var rtneid = Utils.RequestQueryStringParam(Request, "rtneid");

            var param = new string[3];

            switch (e.CommandName.ToLower())
            {
            case "delete":
                Delete(cArg);
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "save":
                Update(_eid);
                param[0] = "eid=" + cArg;
                if (rtntab != "")
                {
                    param[1] = "rtntab=" + rtntab;
                }
                if (rtneid != "")
                {
                    param[2] = "rtneid=" + rtneid;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "copy":
                if (_eid > 0 && Utils.IsNumeric(cArg))
                {
                    var newid = Copy(cArg);
                    param[0] = "eid=" + newid;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "saveexit":
                Update(_eid);
                if (rtntab != "")
                {
                    param[0] = "tabid=" + rtntab;
                }
                if (rtneid != "")
                {
                    param[1] = "eid=" + rtneid;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "edit":
                param[0] = "eid=" + cArg;
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "return":
                if (rtntab != "")
                {
                    param[0] = "tabid=" + rtntab;
                }
                if (rtneid != "")
                {
                    param[1] = "eid=" + rtneid;
                }
                if (_page != "")
                {
                    param[2] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "addnew":
                param[0] = "eid=" + AddNew();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 11
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var tabId = TabId;
            var param = new string[4];

            if (_uid != "")
            {
                param[0] = "uid=" + _uid;
            }
            var navigationData = new NavigationData(PortalId, "AdminOrders");
            var cmd            = e.CommandName.ToLower();
            var resxpath       = StoreSettings.NBrightBuyPath() + "/App_LocalResources/Notification.ascx.resx";
            var emailoption    = "";

            switch (cmd)
            {
            case "entrydetail":
                param[0] = "eid=" + cArg;
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "reorder":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    orderData.CopyToCart(DebugMode);
                    tabId = StoreSettings.Current.GetInt("carttab");
                    if (tabId == 0)
                    {
                        tabId = TabId;
                    }
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(tabId, param), true);
                break;

            case "editorder":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    orderData.ConvertToCart(DebugMode);
                    tabId = StoreSettings.Current.GetInt("carttab");
                    if (tabId == 0)
                    {
                        tabId = TabId;
                    }
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(tabId, param), true);
                break;

            case "return":
                param[0] = "";
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "search":
                var strXml = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.Build(strXml, _templSearch);
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpSearch);
                navigationData.XmlData = GenXmlFunctions.GetGenXml(rpSearch);
                navigationData.Save();
                if (StoreSettings.Current.DebugModeFileOut)
                {
                    strXml = "<root><sql><![CDATA[" + navigationData.Criteria + "]]></sql>" + strXml + "</root>";
                    var xmlDoc = new System.Xml.XmlDocument();
                    xmlDoc.LoadXml(strXml);
                    xmlDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_search.xml");
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetsearch":
                // clear cookie info
                navigationData.Delete();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "orderby":
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpData);
                navigationData.Save();
                break;

            case "viewclient":
                param[1] = "ctrl=clients";
                if (Utils.IsNumeric(cArg))
                {
                    var orderData = new OrderData(PortalId, Convert.ToInt32(cArg));
                    param[0] = "uid=" + orderData.UserId.ToString("");
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "save":
                param[0] = "eid=" + _entryid;
                var result = Update();
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, result);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "printorder":
                param[0] = "eid=" + _entryid;
                param[1] = "print=printorder";
                param[2] = "template=printorder.html";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "printreceipt":
                param[0] = "eid=" + _entryid;
                param[1] = "print=printorder";
                param[2] = "template=printreceipt.html";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "printdeliverylabel":
                param[0] = "eid=" + _entryid;
                param[1] = "print=printorder";
                param[2] = "template=printdeliverylabel.html";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailamended":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("orderamended_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "orderamendedemail.html", "orderamended_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailreceipt":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("orderreceipt_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "orderreceiptemail.html", "orderreceipt_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailshipped":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("ordershipped_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "ordershippedemail.html", "ordershipped_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "emailvalidated":
                param[0]    = "eid=" + _entryid;
                emailoption = DnnUtils.GetLocalizedString("ordervalidated_emailsubject.Text", resxpath, Utils.GetCurrentCulture());
                Update(emailoption);
                SendOrderEmail(Convert.ToInt32(_entryid), "ordervalidatedemail.html", "ordervalidated_emailsubject.Text");
                NBrightBuyUtils.SetNotfiyMessage(ModuleId, NotifyRef + cmd, NotifyCode.ok);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "downloadinvoice":
                DownloadInvoice(Convert.ToInt32(cArg));
                break;

            case "deleteinvoice":
                DeleteInvoice(Convert.ToInt32(cArg));
                param[0] = "eid=" + _entryid;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "export":
                DoExport();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg  = e.CommandArgument.ToString();
            var tabId = TabId;
            var param = new string[4];

            if (_uid != "")
            {
                param[0] = "uid=" + _uid;
            }
            var navigationData = new NavigationData(PortalId, "AdminOrders");
            var cmd            = e.CommandName.ToLower();
            var resxpath       = StoreSettings.NBrightBuyPath() + "/App_LocalResources/Notification.ascx.resx";
            var emailoption    = "";

            switch (cmd)
            {
            case "entrydetail":
                param[0] = "eid=" + cArg;
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "movetoorder":
                param[0] = "";
                if (Utils.IsNumeric(cArg))
                {
                    var obj = ModCtrl.Get(Convert.ToInt32(cArg));
                    obj.TypeCode = "ORDER";
                    ModCtrl.Update(obj);
                    var ordData = new OrderData(obj.ItemID);
                    ordData.OrderStatus = "010";
                    ordData.CreatedDate = DateTime.Now.ToString("O");
                    ordData.OrderNumber = obj.ItemID.ToString();
                    ordData.AddAuditMessage(DnnUtils.GetLocalizedString("movetoordermsg.Text", "/DesktopModules/NBright/NBrightBuyCartReview/Themes/config/resx", Utils.GetCurrentCulture()), "msg", UserInfo.Username, "False");
                    ordData.Save();
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "return":
                param[0] = "";
                if (_page != "")
                {
                    param[1] = "page=" + _page;
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "search":
                var strXml = GenXmlFunctions.GetGenXml(rpSearch, "", "");
                navigationData.Build(strXml, _templSearch);
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpSearch);
                navigationData.XmlData = GenXmlFunctions.GetGenXml(rpSearch);
                navigationData.Save();
                if (StoreSettings.Current.DebugModeFileOut)
                {
                    strXml = "<root><sql><![CDATA[" + navigationData.Criteria + "]]></sql>" + strXml + "</root>";
                    var xmlDoc = new System.Xml.XmlDataDocument();
                    xmlDoc.LoadXml(strXml);
                    xmlDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_search.xml");
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetsearch":
                // clear cookie info
                navigationData.Delete();
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "orderby":
                navigationData.OrderBy = GenXmlFunctions.GetSqlOrderBy(rpData);
                navigationData.Save();
                break;

            case "viewclient":
                param[1] = "ctrl=clients";
                if (Utils.IsNumeric(cArg))
                {
                    var cartData = new CartData(Convert.ToInt32(cArg));
                    param[0] = "uid=" + cartData.UserId.ToString("");
                }
                Response.Redirect(Globals.NavigateURL(TabId, "", param), true);
                break;

            case "delete":
                if (Utils.IsNumeric(cArg))
                {
                    ModCtrl.Delete(Convert.ToInt32(cArg));
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }
Ejemplo n.º 13
0
        protected void CtrlItemCommand(object source, RepeaterCommandEventArgs e)
        {
            var cArg       = e.CommandArgument.ToString();
            var param      = new string[3];
            var pluginData = new PluginData(PortalId);

            switch (e.CommandName.ToLower())
            {
            case "entrydetail":
                param[0] = "eid=" + cArg;
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "move":
                MoveRecord(cArg);
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "save":
                if (Utils.IsNumeric(cArg))
                {
                    pluginData.UpdatePlugin(rpData, Convert.ToInt32(cArg));
                    pluginData.Save();
                }
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "add":
                pluginData.AddNewPlugin();
                pluginData.Save();
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "delete":
                // NOTE: The delete button cannot work at portal level.  Each plugin must be entered at system level, therefore deleting at portal level has no effect
                // the plugin is re-entered back into the portal from the system level. (This is CORRECT, pluging needs to be uninstalled to be removed, at portal level we simply hide them)
                if (Utils.IsNumeric(cArg))
                {
                    pluginData.RemovePlugin(Convert.ToInt32(cArg));
                    pluginData.Save();
                }
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "resetportal":
                pluginData.RemovePortalLevel();
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "reload":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;

            case "return":
                param[0] = "";
                Response.Redirect(NBrightBuyUtils.AdminUrl(TabId, param), true);
                break;
            }
        }