예제 #1
0
        public ActionResult Edit([Bind(Include =
                                           " CatalogItemId"
                                           + ",Name"
                                           + ",Description"
                                           + ",Sku"
                                           + ",QbItemId"
                                       )] CatalogItem CatalogItem)
        {
            CatalogItem oCatalogItem = new CatalogItem();

            oCatalogItem.CatalogItemId = System.Convert.ToInt32(CatalogItem.CatalogItemId);
            oCatalogItem = CatalogItemData.Select_Record(CatalogItem);

            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = CatalogItemData.Update(oCatalogItem, CatalogItem);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Update");
                }
            }

            return(View(CatalogItem));
        }
예제 #2
0
 public CatalogStats(CatalogItemData statsItem, List <CatalogItemData> statsData, long totalItemsPurchased, long totalItemsSold)
 {
     StatsItem           = statsItem;
     StatsData           = statsData;
     TotalItemsPurchased = totalItemsPurchased;
     TotalItemsSold      = totalItemsSold;
 }
예제 #3
0
        public void SetUpButton(CatalogItemData catalogItemData, Color foreground, Color background, bool isCreatorNameHidden = false)
        {
            itemData = catalogItemData;
            DCustomEquipment equipment = CustomEquipmentResponseAdaptor.ConvertResponseToCustomEquipment(itemData.equipment);

            if (isCreatorNameHidden)
            {
                DisableName();
            }
            CreatorNameText.text = itemData.creatorName;
            CatalogItemIcon component = GetComponent <CatalogItemIcon>();

            AbstractImageBuilder.CallbackToken callbackToken = default(AbstractImageBuilder.CallbackToken);
            callbackToken.Id           = itemData.clothingCatalogItemId;
            callbackToken.DefinitionId = equipment.DefinitionId;
            base.itemImageBuilder.RequestImage(equipment, component.SetIcon, callbackToken, background, foreground);
            if (!isAlreadyOwned)
            {
                isAlreadyOwned = ((itemData.equipment.equipmentId != 0) ? true : false);
            }
            ItemOwned.SetActive(isAlreadyOwned);
            PriceTagText.text = itemData.cost.ToString();
            PriceTag.SetActive(!isAlreadyOwned);
            int definitionId = equipment.DefinitionId;
            Dictionary <int, TemplateDefinition> dictionary = Service.Get <GameData>().Get <Dictionary <int, TemplateDefinition> >();
            TemplateDefinition templateDefinition           = dictionary.Values.ToList().First((TemplateDefinition x) => x.Id == definitionId);

            isMemberUnlocked = !templateDefinition.IsMemberOnly || Service.Get <CPDataEntityCollection>().IsLocalPlayerMember();
            if (!isMemberUnlocked)
            {
                MemberLock.SetActive(value: true);
            }
        }
예제 #4
0
        public async Task <CatalogItemData> FindCatalogItemByAsync(int id)
        {
            CatalogItem catalogItem = await catalogRepository.FindByIdAsync(id);

            CatalogItemData catalogItemData = CatalogMapper.Convert(catalogItem);

            return(catalogItemData);
        }
예제 #5
0
 public ShopItemClickedEvent(int scrollIndex, int rowIndex, bool isMemberUnlocked, bool isAlreadyOwned, CatalogItemData itemData)
 {
     ScrollIndex      = scrollIndex;
     RowIndex         = rowIndex;
     IsMemberUnlocked = isMemberUnlocked;
     IsAlreadyOwned   = isAlreadyOwned;
     ItemData         = itemData;
 }
        public void SetPanel(CatalogItemData itemData, int elementIndex, int arrowIndex, bool isMemberUnlocked, bool isRecentlyPurchased)
        {
            ElementIndex = elementIndex;
            ItemData     = itemData;
            CatalogShopBuyPanelState catalogShopBuyPanelState = CatalogShopBuyPanelState.Purchase;

            catalogShopBuyPanelState = ((!isMemberUnlocked) ? CatalogShopBuyPanelState.MemberLocked : ((((ItemData.equipment.equipmentId != 0) ? true : false) || isRecentlyPurchased) ? CatalogShopBuyPanelState.AlreadyOwned : CatalogShopBuyPanelState.Purchase));
            SetState(catalogShopBuyPanelState);
            SetArrowIndex(arrowIndex);
            SetEquipment();
        }
