Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WishListController" /> class.
        /// </summary>
        /// <param name="inventoryManager">The inventory manager.</param>
        /// <param name="accountManager">The account manager.</param>
        /// <param name="wishListManager">The wish list manager.</param>
        /// <param name="contactFactory">The contact factory.</param>
        public WishListController(
            [NotNull] InventoryManager inventoryManager,
            [NotNull] AccountManager accountManager,
            [NotNull] WishListManager wishListManager,
            [NotNull] ContactFactory contactFactory)
            : base(accountManager, contactFactory)
        {
            Assert.ArgumentNotNull(contactFactory, "contactFactory");
            Assert.ArgumentNotNull(inventoryManager, "inventoryManager");
            Assert.ArgumentNotNull(wishListManager, "wishListManager");

            this.InventoryManager = inventoryManager;
            this.WishListManager  = wishListManager;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WishListController" /> class.
        /// </summary>
        /// <param name="inventoryManager">The inventory manager.</param>
        /// <param name="accountManager">The account manager.</param>
        /// <param name="wishListManager">The wish list manager.</param>
        /// <param name="contactFactory">The contact factory.</param>
        /// <param name="storefrontContext"></param>
        /// <param name="commerceUserContext"></param>
        public WishListController(
            [NotNull] InventoryManager inventoryManager,
            [NotNull] AccountManager accountManager,
            [NotNull] WishListManager wishListManager,
            [NotNull] ContactFactory contactFactory,
            StorefrontContext storefrontContext,
            CommerceUserContext commerceUserContext)
            : base(accountManager, contactFactory)
        {
            Assert.ArgumentNotNull(contactFactory, "contactFactory");
            Assert.ArgumentNotNull(inventoryManager, "inventoryManager");
            Assert.ArgumentNotNull(wishListManager, "wishListManager");

            this.InventoryManager    = inventoryManager;
            this.WishListManager     = wishListManager;
            this.StorefrontContext   = storefrontContext;
            this.CommerceUserContext = commerceUserContext;
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IcsonSessionInfo oSessionInfo = CommonUtility.GetUserSession(Context);

            CustomerInfo cInfo  = oSessionInfo.sCustomer;
            int          cSysNo = cInfo.SysNo;

            bool   result = false;
            string msg    = String.Empty;

            try
            {
                switch (Cmd)
                {
                //添加商品到收藏
                case "add":
                {
                    WishListInfo wInfo = new WishListInfo();
                    wInfo.CustomerSysNo = cSysNo;
                    wInfo.ProductSysNo  = productSysNo;
                    WishListManager.GetInstance().Insert(wInfo);
                    result = true;
                    msg    = "成功添加";
                    Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
                    break;
                }

                //删除单个收藏商品
                case "delete":
                {
                    foreach (string pid in productSysNos)
                    {
                        WishListManager.GetInstance().Delete(cSysNo, int.Parse(pid));
                    }
                    msg = "删除成功";
                    Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
                    break;
                }

                //清空收藏商品
                case "empty":
                {
                    WishListManager.GetInstance().Clear(cSysNo);
                    msg = "清空收藏夹成功";
                    Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
                    break;
                }

                //获得分页的收藏列表
                default:
                {
                    Response.Write(CustomerHelper.GetCustomerWishListProducts(cSysNo, StartIndex));
                    break;
                }
                }
            }
            catch
            {
                msg = "用户请求的操作失败";
                Response.Write(JsonContentTransfomer <object> .GetJsonContent(new { IsSuccess = result, Msg = msg }));
            }
        }
Exemplo n.º 4
0
        public override void Initialize(JobProcessor thread)
        {
            ConnectionStringLoader.LoadFromServiceCore(Settings.Default);
            base.Initialize(thread, CashShopServiceOperations.TypeConverters);
            base.RegisterMessage(OperationMessages.TypeConverters);
            base.RegisterProcessor(typeof(NotifyCashShopUserInfo), (Operation x) => new NotifyCashShopUserInfoProcessor(this, x as NotifyCashShopUserInfo));
            base.RegisterProcessor(typeof(NotifyCashShopCID), (Operation x) => new NotifyCashShopCIDProcessor(this, x as NotifyCashShopCID));
            base.RegisterProcessor(typeof(QueryCashShopBalance), (Operation x) => new QueryCashShopBalanceProcessor(this, x as QueryCashShopBalance));
            base.RegisterProcessor(typeof(QueryCashShopInventory), (Operation x) => new QueryCashShopInventoryProcessor(this, x as QueryCashShopInventory));
            base.RegisterProcessor(typeof(QueryCashShopItemPickUp), (Operation x) => new QueryCashShopItemPickUpProcessor(this, x as QueryCashShopItemPickUp));
            base.RegisterProcessor(typeof(QueryCashShopPurchaseItem), (Operation x) => new QueryCashShopPurchaseItemProcessor(this, x as QueryCashShopPurchaseItem));
            base.RegisterProcessor(typeof(QueryCashShopProductList), (Operation x) => new QueryCashShopProductListProcessor(this, x as QueryCashShopProductList));
            base.RegisterProcessor(typeof(StopCashShop), (Operation x) => new StopCashShopProcessor(this, x as StopCashShop));
            base.RegisterProcessor(typeof(QueryCashShopPurchaseGift), (Operation x) => new QueryCashShopPurchaseGiftProcessor(this, x as QueryCashShopPurchaseGift));
            base.RegisterProcessor(typeof(RequestGoddessProtection), (Operation x) => new RequestGoddessProtectionProcessor(this, x as RequestGoddessProtection));
            base.RegisterProcessor(typeof(DirectPickUp), (Operation x) => new DirectPickUpProcessor(this, x as DirectPickUp));
            base.RegisterProcessor(typeof(QueryCashShopGiftSender), (Operation x) => new QueryCashShopGiftSenderProcessor(this, x as QueryCashShopGiftSender));
            base.RegisterProcessor(typeof(RollbackDirectPickUp), (Operation x) => new RollbackDirectPickUpProcessor(this, x as RollbackDirectPickUp));
            base.RegisterProcessor(typeof(DirectPickUpByProductNo), (Operation x) => new DirectPickUpByProductNoProcessor(this, x as DirectPickUpByProductNo));
            base.RegisterProcessor(typeof(QueryCashShopRefund), (Operation x) => new QueryCashShopRefundProcessor(this, x as QueryCashShopRefund));
            base.RegisterProcessor(typeof(QueryBeautyShopInfo), (Operation x) => new QueryBeautyShopInfoProcessor(this, x as QueryBeautyShopInfo));
            base.RegisterProcessor(typeof(QueryCashShopProductInfo), (Operation x) => new QueryCashShopProductInfoProcessor(this, x as QueryCashShopProductInfo));
            base.RegisterProcessor(typeof(QueryCashShopProductInfoByCashShopKey), (Operation x) => new QueryCashShopProductInfoByCashShopKeyProcessor(this, x as QueryCashShopProductInfoByCashShopKey));
            base.RegisterProcessor(typeof(WishListSelect), (Operation x) => new WishListSelectProcessor(this, x as WishListSelect));
            base.RegisterProcessor(typeof(WishListInsert), (Operation x) => new WishListInsertProcessor(this, x as WishListInsert));
            base.RegisterProcessor(typeof(WishListDelete), (Operation x) => new WishListDeleteProcessor(this, x as WishListDelete));
            this.IsCashShopStopped = false;
            ServiceCore.FeatureMatrix.GetString("");
            this.IsCashShopServiceUseable = (ServiceCore.FeatureMatrix.LangTag != "KO-KR-X-DEV");
            string text = ServiceCore.FeatureMatrix.GetString("NISMSEncodingType");

            if (text == "")
            {
                text = "Default";
                Log <CashShopService> .Logger.WarnFormat("can't find NISMSEncodingType feature. EncodingType will set {0} type.", text);
            }
            this.Connection = new Connection(text);
            this.Connection.CategoryArrayChanged += this.Connection_CategoryArrayChanged;
            this.Connection.ProductArrayChanged  += this.Connection_ProductArrayChanged;
            this.Connection.Disconnected         += delegate(object sender, EventArgs e)
            {
                Log <CashShopService> .Logger.Fatal("CashShop Disconnected!");

                if (this.IsCashShopServiceUseable)
                {
                    Scheduler.Schedule(base.Thread, Job.Create <bool>(new Action <bool>(this.connectToCashShop), true), 60000);
                }
            };
            this.Connection.ConnectionFail += delegate(object sender, EventArgs <Exception> e)
            {
                Log <CashShopService> .Logger.Fatal("CashShop Connection Failed...");

                Scheduler.Schedule(base.Thread, Job.Create <bool>(new Action <bool>(this.connectToCashShop), true), 60000);
            };
            this.Connection.ConnectionSucceed += delegate(object sender, EventArgs e)
            {
                Log <CashShopService> .Logger.Info("CashShop Connected.");

                this.IsCashShopServiceUseable = true;
            };
            Scheduler.Schedule(base.Thread, Job.Create <bool>(new Action <bool>(this.connectToCashShop), false), 0);
            if (ServiceCore.FeatureMatrix.IsEnable("BeautyShopItemSyncNISMS"))
            {
                try
                {
                    string cashShopType = ServiceCore.FeatureMatrix.GetString("LanguageTag");
                    this.CustomizeCouponInfoList = (from x in HeroesContentsLoader.GetTable <CustomizeItemInfo>()
                                                    where (x.Weight == -1 || x.Weight == -2) && (x.CashShopType ?? cashShopType) == cashShopType
                                                    select x).ToList <CustomizeItemInfo>();
                    foreach (CustomizeItemInfo customizeItemInfo in this.CustomizeCouponInfoList)
                    {
                        BeautyShopCouponListElement item = new BeautyShopCouponListElement(customizeItemInfo.Category, customizeItemInfo.ItemClass, customizeItemInfo.Weight);
                        this.BeautyShopCouponList.Add(item);
                    }
                    this.ItemClassInfoDic = (from x in HeroesContentsLoader.GetTable <ItemClassInfo>()
                                             where ServiceCore.FeatureMatrix.IsEnable(x.Feature)
                                             select x).ToDictionary_OverwriteDuplicated((ItemClassInfo x) => x.ItemClass);
                }
                catch (Exception ex)
                {
                    Log <CashShopService> .Logger.Error(ex);
                }
            }
            WishListManager function = new WishListManager(this);

            base.RegisterFunction <WishListManager>(function);
        }