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; } }
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; } }
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; } }