예제 #7
0
        private bool onStats(CatalogServiceEvents.UserStatsRetrievedEvent evt)
        {
            List <CatalogItemData> currentItems    = evt.Response.currentItems;
            CatalogItemData        mostPopularItem = evt.Response.mostPopularItem;
            long             totalItemsPurchased   = evt.Response.totalItemsPurchased;
            long             totalItemsSold        = evt.Response.totalItemsSold;
            CatalogStats     catalogStats          = new CatalogStats(mostPopularItem, currentItems, totalItemsPurchased, totalItemsSold);
            CatalogCacheData cacheDataById         = cache.GetCacheDataById("catalogStatsCacheId");

            cacheDataById.Data      = catalogStats;
            cacheDataById.CacheTime = 0;
            cache.SetCatalogCacheData("catalogStatsCacheId", cacheDataById);
            Service.Get <EventDispatcher>().DispatchEvent(new CatalogServiceProxyEvents.StatsReponse(catalogStats));
            return(false);
        }
        private bool onBuyPanelPurchaseButtonClickedEvent(CatalogUIEvents.BuyPanelPurchaseButtonClickedEvent evt)
        {
            int  coins = Service.Get <CPDataEntityCollection>().GetComponent <CoinsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle).Coins;
            long cost  = evt.ItemData.cost;

            if (coins < cost)
            {
                Service.Get <PromptManager>().ShowPrompt("InsufficientFundsErrorPrompt", null);
            }
            else
            {
                purchaseItem    = evt.ItemData;
                itemForPurchase = evt.ItemData.equipment;
                Service.Get <INetworkServicesManager>().CatalogService.PurchaseCatalogItem(evt.ItemData.clothingCatalogItemId);
            }
            return(false);
        }
예제 #9
0
        public ActionResult DeleteConfirmed(
            Int32?CatalogItemId
            )
        {
            CatalogItem CatalogItem = new CatalogItem();

            CatalogItem.CatalogItemId = System.Convert.ToInt32(CatalogItemId);
            CatalogItem = CatalogItemData.Select_Record(CatalogItem);

            bool bSucess = false;

            bSucess = CatalogItemData.Delete(CatalogItem);
            if (bSucess == true)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ModelState.AddModelError("", "Can Not Delete");
            }
            return(null);
        }
예제 #10
0
        // GET: /CatalogItem/Delete/<id>
        public ActionResult Delete(
            Int32?CatalogItemId
            )
        {
            if (
                CatalogItemId == null
                )
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            CatalogItem CatalogItem = new CatalogItem();

            CatalogItem.CatalogItemId = System.Convert.ToInt32(CatalogItemId);
            CatalogItem = CatalogItemData.Select_Record(CatalogItem);

            if (CatalogItem == null)
            {
                return(HttpNotFound());
            }
            return(View(CatalogItem));
        }
예제 #11
0
        public ActionResult Create([Bind(Include =
                                             "Name"
                                             + "," + "Description"
                                             + "," + "Sku"
                                             + "," + "QbItemId"
                                         )] CatalogItem CatalogItem)
        {
            if (ModelState.IsValid)
            {
                bool bSucess = false;
                bSucess = CatalogItemData.Add(CatalogItem);
                if (bSucess == true)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ModelState.AddModelError("", "Can Not Insert");
                }
            }

            return(View(CatalogItem));
        }
예제 #12
0
 public BuyPanelWearItButtonClickedEvent(CatalogItemData itemData)
 {
     ItemData = itemData;
 }
예제 #13
0
 public BuyPanelPurchaseButtonClickedEvent(CatalogItemData itemData)
 {
     ItemData = itemData;
 }
예제 #14
0
 public List <CatalogItem> GetCatalogItemByManufacturer(string manufacturer)
 {
     return(CatalogItemData.GetByManufacturer(manufacturer));
 }
예제 #15
0
 public CatalogItem GetCatalogItemByCatalogItemId(Guid catalogItemId)
 {
     return(CatalogItemData.GetByCatalogItemId(catalogItemId));
 }
예제 #16
0
 public CatalogItem GetCatalogItemByItemName(string itemName)
 {
     return(CatalogItemData.GetByItemName(itemName));
 }
