public static string GetProductItemListPopup(ItemListData itemListData, string listkey = "", string entityTypeCode = "PRD", string entityTypeCodeLang = "PRDLANG") { var ajaxInfo = new NBrightInfo(true); ajaxInfo.SetXmlProperty("genxml/products", itemListData.products); ajaxInfo.SetXmlProperty("genxml/listkeys", itemListData.listkeys); ajaxInfo.SetXmlProperty("genxml/list", ""); foreach (var l in itemListData.listnames) { ajaxInfo.SetXmlProperty("genxml/list/" + l.Key, l.Value); } ajaxInfo.SetXmlProperty("genxml/productsinlist", ""); foreach (var l in itemListData.productsInList) { ajaxInfo.SetXmlProperty("genxml/productsinlist/" + l.Key, l.Value); } var modelsetings = StoreSettings.Current.Settings(); if (!modelsetings.ContainsKey("listkeys")) { modelsetings.Add("listkeys", itemListData.listkeys); } var strOut = NBrightBuyUtils.RazorTemplRender("ItemListPopupBody.cshtml", -1, "", ajaxInfo, "/DesktopModules/NBright/NBrightBuy", _themeFolder, Utils.GetCurrentCulture(), modelsetings); return(strOut); }
public Transaction(float transactionID, ItemListData itemListData, string paymentMethod, string datetime) { this.transactionID = transactionID; this.itemListData = itemListData; this.paymentMethod = paymentMethod; this.datetime = datetime; }
public HttpResponseMessage GetItemList(int pageindex, int pagesize) { ItemListData data = new ItemListData(); data.page = pageindex; data.totalPages = 10; data.toast = "test"; AppoDatalist[] items = new AppoDatalist[pagesize]; int index = (pageindex - 1) * pagesize; int j; for (int i = 0; i < pagesize; i++) { j = ++index; items[i] = new AppoDatalist(); items[i].id = j.ToString(); items[i].description = "description " + j.ToString(); items[i].left = "left " + j.ToString(); items[i].right = "right " + j.ToString(); items[i].title = "title " + j.ToString(); items[i].imageIcon = "http://api.androidhive.info/images/glide/medium/dory.jpg"; } data.items = items; string json = JsonConvert.SerializeObject(data); using (JsonTextReader reader = new JsonTextReader(new StringReader(json))) { JObject o2 = (JObject)JToken.ReadFrom(reader); return(this.Request.CreateResponse(HttpStatusCode.OK, o2, "application/json")); } }
public static List <NBrightInfo> GetProductItemList(ItemListData itemListData, string listkey = "", string entityTypeCode = "PRD", string entityTypeCodeLang = "PRDLANG") { var strOut = ""; var strFilter = ""; var rtnList = new List <NBrightInfo>(); if (itemListData.Exists && itemListData.ItemCount > 0) { var ModCtrl = new NBrightBuyController(); if (listkey == "") { foreach (var i in itemListData.listnames) { var itemlist = itemListData.GetItemList(i.Key); if (itemlist.Count > 0) { strFilter = " and ("; foreach (var i2 in itemlist) { strFilter += " NB1.itemid = '" + i2 + "' or"; } strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") "; strFilter += " and (NB3.Visible = 1) "; var l = ModCtrl.GetDataList(PortalSettings.Current.PortalId, -1, entityTypeCode, entityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, "", true); foreach (var n in l) { n.SetXmlProperty("genxml/listkey", i.Key); rtnList.Add(n); } } } } else { var itemlist = itemListData.GetItemList(listkey); if (itemlist.Count > 0) { strFilter = " and ("; foreach (var i in itemlist) { strFilter += " NB1.itemid = '" + i + "' or"; } strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") "; strFilter += " and (NB3.Visible = 1) "; var l = ModCtrl.GetDataList(PortalSettings.Current.PortalId, -1, _entityTypeCode, _entityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, "", true); foreach (var n in l) { n.SetXmlProperty("genxml/listkey", listkey); rtnList.Add(n); } } } } return(rtnList); }
public static void CreateWindow(ItemListData itemList, int firtItemSelected) { ItemListWindow window = (ItemListWindow)EditorWindow.GetWindow(typeof(ItemListWindow), false, "ItemList Editor"); Instance = window; window.itemList = itemList; window.skin = Resources.Load("skin") as GUISkin; Instance.Init(firtItemSelected); }
void OnGUI() { if (!skin) { skin = Resources.Load("skin") as GUISkin; } GUI.skin = skin; this.minSize = rect; this.titleContent = new GUIContent("Inventory System", null, "ItemManager Creator Window"); m_Logo = Resources.Load("icon_v2") as Texture2D; GUILayout.BeginVertical("ItemManager Creator Window", "window"); GUILayout.Label(m_Logo, GUILayout.MaxHeight(25)); GUILayout.Space(5); GUILayout.BeginVertical("box"); inventoryPrefab = EditorGUILayout.ObjectField("Inventory Prefab: ", inventoryPrefab, typeof(Inventory), false) as Inventory; itemListData = EditorGUILayout.ObjectField("Item List Data: ", itemListData, typeof(ItemListData), false) as ItemListData; if (inventoryPrefab != null && inventoryPrefab.GetComponent <Inventory>() == null) { EditorGUILayout.HelpBox("Please select a Inventory Prefab that contains the vInventory script", MessageType.Warning); } GUILayout.EndVertical(); GUILayout.BeginHorizontal("box"); EditorGUILayout.LabelField("Need to know how it works?"); if (GUILayout.Button("Video Tutorial")) { //Application.OpenURL("https://www.youtube.com/watch?v=1aA_PU9-G-0&index=3&list=PLvgXGzhT_qehtuCYl2oyL-LrWoT7fhg9d"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (inventoryPrefab != null && itemListData != null) { if (Selection.activeGameObject != null && Selection.activeGameObject.GetComponent <PlayerController>() != null) { if (GUILayout.Button("Create")) { Create(); } } else { EditorGUILayout.HelpBox("Please select the Player to add this component", MessageType.Warning); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public static string GetProductItemListHtml(ItemListData itemListData, string listkey = "", string entityTypeCode = "PRD", string entityTypeCodeLang = "PRDLANG") { var strOut = ""; var rtnList = GetProductItemList(itemListData, listkey, entityTypeCode, entityTypeCodeLang); var modelsetings = StoreSettings.Current.Settings(); if (!modelsetings.ContainsKey("listkeys")) { modelsetings.Add("listkeys", itemListData.listkeys); } strOut = NBrightBuyUtils.RazorTemplRenderList(_templatename, -1, "", rtnList, "/DesktopModules/NBright/NBrightBuy", _themeFolder, Utils.GetCurrentCulture(), modelsetings); return(strOut); }
void OnWorkshopListLoaded(WorkshopItemListEventArgs args, ItemListData data) { gettingItemList = false; if (args.IsError) { Debug.Log($"Sorry, encountered an error: {args.ErrorMessage}"); return; } if (!itemListData.Equals(data)) { Invoke("CreateSteamThumbnails", .1f); return; } pageCount = args.ItemList.PagesItems; workingFeedback.SetActive(false); if (args.ItemList.Items.Count == 0) { noResultsFeedback.SetActive(true); } foreach (WorkshopItem item in args.ItemList.Items) { GameThumbnail gameThumbnail = Instantiate(gameThumbnailPrefab).GetComponent <GameThumbnail>(); if (item.PreviewImageURL != null && item.PreviewImageURL.Length > 0) { gameThumbnail.SetThumbnailUrl(item.PreviewImageURL); } else { gameThumbnail.SetThumbnail(placeholderThumbnailTexture); } gameThumbnail.SetGameSource(GameDetail.GameSource.Workshop); gameThumbnail.SetName(item.Name); gameThumbnail.OnClick = () => OpenWorkshopEntry(gameThumbnail, item); gameThumbnail.GetDescription = () => { return(item.Description); }; AddThumbnail(gameThumbnail); } }
void CreateSteamThumbnails() { itemListData = new ItemListData() { sort = workshopSort, searchString = currentSearchString, page = curPage }; if (gettingItemList) { return; } if (!SteamManager.Initialized) { Debug.Log($"Steam Workshop is not available right now. Did you launch from Steam?"); return; } workingFeedback.SetActive(true); noResultsFeedback.SetActive(false); // TODO need to edit SteamWorkshopMain to use SetExcludeTags and exclude Assets SteamWorkshopMain.Instance.ResetItemSearch(); SteamWorkshopMain.Instance.SearchText = currentSearchString; SteamWorkshopMain.Instance.m_excludeTags.Add(SteamUtil.GameBuilderTags.Asset.ToString()); SteamWorkshopMain.Instance.Sorting = new WorkshopSortMode(GetSortMode()); itemListData = new ItemListData() { sort = workshopSort, searchString = currentSearchString, page = curPage }; ItemListData data = itemListData; gettingItemList = true; SteamWorkshopMain.Instance.GetItemList(curPage, (args) => OnWorkshopListLoaded(args, data)); }
private void PageLoad() { if (UserId > 0) // limit module to registered users { // new data record so set defaults. var cw = new ItemListData(PortalId, UserController.Instance.GetCurrentUserInfo().UserID); var objList = ItemListsFunctions.GetProductItemList(cw); if (ModSettings.Settings().ContainsKey("listkeys")) { ModSettings.Settings().Remove("listkeys"); } ModSettings.Settings().Add("listkeys", cw.listkeys); var strOut = NBrightBuyUtils.RazorTemplRenderList(RazorTemplate, ModuleId, "", objList, ControlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings()); var lit = new Literal(); lit.Text = strOut; phData.Controls.Add(lit); } }
private void PageLoad() { NBrightInfo objCat = null; #region "Data Repeater" if (_templD.Trim() != "") // if we don;t have a template, don't do anything { if (_displayentrypage) { // get correct itemid, based on eid given if (_ename != "") { var o = ModCtrl.GetByGuidKey(PortalId, ModuleId, EntityTypeCodeLang, _ename); if (o == null) { o = ModCtrl.GetByGuidKey(PortalId, ModuleId, EntityTypeCode, _ename); if (o != null) { _eid = o.ItemID.ToString(""); } } else { _eid = o.ParentItemId.ToString(""); } } DisplayDataEntryRepeater(_eid); } else { #region "Order BY" // get orderby from header if it's there var cachekey = "GetSqlOrderBy*rpDataH" + _templH + "*" + ModuleId.ToString(); _strOrder = (String)Utils.GetCache(cachekey); if (_strOrder == null || StoreSettings.Current.DebugMode) { _strOrder = GenXmlFunctions.GetSqlOrderBy(rpDataH); } //Default orderby if not set if (String.IsNullOrEmpty(_strOrder)) { _strOrder = " Order by ModifiedDate DESC "; } // NOTE: This setting may be overwritten by the navigatedata class in the filter setup #endregion #region "Get Paging setup" //See if we have a pagesize, uses the "searchpagesize" tag token. // : This can be overwritten by the cookie value if we need user selection of pagesize. CtrlPaging.Visible = false; #region "Get pagesize, from best place" var pageSize = 0; if (Utils.IsNumeric(_navigationdata.PageSize)) { pageSize = Convert.ToInt32(_navigationdata.PageSize); } if (!Utils.IsNumeric(pageSize) && Utils.IsNumeric(ModSettings.Get("pagesize"))) { pageSize = Convert.ToInt32(ModSettings.Get("pagesize")); } //check for url param page size if (Utils.IsNumeric(_pagesize) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture))) { pageSize = Convert.ToInt32(_pagesize); } if (pageSize == 0) { var strPgSize = ""; if (_templateHeader != null) { strPgSize = _templateHeader.GetHiddenFieldValue("searchpagesize"); } if (_templateHeader != null && strPgSize == "") { strPgSize = _templateHeader.GetHiddenFieldValue("pagesize"); } if (Utils.IsNumeric(strPgSize)) { pageSize = Convert.ToInt32(strPgSize); } } if (pageSize > 0) { CtrlPaging.Visible = true; } _navigationdata.PageSize = pageSize.ToString(""); #endregion var pageNumber = 1; //check for url param paging if (Utils.IsNumeric(_pagenum) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture))) { pageNumber = Convert.ToInt32(_pagenum); } //Get returnlimt from module settings var returnlimit = 0; var strreturnlimit = ModSettings.Get("returnlimit"); if (Utils.IsNumeric(strreturnlimit)) { returnlimit = Convert.ToInt32(strreturnlimit); } #endregion #region "Get filter setup" // check the display header to see if we have a sqlfilter defined. var strFilter = ""; cachekey = "GetSqlSearchFilters*rpDataH" + _templH + "*" + ModuleId.ToString(); var strHeaderFilter = (String)Utils.GetCache(cachekey); if (strHeaderFilter == null || StoreSettings.Current.DebugMode) { strHeaderFilter = GenXmlFunctions.GetSqlSearchFilters(rpDataH); } // filter mode and will persist past category selection. if ((_catid == "" && _catname == "")) { if (!_navigationdata.FilterMode) { _navigationdata.CategoryId = 0; // filter mode persist catid } // if navdata is not deleted then get filter from navdata, created by productsearch module. strFilter = _navigationdata.Criteria; if (!strFilter.Contains(strHeaderFilter)) { strFilter += " " + strHeaderFilter; } if (!String.IsNullOrEmpty(_navigationdata.OrderBy)) { _strOrder = _navigationdata.OrderBy; } if (_navigationdata.Mode.ToLower() == "s") { _navigationdata.ResetSearch(); // single search so clear after } } else { _navigationdata.ResetSearch(); // We have a category selected (in url), so overwrite categoryid navigationdata. // This allows the return to the same category after a returning from a entry view. if (Utils.IsNumeric(_catid)) { _navigationdata.CategoryId = Convert.ToInt32(_catid); } strFilter = strHeaderFilter; } #endregion #region "Get Category select setup" //get default catid. var catseo = _catid; var defcatid = ModSettings.Get("defaultcatid"); if (Utils.IsNumeric(defcatid)) { // if we have no filter use the default category if (_catid == "" && strFilter.Trim() == "") { _catid = defcatid; } // If we have a static list,then always display the default category if (ModSettings.Get("staticlist") == "True") { _catid = defcatid; } } else { defcatid = ModSettings.Get("defaultpropertyid"); if (Utils.IsNumeric(defcatid)) { // if we have no filter use the default category if (_catid == "" && strFilter.Trim() == "") { _catid = defcatid; } // If we have a static list,then always display the default category if (ModSettings.Get("staticlist") == "True") { _catid = defcatid; } } } //check if we are display categories // get category list data if (_catname != "") // if catname passed in url, calculate what the catid is { objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORYLANG", _catname); if (objCat == null) { // check it's not just a single language objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORY", _catname); if (objCat != null) { _catid = objCat.ItemID.ToString(""); } } else { _catid = objCat.ParentItemId.ToString(""); if (!String.IsNullOrEmpty(objCat.GUIDKey) && Utils.IsNumeric(_catid) && objCat.Lang != Utils.GetCurrentCulture()) { // do a 301 redirect to correct url for the langauge (If the langauge is changed on the product list, we need to make sure we have the correct catref for the langauge) var catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture()); var activeCat = catGrpCtrl.GetCategory(Convert.ToInt32(_catid)); if (activeCat != null && (activeCat.categoryrefGUIDKey == _catname)) { var redirecturl = ""; if (Utils.IsNumeric(_eid)) { var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture()); redirecturl = NBrightBuyUtils.GetEntryUrl(PortalId, _eid, _modkey, prdData.SEOName, TabId.ToString(), "", activeCat.categoryrefGUIDKey); } else { redirecturl = catGrpCtrl.GetCategoryUrl(activeCat, TabId, objCat.Lang); } try { if (redirecturl != "") { Response.Redirect(redirecturl, false); Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently; Response.End(); } } catch (Exception) { // catch err } } } } // We have a category selected (in url), so overwrite categoryid navigationdata. // This allows the return to the same category after a returning from a entry view. if (Utils.IsNumeric(_catid)) { _navigationdata.CategoryId = Convert.ToInt32(_catid); } catseo = _catid; } if (Utils.IsNumeric(_catid)) { var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DataProvider.Instance().DatabaseOwner; if (ModSettings.Get("chkcascaderesults").ToLower() == "true") { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") "; } else { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") "; } if (Utils.IsNumeric(catseo)) { var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catseo), "CATEGORYLANG", Utils.GetCurrentCulture()); if (objSEOCat != null && _eid == "") // we may have a detail page and listonly module, in which can we need the product detail as page title { //Page Title var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname"); if (seoname == "") { seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname"); } var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle"); if (newBaseTitle == "") { newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname"); } if (newBaseTitle == "") { newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname"); } if (newBaseTitle != "") { BasePage.Title = newBaseTitle; } //Page KeyWords var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords"); if (newBaseKeyWords != "") { BasePage.KeyWords = newBaseKeyWords; } //Page Description var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription"); if (newBaseDescription == "") { newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc"); } if (newBaseDescription != "") { BasePage.Description = newBaseDescription; } if (PortalSettings.HomeTabId == TabId) { PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site. } else { PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, seoname, Utils.GetCurrentCulture())); } } } if (_strOrder == "{bycategoryproduct}") { _strOrder += _catid; // do special custom sort in each cateogry } } else { if (!_navigationdata.FilterMode) { _navigationdata.CategoryId = 0; // filter mode persist catid } if (_strOrder == "{bycategoryproduct}") { _strOrder = " Order by ModifiedDate DESC "; } } #endregion #region "Apply provider product filter" // Special filtering can be done, by using the ProductFilter interface. var productfilterkey = ""; if (_templateHeader != null) { productfilterkey = _templateHeader.GetHiddenFieldValue("providerfilterkey"); } if (productfilterkey != "") { var provfilter = FilterInterface.Instance(productfilterkey); if (provfilter != null) { strFilter = provfilter.GetFilter(strFilter, _navigationdata, ModSettings, Context); } } #endregion #region "itemlists (wishlist)" // if we have a itemListName field then get the itemlist cookie. if (_templateHeader != null) { _itemListName = _templateHeader.GetHiddenFieldValue("itemlistname"); } if (_itemListName != "") { var cw = new ItemListData(_itemListName); if (cw.Exists && cw.ItemCount > 0) { strFilter = " and ("; foreach (var i in cw.GetItemList()) { strFilter += " NB1.itemid = '" + i + "' or"; } strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") "; // remove the last "or" } else { //no data in list so select false itemid to stop anything displaying strFilter += " and (NB1.itemid = '-1') "; } } #endregion // save navigation data _navigationdata.PageModuleId = Utils.RequestParam(Context, "pagemid"); _navigationdata.PageNumber = Utils.RequestParam(Context, "page"); if (Utils.IsNumeric(_catid)) { _navigationdata.PageName = NBrightBuyUtils.GetCurrentPageName(Convert.ToInt32(_catid)); } // save the last active modulekey to a cookie, so it can be used by the "NBrightBuyUtils.GetReturnUrl" function NBrightCore.common.Cookie.SetCookieValue(PortalId, "NBrigthBuyLastActive", "ModuleKey", ModuleKey, 1); strFilter += " and (NB3.Visible = 1) "; // get only visible products var recordCount = ModCtrl.GetDataListCount(PortalId, ModuleId, "PRD", strFilter, "PRDLANG", Utils.GetCurrentCulture(), DebugMode); _navigationdata.RecordCount = recordCount.ToString(""); _navigationdata.Save(); if (returnlimit > 0 && returnlimit < recordCount) { recordCount = returnlimit; } var l = ModCtrl.GetDataList(PortalId, ModuleId, "PRD", "PRDLANG", Utils.GetCurrentCulture(), strFilter, _strOrder, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount); rpData.DataSource = l; rpData.DataBind(); if (_navigationdata.SingleSearchMode) { _navigationdata.ResetSearch(); } if (pageSize > 0) { CtrlPaging.PageSize = pageSize; CtrlPaging.CurrentPage = pageNumber; CtrlPaging.TotalRecords = recordCount; CtrlPaging.BindPageLinks(); } // display header (Do header after the data return so the productcount works) if (objCat == null) { base.DoDetail(rpDataH, ModuleId); } else { if (StoreSettings.Current.DebugModeFileOut) { objCat.XMLDoc.Save(PortalSettings.HomeDirectoryMapPath + "debug_categoryproductheader.xml"); } DoDetail(rpDataH, objCat); } } } #endregion // display footer base.DoDetail(rpDataF); }
public static string ProcessCommand(string paramCmd, HttpContext context) { var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); _entityTypeCode = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecode"); _entityTypeCodeLang = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecodelang"); if (_entityTypeCode == "") { _entityTypeCode = "PRD"; } if (_entityTypeCodeLang == "") { _entityTypeCodeLang = "PRDLANG"; } _themeFolder = ajaxInfo.GetXmlProperty("genxml/hidden/themefolder"); _templatename = ajaxInfo.GetXmlProperty("genxml/hidden/templatename"); if (_templatename == "") { _templatename = "favoriteslist"; } if (_themeFolder == "") { _themeFolder = "ClassicAjax"; } var itemId = ajaxInfo.GetXmlProperty("genxml/hidden/shopitemid"); var itemlistname = ajaxInfo.GetXmlProperty("genxml/hidden/shoplistname"); var strOut = "ORDER - ERROR!! - No Security rights for current user!"; var cw = new ItemListData(PortalSettings.Current.PortalId, UserController.Instance.GetCurrentUserInfo().UserID); switch (paramCmd) { case "itemlist_add": if (Utils.IsNumeric(itemId)) { cw.Add(itemlistname, itemId); strOut = cw.products; } break; case "itemlist_remove": if (Utils.IsNumeric(itemId)) { cw.Remove(itemlistname, itemId); strOut = cw.products; } break; case "itemlist_delete": cw.DeleteList(itemlistname); strOut = "deleted"; break; case "itemlist_productlist": strOut = GetProductItemListHtml(cw, itemlistname); break; case "itemlist_getpopup": strOut = GetProductItemListPopup(cw, itemlistname); break; } return(strOut); }
public void SetItemListData(ItemListData itemListData) { this.itemListData = itemListData; }
private void Awake() { _itemListData = Resources.Load <ItemListData>(Constants.Resources.ItemListData); _playerSettings = Resources.Load <PlayerSettings>(Constants.Resources.PlayerSettings); _gameSettings = Resources.Load <GameSettings>(Constants.Resources.GameSettings); }
public static string GetItemListData(ItemListData itemListData) { if (itemListData == ItemListData.All) { return "all"; } else if (itemListData == ItemListData.Colloq) { return "colloq"; } else if (itemListData == ItemListData.ConsumeOnFull) { return "consumeOnFull"; } else if (itemListData == ItemListData.Consumed) { return "consumed"; } else if (itemListData == ItemListData.Depth) { return "depth"; } else if (itemListData == ItemListData.From) { return "from"; } else if (itemListData == ItemListData.Gold) { return "gold"; } else if (itemListData == ItemListData.Groups) { return "groups"; } else if (itemListData == ItemListData.HideFromAll) { return "hideFromAll"; } else if (itemListData == ItemListData.Image) { return "image"; } else if (itemListData == ItemListData.InStore) { return "inStore"; } else if (itemListData == ItemListData.Into) { return "into"; } else if (itemListData == ItemListData.Maps) { return "maps"; } else if (itemListData == ItemListData.RequiredChampion) { return "requiredChampion"; } else if (itemListData == ItemListData.SanitizedDescription) { return "sanitizedDescription"; } else if (itemListData == ItemListData.SpecialRecipe) { return "specialRecipe"; } else if (itemListData == ItemListData.Stacks) { return "stacks"; } else if (itemListData == ItemListData.Stats) { return "stats"; } else if (itemListData == ItemListData.Tags) { return "tags"; } else if (itemListData == ItemListData.Tree) { return "tree"; } else { return ""; } }
public bool Equals(ItemListData data) { return(sort == data.sort && searchString == data.searchString && page == data.page); }
private void RazorPageLoad() { NBrightInfo objCat = null; if (_templD.Trim() != "") // if we don;t have a template, don't do anything { if (_displayentrypage) { // get correct itemid, based on eid given _eid = GetEntryIdFromName(_eid); RazorDisplayDataEntry(_eid); } else { // Get meta data from template var metaTokens = NBrightBuyUtils.RazorPreProcessTempl(_templD, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings(), ModuleId.ToString()); #region "Order BY" //////////////////////////////////////////// // get ORDERBY SORT //////////////////////////////////////////// if (_orderbyindex != "") // if we have orderby set in url, find the meta tags { if (metaTokens.ContainsKey("orderby" + _orderbyindex)) { if (metaTokens["orderby" + _orderbyindex].Contains("{") || metaTokens["orderby" + _orderbyindex].ToLower().Contains("order by")) { _navigationdata.OrderBy = metaTokens["orderby" + _orderbyindex]; _navigationdata.OrderByIdx = _orderbyindex; } else { _navigationdata.OrderBy = " Order by " + metaTokens["orderby" + _orderbyindex]; _navigationdata.OrderByIdx = _orderbyindex; } _navigationdata.Save(); } } else { if (String.IsNullOrEmpty(_navigationdata.OrderBy) && metaTokens.ContainsKey("orderby")) { if (metaTokens["orderby"].Contains("{") || metaTokens["orderby"].ToLower().Contains("order by")) { _navigationdata.OrderBy = metaTokens["orderby"]; } else { _navigationdata.OrderBy = " Order by " + metaTokens["orderby"]; } _navigationdata.OrderByIdx = ""; _navigationdata.Save(); } } #endregion #region "Get Paging setup" //See if we have a pagesize, uses the "searchpagesize" tag token. // : This can be overwritten by the cookie value if we need user selection of pagesize. CtrlPaging.Visible = false; #region "Get pagesize, from best place" var pageSize = 0; if (Utils.IsNumeric(ModSettings.Get("pagesize"))) { pageSize = Convert.ToInt32(ModSettings.Get("pagesize")); } // overwrite default module pagesize , if we have a pagesize control in the template if (metaTokens.ContainsKey("selectpagesize") && Utils.IsNumeric(_navigationdata.PageSize)) { pageSize = Convert.ToInt32(_navigationdata.PageSize); } //check for url param page size if (Utils.IsNumeric(_pagesize) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture))) { pageSize = Convert.ToInt32(_pagesize); } if (pageSize == 0) { var strPgSize = ""; if (metaTokens.ContainsKey("searchpagesize")) { strPgSize = metaTokens["searchpagesize"]; } if (metaTokens.ContainsKey("pagesize") && strPgSize == "") { strPgSize = metaTokens["pagesize"]; } if (Utils.IsNumeric(strPgSize)) { pageSize = Convert.ToInt32(strPgSize); } } if (pageSize > 0) { CtrlPaging.Visible = true; } _navigationdata.PageSize = pageSize.ToString(""); #endregion var pageNumber = 1; //check for url param paging if (Utils.IsNumeric(_pagenum) && (_pagemid == "" | _pagemid == ModuleId.ToString(CultureInfo.InvariantCulture))) { pageNumber = Convert.ToInt32(_pagenum); } //Get returnlimt from module settings var returnlimit = 0; var strreturnlimit = ModSettings.Get("returnlimit"); if (Utils.IsNumeric(strreturnlimit)) { returnlimit = Convert.ToInt32(strreturnlimit); } #endregion #region "Get filter setup" // check the display header to see if we have a sqlfilter defined. var strFilter = ""; var sqlTemplateFilter = ""; if (metaTokens.ContainsKey("sqlfilter")) { sqlTemplateFilter = GenXmlFunctions.StripSqlCommands(metaTokens["sqlfilter"]); } if (_navigationdata.HasCriteria) { var paramcatid = Utils.RequestQueryStringParam(Context, "catid"); if (Utils.IsNumeric(paramcatid)) { if (_navigationdata.CategoryId != Convert.ToInt32(paramcatid)) // filter mode DOES NOT persist catid (stop confusion when user selects a category) { _navigationdata.ResetSearch(); } } // if navdata is not deleted then get filter from navdata, created by productsearch module. strFilter = _navigationdata.Criteria; if (!strFilter.Contains(sqlTemplateFilter)) { strFilter += " " + sqlTemplateFilter; } if (_navigationdata.Mode.ToLower() == "s") { _navigationdata.ResetSearch(); // single search so clear after } } else { // reset search if category selected // NOTE: keeping search across categories is VERY confusing for cleint, although it works logically. _navigationdata.ResetSearch(); strFilter = sqlTemplateFilter; } #endregion #region "Get Category select setup" var objQual = DotNetNuke.Data.DataProvider.Instance().ObjectQualifier; var dbOwner = DataProvider.Instance().DatabaseOwner; //get default catid. var catseo = _catid; var defcatid = ModSettings.Get("defaultcatid"); if (defcatid == "") { defcatid = "0"; } if (Utils.IsNumeric(defcatid) && Convert.ToInt32(defcatid) > 0) { // if we have no filter use the default category if (_catid == "" && strFilter.Trim() == "") { _catid = defcatid; } } else { defcatid = ModSettings.Get("defaultpropertyid"); if (defcatid == "") { defcatid = "0"; } if (Utils.IsNumeric(defcatid)) { // if we have no filter use the default category if (_catid == "" && strFilter.Trim() == "") { _catid = defcatid; } } } // If we have a static list,then always display the default category if (ModSettings.Get("staticlist") == "True") { if (catseo == "") { catseo = _catid; } _catid = defcatid; if (ModSettings.Get("chkcascaderesults").ToLower() == "true") { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") "; } else { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") "; } if (ModSettings.Get("caturlfilter") == "True" && catseo != "" && catseo != _catid) { // add aditional filter for catid filter on url (catseo holds catid from url) if (ModSettings.Get("chkcascaderesults").ToLower() == "true") { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + catseo + ") "; } else { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + catseo + ") "; } } // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq. if (_navigationdata.OrderBy.Contains("{bycategoryproduct}")) { _navigationdata.OrderBy = "{bycategoryproduct}" + _catid; } } else { #region "use url to get category to display" //check if we are display categories // get category list data if (_catname != "") // if catname passed in url, calculate what the catid is { objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORYLANG", _catname); if (objCat == null) { // check it's not just a single language objCat = ModCtrl.GetByGuidKey(PortalId, ModuleId, "CATEGORY", _catname); if (objCat != null) { _catid = objCat.ItemID.ToString(""); } } else { _catid = objCat.ParentItemId.ToString(""); if (!String.IsNullOrEmpty(objCat.GUIDKey) && Utils.IsNumeric(_catid) && objCat.Lang != Utils.GetCurrentCulture()) { // do a 301 redirect to correct url for the langauge (If the langauge is changed on the product list, we need to make sure we have the correct catref for the langauge) var catGrpCtrl = new GrpCatController(Utils.GetCurrentCulture()); var activeCat = catGrpCtrl.GetCategory(Convert.ToInt32(_catid)); if (activeCat != null) { var redirecturl = ""; if (Utils.IsNumeric(_eid)) { var prdData = ProductUtils.GetProductData(Convert.ToInt32(_eid), Utils.GetCurrentCulture(), true, EntityTypeCode); redirecturl = NBrightBuyUtils.GetEntryUrl(PortalId, _eid, _modkey, prdData.SEOName, TabId.ToString(), "", activeCat.categoryrefGUIDKey); } else { redirecturl = catGrpCtrl.GetCategoryUrl(activeCat, TabId, Utils.GetCurrentCulture()); } try { if (redirecturl != "") { Response.Redirect(redirecturl, false); Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently; Response.End(); } } catch (Exception) { // catch err } } } } // We have a category selected (in url), so overwrite categoryid navigationdata. // This allows the return to the same category after a returning from a entry view. if (Utils.IsNumeric(_catid)) { _navigationdata.CategoryId = Convert.ToInt32(_catid); } catseo = _catid; _navigationdata.ResetSearch(); strFilter = ""; } if (Utils.IsNumeric(_catid)) { if (ModSettings.Get("chkcascaderesults").ToLower() == "true") { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where (typecode = 'CATCASCADE' or typecode = 'CATXREF') and XrefItemId = " + _catid + ") "; } else { strFilter = strFilter + " and NB1.[ItemId] in (select parentitemid from " + dbOwner + "[" + objQual + "NBrightBuy] where typecode = 'CATXREF' and XrefItemId = " + _catid + ") "; } if (Utils.IsNumeric(catseo)) { var objSEOCat = ModCtrl.GetData(Convert.ToInt32(catseo), "CATEGORYLANG", Utils.GetCurrentCulture()); if (objSEOCat != null && _eid == "") // we may have a detail page and listonly module, in which can we need the product detail as page title { //Page Title var seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname"); if (seoname == "") { seoname = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname"); } var newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseopagetitle"); if (newBaseTitle == "") { newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtseoname"); } if (newBaseTitle == "") { newBaseTitle = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategoryname"); } if (newBaseTitle != "") { BasePage.Title = newBaseTitle; } //Page KeyWords var newBaseKeyWords = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetakeywords"); if (newBaseKeyWords != "") { BasePage.KeyWords = newBaseKeyWords; } //Page Description var newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtmetadescription"); if (newBaseDescription == "") { newBaseDescription = objSEOCat.GetXmlProperty("genxml/lang/genxml/textbox/txtcategorydesc"); } if (newBaseDescription != "") { BasePage.Description = newBaseDescription; } // Remove canonical link for list. The Open URL Rewriter (OUR) will create a url that is different to the default SEO url in NBS. // So to stop clashes it's been disable by default. The requirment for a canonical link on a category list is more ticking the box than of being any SEO help (might even be causing confusion to Search Engines). // ** If your a SEO nutcases (or SEO companies pushing for it) then you can uncomment the code below, and you can implement the Open URL Rewriter and canonical link. //if (PortalSettings.HomeTabId == TabId) // PageIncludes.IncludeCanonicalLink(Page, Globals.AddHTTP(PortalSettings.PortalAlias.HTTPAlias)); //home page always default of site. //else //{ // PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, seoname, Utils.GetCurrentCulture())); // // Code required for OUR (if used, test to ensure it works correctly!!) // //PageIncludes.IncludeCanonicalLink(Page, NBrightBuyUtils.GetListUrl(PortalId, TabId, objSEOCat.ItemID, "", Utils.GetCurrentCulture())); //} } } // do special custom sort in each cateogry, this passes the catid to the SQL SPROC, whcih process the '{bycategoryproduct}' and orders by product/category seq. if (_navigationdata.OrderBy.Contains("{bycategoryproduct}")) { _navigationdata.OrderBy = "{bycategoryproduct}" + _catid; } } else { if (!_navigationdata.FilterMode) { _navigationdata.CategoryId = 0; // filter mode persist catid } if (_navigationdata.OrderBy.Contains("{bycategoryproduct}")) { _navigationdata.OrderBy = " Order by ModifiedDate DESC "; } } #endregion } // This allows the return to the same category after a returning from a entry view. + Gives support for current category in razor tokens if (Utils.IsNumeric(_catid)) { _navigationdata.CategoryId = Convert.ToInt32(_catid); } #endregion #region "Apply provider product filter" // Special filtering can be done, by using the ProductFilter interface. var productfilterkey = ""; if (metaTokens.ContainsKey("providerfilterkey")) { productfilterkey = metaTokens["providerfilterkey"]; } if (productfilterkey != "") { var provfilter = FilterInterface.Instance(productfilterkey); if (provfilter != null) { strFilter = provfilter.GetFilter(strFilter, _navigationdata, ModSettings, Context); } } #endregion #region "itemlists (wishlist)" // if we have a itemListName field then get the itemlist cookie. if (ModSettings.Get("displaytype") == "2") // displaytype 2 = "selected list" { var cw = new ItemListData(PortalId, UserController.Instance.GetCurrentUserInfo().UserID); if (cw.Exists && cw.ItemCount > 0) { strFilter = " and ("; foreach (var i in cw.GetItemList()) { strFilter += " NB1.itemid = '" + i + "' or"; } strFilter = strFilter.Substring(0, (strFilter.Length - 3)) + ") "; // remove the last "or" } else { //no data in list so select false itemid to stop anything displaying strFilter += " and (NB1.itemid = '-1') "; } } #endregion // insert page header text NBrightBuyUtils.RazorIncludePageHeader(ModuleId, Page, Path.GetFileNameWithoutExtension(_templD) + "_head" + Path.GetExtension(_templD), _controlPath, ModSettings.ThemeFolder, ModSettings.Settings()); // save navigation data _navigationdata.PageModuleId = Utils.RequestParam(Context, "pagemid"); _navigationdata.PageNumber = Utils.RequestParam(Context, "page"); if (Utils.IsNumeric(_catid)) { _navigationdata.PageName = NBrightBuyUtils.GetCurrentPageName(Convert.ToInt32(_catid)); } // save the last active modulekey to a cookie, so it can be used by the "NBrightBuyUtils.GetReturnUrl" function NBrightCore.common.Cookie.SetCookieValue(PortalId, "NBrigthBuyLastActive", "ModuleKey", ModuleKey, 1); if (strFilter.Trim() == "") { // if at this point we have no filter, then assume we're using urlrewriter and a 404 url has been entered. // rather than display all visible products in a list with no default. // redirect to the product display function, so we can display a 404 and product not found. RazorDisplayDataEntry(_eid); } else { strFilter += " and (NB3.Visible = 1) "; // get only visible products var recordCount = ModCtrl.GetDataListCount(PortalId, ModuleId, EntityTypeCode, strFilter, EntityTypeCodeLang, Utils.GetCurrentCulture(), DebugMode); _navigationdata.RecordCount = recordCount.ToString(""); _navigationdata.Save(); if (returnlimit > 0 && returnlimit < recordCount) { recordCount = returnlimit; } // **** check if we already have the template cached, if so no need for DB call or razor call **** // get same cachekey used for DB return, and use for razor. var razorcachekey = ModCtrl.GetDataListCacheKey(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount); var cachekey = "NBrightBuyRazorOutput" + _templD + "*" + razorcachekey + PortalId.ToString(); var strOut = (String)NBrightBuyUtils.GetModCache(cachekey); if (strOut == null || StoreSettings.Current.DebugMode) { var l = ModCtrl.GetDataList(PortalId, ModuleId, EntityTypeCode, EntityTypeCodeLang, Utils.GetCurrentCulture(), strFilter, _navigationdata.OrderBy, DebugMode, "", returnlimit, pageNumber, pageSize, recordCount); strOut = NBrightBuyUtils.RazorTemplRenderList(_templD, ModuleId, razorcachekey, l, _controlPath, ModSettings.ThemeFolder, Utils.GetCurrentCulture(), ModSettings.Settings()); } var lit = new Literal(); lit.Text = strOut; phData.Controls.Add(lit); if (_navigationdata.SingleSearchMode) { _navigationdata.ResetSearch(); } if (pageSize > 0) { CtrlPaging.PageSize = pageSize; CtrlPaging.CurrentPage = pageNumber; CtrlPaging.TotalRecords = recordCount; CtrlPaging.BindPageLinks(); } } } } }
public void OnGUI() { if (skin) { GUI.skin = skin; } GUILayout.BeginVertical("Item List", "window"); GUILayout.Label(m_Logo, GUILayout.MaxHeight(25)); GUILayout.Space(10); GUILayout.BeginVertical("box"); GUI.enabled = !Application.isPlaying; itemList = EditorGUILayout.ObjectField("ItemListData", itemList, typeof(ItemListData), false) as ItemListData; if (serializedObject == null && itemList != null) { serializedObject = new SerializedObject(itemList); } else if (itemList == null) { GUILayout.EndVertical(); return; } serializedObject.Update(); if (!inAddItem && GUILayout.Button("Create New Item")) { addItem = ScriptableObject.CreateInstance <Item>(); addItem.name = "New Item"; currentItemDrawer = null; inAddItem = true; } if (inAddItem) { DrawAddItem(); } if (GUILayout.Button("Open ItemEnums Editor")) { ItemEnumsWindow.CreateWindow(); } GUILayout.Space(10); GUILayout.EndVertical(); GUILayout.Box(itemList.items.Count.ToString("00") + " Items"); scroolView = GUILayout.BeginScrollView(scroolView, GUILayout.ExpandWidth(true)); for (int i = 0; i < itemList.items.Count; i++) { if (itemList.items[i] != null) { Color color = GUI.color; GUI.color = currentItemDrawer != null && currentItemDrawer.item == itemList.items[i] ? Color.green : color; GUILayout.BeginVertical("box"); GUI.color = color; GUILayout.BeginHorizontal(); var texture = itemList.items[i].iconTexture; var name = " ID " + itemList.items[i].id.ToString("00") + "\n - " + itemList.items[i].name + "\n - " + itemList.items[i].type.ToString(); var content = new GUIContent(name, texture, currentItemDrawer != null && currentItemDrawer.item == itemList.items[i] ? "Click to Close" : "Click to Open"); GUIStyle boxStyle = new GUIStyle(GUI.skin.box); GUI.skin.box.alignment = TextAnchor.UpperLeft; GUI.skin.box.fontStyle = FontStyle.Italic; GUI.skin.box.fontSize = 11; if (GUILayout.Button(content, "box", GUILayout.Height(50), GUILayout.MinWidth(50))) { GUI.FocusControl("clearFocus"); scroolView.y = 1 + i * 60; currentItemDrawer = currentItemDrawer != null ? currentItemDrawer.item == itemList.items[i] ? null : new vItemDrawer(itemList.items[i]) : new vItemDrawer(itemList.items[i]); } EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link); GUI.skin.box = boxStyle; var duplicateImage = Resources.Load("duplicate") as Texture; if (GUILayout.Button(new GUIContent("", duplicateImage, "Duplicate Item"), GUILayout.MaxWidth(45), GUILayout.Height(45))) { if (EditorUtility.DisplayDialog("Duplicate the " + itemList.items[i].name, "Are you sure you want to duplicate this item? ", "Duplicate", "Cancel")) { DuplicateItem(itemList.items[i]); GUILayout.EndHorizontal(); Repaint(); break; } } if (GUILayout.Button(new GUIContent("x", "Delete Item"), GUILayout.MaxWidth(20), GUILayout.Height(45))) { if (EditorUtility.DisplayDialog("Delete the " + itemList.items[i].name, "Are you sure you want to delete this item? ", "Delete", "Cancel")) { var item = itemList.items[i]; itemList.items.RemoveAt(i); DestroyImmediate(item, true); OrderByID(); AssetDatabase.SaveAssets(); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(itemList); GUILayout.EndHorizontal(); Repaint(); break; } } GUILayout.EndHorizontal(); GUI.color = color; if (currentItemDrawer != null && currentItemDrawer.item == itemList.items[i] && itemList.items.Contains(currentItemDrawer.item)) { currentItemDrawer.DrawItem(ref itemList.items, false); } GUILayout.EndVertical(); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); if (GUI.changed || serializedObject.ApplyModifiedProperties()) { EditorUtility.SetDirty(itemList); } }
void OnEnable() { itemList = (ItemListData)target; skin = Resources.Load("skin") as GUISkin; m_Logo = (Texture2D)Resources.Load("icon_v2", typeof(Texture2D)); }
static void CreateNewListData() { ItemListData listData = ScriptableObject.CreateInstance <ItemListData>(); AssetDatabase.CreateAsset(listData, "Assets/ItemListData.asset"); }
public Transaction(float transactionID) { this.transactionID = transactionID; itemListData = new ItemListData(); }