예제 #17
0
 // CATALOG ITEMS
 public int GetCatalogItemStockCount(Guid catalogItemId)
 {
     return(CatalogItemData.GetNumberInStock(catalogItemId));
 }
        public virtual void ShowShopItemPanel(int scrollIndex, int rowIndex, bool isMemberUnlocked, bool isRecentlyPurchased)
        {
            int             index      = scrollIndex * CatalogShopItemsPerRow + (rowIndex - 1);
            CatalogItemData itemData   = filteredItems[index];
            int             arrowIndex = rowIndex - 1;

            try
            {
                GameObject elementAtIndex = Scroller.GetElementAtIndex(scrollIndex + IndexOffset);
                if (elementAtIndex != null)
                {
                    CatalogShopRowItem component = elementAtIndex.GetComponent <CatalogShopRowItem>();
                    if (component != null)
                    {
                        int count = component.GetShopItems().Count;
                        if (count == 1)
                        {
                            arrowIndex = 1;
                        }
                        if (count == 2)
                        {
                            arrowIndex = CatalogShopItemsPerRow + rowIndex - 1;
                        }
                        CatalogShopItem catalogShopItem = component.GetShopItems()[rowIndex - 1];
                        catalogShopItem.AddListeners();
                    }
                }
            }
            catch (Exception)
            {
            }
            selectedItem = itemData;
            bool flag = false;

            if (buyPanel != null)
            {
                if (buyPanel.ElementIndex == scrollIndex)
                {
                    buyPanel.SetPanel(itemData, scrollIndex, arrowIndex, isMemberUnlocked, isRecentlyPurchased);
                    flag = true;
                }
                else
                {
                    CloseBuyPanel();
                }
            }
            if (flag)
            {
                return;
            }
            GameObject elementAtIndex2 = Scroller.GetElementAtIndex(scrollIndex + IndexOffset);

            if (elementAtIndex2 != null)
            {
                LayoutElement component2 = elementAtIndex2.transform.parent.gameObject.GetComponent <LayoutElement>();
                if (component2 != null)
                {
                    GameObject gameObject = UnityEngine.Object.Instantiate(ClothingPurchase);
                    DefaultValuesPooledLayoutElement component3 = gameObject.GetComponent <DefaultValuesPooledLayoutElement>();
                    component2.preferredHeight = component3.DefaultHeight + elementAtIndex2.GetComponent <LayoutElement>().preferredHeight;
                    gameObject.transform.SetParent(elementAtIndex2.transform, worldPositionStays: false);
                    buyPanel      = gameObject.GetComponent <CatalogShopBuyPanelController>();
                    buyPanelIndex = scrollIndex;
                    buyPanel.SetPanel(itemData, scrollIndex, arrowIndex, isMemberUnlocked, isRecentlyPurchased);
                    CoroutineRunner.Start(ScrollToElement(scrollIndex + IndexOffset), this, "ScrollToElement");
                }
            }
        }
예제 #19
0
        // GET: /CatalogItem/
        public ActionResult Index(string sortOrder,
                                  String SearchField,
                                  String SearchCondition,
                                  String SearchText,
                                  String Export,
                                  int?PageSize,
                                  int?page,
                                  string command)
        {
            if (command == "Show All")
            {
                SearchField                = null;
                SearchCondition            = null;
                SearchText                 = null;
                Session["SearchField"]     = null;
                Session["SearchCondition"] = null;
                Session["SearchText"]      = null;
            }
            else if (command == "Add New Record")
            {
                return(RedirectToAction("Create"));
            }
            else if (command == "Export")
            {
                Session["Export"] = Export;
            }
            else if (command == "Search" | command == "Page Size")
            {
                if (!string.IsNullOrEmpty(SearchText))
                {
                    Session["SearchField"]     = SearchField;
                    Session["SearchCondition"] = SearchCondition;
                    Session["SearchText"]      = SearchText;
                }
            }
            if (command == "Page Size")
            {
                Session["PageSize"] = PageSize;
            }

            ViewData["SearchFields"]     = GetFields((Session["SearchField"] == null ? "Catalog Item Id" : Convert.ToString(Session["SearchField"])));
            ViewData["SearchConditions"] = Library.GetConditions((Session["SearchCondition"] == null ? "Contains" : Convert.ToString(Session["SearchCondition"])));
            ViewData["SearchText"]       = Session["SearchText"];
            ViewData["Exports"]          = Library.GetExports((Session["Export"] == null ? "Pdf" : Convert.ToString(Session["Export"])));
            ViewData["PageSizes"]        = Library.GetPageSizes();

            ViewData["CurrentSort"]           = sortOrder;
            ViewData["CatalogItemIdSortParm"] = sortOrder == "CatalogItemId_asc" ? "CatalogItemId_desc" : "CatalogItemId_asc";
            ViewData["NameSortParm"]          = sortOrder == "Name_asc" ? "Name_desc" : "Name_asc";
            ViewData["DescriptionSortParm"]   = sortOrder == "Description_asc" ? "Description_desc" : "Description_asc";
            ViewData["SkuSortParm"]           = sortOrder == "Sku_asc" ? "Sku_desc" : "Sku_asc";
            ViewData["QbItemIdSortParm"]      = sortOrder == "QbItemId_asc" ? "QbItemId_desc" : "QbItemId_asc";

            dtCatalogItem = CatalogItemData.SelectAll();

            try
            {
                if (!string.IsNullOrEmpty(Convert.ToString(Session["SearchField"])) & !string.IsNullOrEmpty(Convert.ToString(Session["SearchCondition"])) & !string.IsNullOrEmpty(Convert.ToString(Session["SearchText"])))
                {
                    dtCatalogItem = CatalogItemData.Search(Convert.ToString(Session["SearchField"]), Convert.ToString(Session["SearchCondition"]), Convert.ToString(Session["SearchText"]));
                }
            }
            catch { }

            var Query = from rowCatalogItem in dtCatalogItem.AsEnumerable()
                        select new CatalogItem()
            {
                CatalogItemId = rowCatalogItem.Field <Int32>("CatalogItemId")
                , Name        = rowCatalogItem.Field <String>("Name")
                , Description = rowCatalogItem.Field <String>("Description")
                , Sku         = rowCatalogItem.Field <String>("Sku")
                , QbItemId    = rowCatalogItem.Field <String>("QbItemId")
            };

            switch (sortOrder)
            {
            case "CatalogItemId_desc":
                Query = Query.OrderByDescending(s => s.CatalogItemId);
                break;

            case "CatalogItemId_asc":
                Query = Query.OrderBy(s => s.CatalogItemId);
                break;

            case "Name_desc":
                Query = Query.OrderByDescending(s => s.Name);
                break;

            case "Name_asc":
                Query = Query.OrderBy(s => s.Name);
                break;

            case "Description_desc":
                Query = Query.OrderByDescending(s => s.Description);
                break;

            case "Description_asc":
                Query = Query.OrderBy(s => s.Description);
                break;

            case "Sku_desc":
                Query = Query.OrderByDescending(s => s.Sku);
                break;

            case "Sku_asc":
                Query = Query.OrderBy(s => s.Sku);
                break;

            case "QbItemId_desc":
                Query = Query.OrderByDescending(s => s.QbItemId);
                break;

            case "QbItemId_asc":
                Query = Query.OrderBy(s => s.QbItemId);
                break;

            default:      // Name ascending
                Query = Query.OrderBy(s => s.CatalogItemId);
                break;
            }

            if (command == "Export")
            {
                GridView  gv = new GridView();
                DataTable dt = new DataTable();
                dt.Columns.Add("Catalog Item Id", typeof(string));
                dt.Columns.Add("Name", typeof(string));
                dt.Columns.Add("Description", typeof(string));
                dt.Columns.Add("Sku", typeof(string));
                dt.Columns.Add("Qb Item Id", typeof(string));
                foreach (var item in Query)
                {
                    dt.Rows.Add(
                        item.CatalogItemId
                        , item.Name
                        , item.Description
                        , item.Sku
                        , item.QbItemId
                        );
                }
                gv.DataSource = dt;
                gv.DataBind();
                ExportData(Export, gv, dt);
            }

            int pageNumber = (page ?? 1);
            int?pageSZ     = (Convert.ToInt32(Session["PageSize"]) == 0 ? 5 : Convert.ToInt32(Session["PageSize"]));

            return(View(Query.ToPagedList(pageNumber, (pageSZ ?? 5))));
        }