Ejemplo n.º 1
0
 void onButtonClick(ShopModel model)
 {
     bool added = false;// show floating Text
     services.ShopService.Buy(model)
         .Catch(exception => added = false)
         .Done(() => added = true);
 }
Ejemplo n.º 2
0
 public ShopElement(Transform transform, IServices services, ShopModel model)
 {
     go = transform.gameObject;
     this.services = services;
     this.model = model;
     setReferences();
     setTexts();
 }
Ejemplo n.º 3
0
    IPromise BuyGems(ShopModel model)
    {
        promise = new Promise();

        if (iapService.IsInitialized())
            iapService.BuyConsumableProduct(model.googleId);
        else
            promise.Reject(new Exception());
        return promise;
    }
Ejemplo n.º 4
0
        public void SetData(RmbMallVo vo, UserBuyRmbMallVo uservo, ShopModel buyGemModel = null)
        {
            _rmbIcon.gameObject.SetActive(true);
            _itemRmbVo        = vo;
            mallid            = vo.MallId;
            _userBuyRmbMallVo = uservo;
            _curmallSortPB    = vo.MallSortPb;
            _isBuyGem         = buyGemModel != null;
            if (vo.MallSortPb == MallSortPB.MallOrdinary && buyGemModel != null && !buyGemModel.HasDoublePrice(vo.RealPrice))
            {
                _isfirstPrice = true;
            }
            else
            {
                _isfirstPrice = false;
            }


//            Debug.LogError(vo.MallName+"_isfirstPrice"+_isfirstPrice);
            var payvo = GlobalData.PayModel.GetProduct(vo.MallId);

            if (vo.OriginalPrice > 0)
            {
                _primecost.text = payvo?.GetOriginalPrice(vo.OriginalPrice);
            }
            var realrmbpoint = payvo != null ? payvo.AmountRmb : vo.RealPrice;

            _rmbIcon.text = payvo?.Curreny;
            if (AppConfig.Instance.isChinese == "true" || payvo?.Curreny == Constants.CHINACURRENCY)
            {
                _rmbIcon.text   = "";
                _primecost.text = vo.OriginalPrice + "元";
            }

            _areaprice = payvo?.AreaPrice;
            if (_isBuyGem)
            {
                realrmbpoint = vo.RealPrice * 10;
                if (vo.RealPrice <= 0)
                {
                    Debug.LogError("数据异常:" + vo.MallName + " " + vo.OriginalPrice);
                }
            }

            if (uservo != null)
            {
                SetCommonUIData(vo.MallName, vo.MallDesc, realrmbpoint, vo.OriginalPrice,
                                DateUtil.GetDay(vo.EndTime - ClientTimer.Instance.GetCurrentTimeStamp()), vo.MallLabelPb, vo.BuyMax,
                                (uservo.BuyNum >= vo.BuyMax && vo.BuyMax != 0), PropConst.GemIconId, vo.Award,
                                vo.GiftImage, uservo.RefreshTime, _itemRmbVo.LabelImage); //(vo.BuyMax - uservo?.BuyNum ?? 0) + "/" + vo.BuyMax
            }
        }
Ejemplo n.º 5
0
        public void TestShopInvTypes()//Test shop item types
        {
            ShopModel test  = new ShopModel(new InventoryItemsModel("test"));
            int       item1 = test.CheckItem(test.BuyItem[0].item);
            int       item2 = test.CheckItem(test.BuyItem[1].item);
            int       item3 = test.CheckItem(test.BuyWeapons[0].item);
            int       item4 = test.CheckItem(test.BuyWeapons[1].item);

            Assert.Equal(1, item1);
            Assert.Equal(1, item2);
            Assert.Equal(0, item3);
            Assert.Equal(0, item4);//Check the item types
        }
Ejemplo n.º 6
0
        public async Task <ActionResult <ShopEntity> > EditShopDetails(int shopId, ShopModel shop)
        {
            var editedShop = shopQuery.EditShopDetails(shopId, shop);

            if (editedShop != null)
            {
                return(editedShop);
            }
            else
            {
                return(NotFound());
            }
        }
Ejemplo n.º 7
0
 public static bool AddShop(ShopModel model)
 {
     if (_listOfShops.Any(shop => shop.Number == model.Number))
     {
         return(false);
     }
     else
     {
         _listOfShops.Add(model);
         SaveData();
         return(true);
     }
 }
Ejemplo n.º 8
0
 private Shop Convert(ShopModel model)
 {
     return(new Shop()
     {
         Id = model.Id,
         Name = model.Name,
         Address = model.Address,
         Products = model.Products.Select(x => new Product {
             Id = x.Id, Name = x.Name, Price = x.Price, ShopId = x.ShopId
         }),
         Phone = model.Phone,
     });
 }
Ejemplo n.º 9
0
        public async Task <ActionResult> Post([FromBody] ShopModel model)
        {
            var shop = new Shop()
            {
                Name    = model.Name,
                Address = model.Address,
                Phone   = model.Phone
            };

            await _shopRepository.Add(shop);

            return(Ok());
        }
Ejemplo n.º 10
0
        public void TestShopItems()                                // Test if the items generated at all.
        {
            List <ItemModel> TestWeapons = new List <ItemModel>(); // Store weapon item details
            List <ItemModel> TestItem    = new List <ItemModel>(); // Store weapon item details
            ShopModel        test        = new ShopModel(new InventoryItemsModel("test"));

            TestWeapons = test.BuyWeapons;
            TestItem    = test.BuyItem;
            if (TestWeapons.Count > 0 && TestItem.Count > 0)
            {
                Assert.True(true);
            }
        }
Ejemplo n.º 11
0
        public async Task <ActionResult> Create(ShopModel shop)
        {
            var response = await service.CreateShop(shop);

            if (response != null)
            {
                return(View("Success", response));
            }
            else
            {
                shop.Title = null;
                return(View("Create", shop));
            }
        }
Ejemplo n.º 12
0
        public ActionResult Colors(int id, ShopModel m) //ProductColorsManager dahil edildi
        {
            ProductsManager      pm    = new ProductsManager();
            ProductColorsManager pcolm = new ProductColorsManager();

            m.pcollist = pcolm.GetAll().Where(x => x.ColorID == id).ToList();

            foreach (var item in m.pcollist)
            {
                m.plist.Add(pm.Single(item.ProductsID));
            }
            Session["Products"] = m.plist;
            return(RedirectToAction("Shop", "Shop", m));
        }
Ejemplo n.º 13
0
        private TelegramBot cBot;                   //Бот

        public AvitoShop(ShopModel _cModel, string _token)
        {
            //Инициализация
            try
            {
                cModel   = _cModel;
                dbWorker = new AvitoDBworker(_cModel.dbName);
                cBot     = new TelegramBot(_token);
            }
            catch
            {
                throw new Exception("Can't Avito parser initializating");
            }
        }
Ejemplo n.º 14
0
 public ActionResult AddOrEdit(int id = 0)
 {
     if (id == 0)
     {
         return(View(new Product()));
     }
     else
     {
         using (ShopModel db = new ShopModel())
         {
             return(View(db.Products.Where(x => x.Id == id).FirstOrDefault <Product>()));
         }
     }
 }
Ejemplo n.º 15
0
        public void Spawn(ShopModel shopModel)
        {
            ClearShop();

            //Создать разделы
            foreach (SectionModel shopSectionModel in shopModel.UiSections)
            {
                sectionSpawner.SpawnSection(shopSectionModel, shopModel.Id);
            }

            var requiredSectionNames = shopModel.GetRequiredSectionNames();

            scrollViewSmoothMovement.InitRequiredSections(requiredSectionNames);
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ShopModel shopModel = db.Shop.Find(id);

            if (shopModel == null)
            {
                return(HttpNotFound());
            }
            return(View(shopModel));
        }
Ejemplo n.º 17
0
        public ActionResult Hang(int brandId, int page)
        {
            Session[CommonConstants.CURRENT_ROUTE]    = (int)CommonConstants.Shop_Route.Brands;
            Session[CommonConstants.CURRENT_ROUTE_ID] = brandId;

            // count number of product
            var temp_Model          = new LayoutModel();
            var count_product_brand = temp_Model.Get_Count_Product_Brand(brandId);

            string action = "brand";

            ViewBag.Brand = brandId;
            ShopModel models = new ShopModel(action, brandId, page);

            if (models.ListProduct.Count() != 0)
            {
                ViewBag.PageTitle = models.ListProduct[0].BrandName;
            }

            ViewBag.Page  = page;
            ViewBag.Count = count_product_brand;
            ViewBag.Brand = brandId;

            // sort part
            var list_sort_type = new List <Sort_Type>()
            {
                new Sort_Type {
                    Sort_Name = "Mới nhất", Value = (int)CommonConstants.Sort_Type.ID_DESC
                },
                new Sort_Type {
                    Sort_Name = "Cũ nhất", Value = (int)CommonConstants.Sort_Type.ID_ASC
                },
                new Sort_Type {
                    Sort_Name = "Giá tăng dần", Value = (int)CommonConstants.Sort_Type.Price_ASC
                },
                new Sort_Type {
                    Sort_Name = "Giá giảm dần", Value = (int)CommonConstants.Sort_Type.Price_DESC
                }
            };
            int current_sort = 2; // 2: ID_DESC = mới nhất

            if (Session[CommonConstants.SORT_SESSION] != null)
            {
                current_sort = (int)Session[CommonConstants.SORT_SESSION];
            }

            ViewBag.sort_Type = new SelectList(list_sort_type, "Value", "Sort_Name", current_sort);

            return(View(models));
        }
Ejemplo n.º 18
0
    IPromise BuyCoins(ShopModel model)
    {
        promise = new Promise();

        if (canBuyCoins(model))
        {
            currencyService.IncreaseCoins(model.count);
            currencyService.DecreaseGems(model.price);
            promise.Resolve();
        }
        else
            promise.Reject(new Exception());
        return promise;
    }
Ejemplo n.º 19
0
    public void Show(ShopModel model)
    {
        HideAllShopPanel();

        for (int i = 0; i < model.shopDataList.Count; i++)
        {
            ShopData  sd = model.shopDataList[i];
            ShopPanel sp = shopPanelList[i];

            sp.Show(sd);
        }

        this.gameObject.SetActive(true);
    }
Ejemplo n.º 20
0
 public ActionResult AddOrEdit(int id = 0)
 {
     if (id == 0)
     {
         return(View(new Customer()));
     }
     else
     {
         using (ShopModel db = new ShopModel())
         {
             return(View(db.Customers.Where(x => x.Id == id).FirstOrDefault <Customer>()));
         }
     }
 }
Ejemplo n.º 21
0
        public ActionResult ShopDetail()
        {
            long      shopId    = base.CurrentSellerManager.ShopId;
            ShopInfo  shop      = ServiceHelper.Create <IShopService>().GetShop(shopId, true);
            ShopModel shopModel = new ShopModel(shop)
            {
                BusinessCategory = new List <CategoryKeyVal>()
            };

            foreach (long key in shop.BusinessCategory.Keys)
            {
                List <CategoryKeyVal> businessCategory = shopModel.BusinessCategory;
                CategoryKeyVal        categoryKeyVal   = new CategoryKeyVal()
                {
                    CommisRate = shop.BusinessCategory[key],
                    Name       = ServiceHelper.Create <ICategoryService>().GetCategory(key).Name
                };
                businessCategory.Add(categoryKeyVal);
            }
            ViewBag.CompanyRegionIds    = ServiceHelper.Create <IRegionService>().GetRegionIdPath(shop.CompanyRegionId);
            ViewBag.BankRegionIds       = ServiceHelper.Create <IRegionService>().GetRegionIdPath(shop.BankRegionId);
            ViewBag.BusinessLicenseCert = shop.BusinessLicenseCert;
            ViewBag.Logo     = shop.Logo;
            ViewBag.GMPPhoto = shop.GMPPhoto;
            ViewBag.ISOPhoto = shop.ISOPhoto;
            ViewBag.FDAPhoto = shop.FDAPhoto;
            string[] strArrays  = new string[3];
            string[] strArrays1 = new string[3];
            string[] strArrays2 = new string[3];
            if (!string.IsNullOrWhiteSpace(shop.BusinessLicenseCert))
            {
                strArrays = shop.BusinessLicenseCert.Split(new char[] { ',' });
            }

            if (!string.IsNullOrWhiteSpace(shop.ProductCert))
            {
                strArrays1 = shop.ProductCert.Split(new char[] { ',' });
            }

            //if (!string.IsNullOrWhiteSpace(shop.OtherCert))
            //{
            //    strArrays2 = shop.OtherCert.Split(new char[] { ',' });
            //}

            ViewBag.BusinessLicenseCerts = strArrays;
            ViewBag.ProductCerts         = strArrays1;
            ViewBag.OtherCerts           = shop.OtherCert;
            return(View(shopModel));
        }
Ejemplo n.º 22
0
        // GET: Admin/Shop
        public ActionResult Management(string type = "", int s = 0)
        {
            Himall.Web.Models.ShopModel result = new ShopModel();
            var           state    = (Himall.Entities.ShopInfo.ShopAuditStatus)s;
            List <string> drpstate = new List <string>();

            drpstate.Add("2");
            //drpstate.Add("3");
            drpstate.Add("5");

            var status = Himall.Entities.ShopInfo.ShopAuditStatus.Open.ToSelectList();

            if (state > 0)
            {
                status = state.ToSelectList();
            }
            var StatusList = type == "Auditing" ? status.Where(c => drpstate.Contains(c.Value)) : status;
            var ssellist   = StatusList.Select(d => new { Id = d.Value, Name = d.Text }).ToList();

            //if (type == "Auditing")
            //{
            ssellist.Insert(0, new { Id = "", Name = "请选择..." });
            //}
            SelectList StateSelectList = new SelectList((ssellist), "Id", "Name", s);

            ViewBag.StatusList = StateSelectList;
            var grade = _iShopService.GetShopGrades();
            List <SelectListItem> gradeList = new List <SelectListItem> {
                new SelectListItem
                {
                    Selected = true,
                    Value    = 0.ToString(),
                    Text     = "请选择..."
                }
            };

            foreach (var item in grade)
            {
                gradeList.Add(new SelectListItem
                {
                    Selected = false,
                    Value    = item.Id.ToString(),
                    Text     = item.Name
                });
            }
            ViewBag.Type  = type;
            ViewBag.Grade = gradeList;
            return(View(result));
        }
Ejemplo n.º 23
0
        public ActionResult AddShops(ShopModel shopModel)
        {
            bool flage = ServiceHelper.GetShopsService.Exists(t => t.ShopName == shopModel.ShopName);

            if (flage)
            {
                return(Json(new Result(false, "已经存在同名机构"), JsonRequestBehavior.AllowGet));
            }



            Shops singleShops = CreateShop(shopModel);

            return(Json(new Result(singleShops != null, ResultType.Add), JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 24
0
        public async Task <ActionResult> ChangeShopStatus(ShopStatusDTO shopStatusDto)
        {
            ShopModel shop = await userCosmosDBService.GetUserInfo(shopStatusDto.UserEmail);

            if (shop != null)
            {
                shop.Status = shopStatusDto.Status;
                if (await userCosmosDBService.ReplaceDocumentAsync(shop.SelfLink, shop))
                {
                    return(Ok("Shop status changed successfully"));
                }
                return(StatusCode(500, "Unable to update the status"));
            }
            return(BadRequest("Couldn't find the shop specified"));
        }
Ejemplo n.º 25
0
    public void GetShopItemsAsync(ResultCallback callback = null)
    {
        CoroutineManager.SendRequest(GetShopItemsUrl, null, (ShopModel model) =>
        {
            CurrentShop = model;
            GameController.SetHash("ShopHash", model.ShopHash);

            SetShopItems(model);

            if (callback != null)
            {
                callback();
            }
        }, type: DataType.Shop, loadingPanelsKey: "shop");
    }
Ejemplo n.º 26
0
        public void UpdateShop(ShopModel shopModel)
        {
            Models.DBObjects.Shop existingShop = dbContext.Shops.FirstOrDefault(x => x.ShopId == shopModel.ShopId);
            if (existingShop != null)
            {
                existingShop.ShopId     = shopModel.ShopId;
                existingShop.AddressID  = shopModel.AddressID;
                existingShop.Name       = shopModel.Name;
                existingShop.Phone      = shopModel.Phone;
                existingShop.Email      = shopModel.Email;
                existingShop.CategoryID = shopModel.CategoryID;

                dbContext.SubmitChanges();
            }
        }
Ejemplo n.º 27
0
        public async Task <ActionResult> Edit(ShopModel shopForEdit)
        {
            var response = await service.EditShop(shopForEdit);

            if (response.IsSuccessStatusCode)
            {
                var responseAfterPut = await service.GetOwnShop();

                return(View("Success", responseAfterPut));
            }
            HttpResponseModel resp = new HttpResponseModel();

            resp.ReasonMessage = response.ReasonPhrase;
            return(View("Failure", resp));
        }
Ejemplo n.º 28
0
        //------------------------------------------------------------------------------------------------------------------------
        //                                                  ShopView()
        //------------------------------------------------------------------------------------------------------------------------
        public ShopView(ShopModel shop, ShopController shopController) : base(340, 340)
        {
            this.shop           = shop;
            this.shopController = shopController;

            iconCache = new Dictionary <string, Texture2D>();

            x = (game.width - width) / 2;
            y = (game.height - height) / 2;

            canvasItems = new List <Canvas>();

            _currencyEuro = true;
            Subscribe(this);
        }
 public static bool VerifyPasswordHash(string password, ShopModel shopModel)
 {
     using (var hmac = new HMACSHA512(shopModel.PasswordSalt))
     {
         var computedHash = hmac.ComputeHash(Encoding.UTF8.GetBytes(password));
         for (int i = 0; i < computedHash.Length; i++)
         {
             if (computedHash[i] != shopModel.PasswordHash[i])
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 30
0
        logged truth = new logged();// Used for telling threads of the application to stop running whenever this is false

        /*
         * Initialize all components and classes for traversing through both details page and masterpage
         * PARAM
         * user: the user data
         * items: the items data
         * RETURNS Nothing
         */
        public AddView(UserModel user, InventoryItemsModel items, StatsModel stats)
        {
            InitializeComponent();
            WeaponInfoModel    weapon      = new WeaponInfoModel(items);
            ItemInfoModel      Invitem     = new ItemInfoModel(items);
            CharacterInfoModel Characters  = new CharacterInfoModel(items, user.LocalLogin);
            ShopModel          Shop        = new ShopModel(items);
            DungeonModel       realDungeon = new DungeonModel();

            Xamarin.Forms.NavigationPage.SetHasNavigationBar(this, false);
            DungeonView dungeon = new DungeonView(user, items, weapon, Invitem, stats, false, realDungeon);

            this.Detail = new NavigationPage(new TasksView(user, items, truth, dungeon, new InventoryView(items, weapon, user, Invitem, Characters))); // Set Detailspage arguments with user information and truth value.
            this.Master = new MasterPageView(Detail, user, items, weapon, truth, dungeon, Invitem, Shop, Characters);                                  // set the masterpage information with user, items, and truth values.
        }
Ejemplo n.º 31
0
        public async Task <ActionResult> Delete(ShopModel shop)
        {
            var response = await service.DeleteShop(shop);

            if (response.IsSuccessStatusCode)
            {
                return(View("Create"));
            }
            else
            {
                HttpResponseModel resp = new HttpResponseModel();
                resp.ReasonMessage = response.ReasonPhrase;
                return(View("Failure", resp));
            }
        }
Ejemplo n.º 32
0
        public async Task <ShopModel> GetShopModelAsync(CancellationToken cts)
        {
            log.Info("Старт скачивания модели магазина");
            HttpClient httpClient    = new HttpClient();
            int        attemptNumber = 0;

            while (true)
            {
                log.Info("Номер попытки " + attemptNumber++);
                await Task.Delay(1000, cts);

                try
                {
                    if (!PlayerIdStorage.TryGetServiceId(out var playerServiceId))
                    {
                        log.Warn("Не удалось получить id игрока");
                        continue;
                    }

                    string url = $"{NetworkGlobals.GetShopModel}?playerId={playerServiceId}";
                    HttpResponseMessage response = await httpClient.GetAsync(url, cts);

                    if (!response.IsSuccessStatusCode)
                    {
                        log.Warn("Статус ответа " + response.StatusCode);
                        continue;
                    }

                    string base64String = await response.Content.ReadAsStringAsync();

                    if (base64String.Length == 0)
                    {
                        log.Warn("Ответ пуст ");
                        continue;
                    }

                    byte[] data = Convert.FromBase64String(base64String);
                    log.Info("Длина ответа в байтах " + data.Length);
                    ShopModel result = ZeroFormatterSerializer.Deserialize <ShopModel>(data);
                    log.Info("Десериализация прошла нормально");
                    return(result);
                }
                catch (Exception e)
                {
                    log.Error("Упало при скачивании разметки магазина " + e.Message + " " + e.StackTrace);
                }
            }
        }
Ejemplo n.º 33
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                ShopEditViewModel shopViewModel = new ShopEditViewModel();
                TryUpdateModel(shopViewModel);

                var shopModel = new ShopModel();
                shopModel.ShopId     = shopViewModel.Shop.ShopId;
                shopModel.AddressID  = shopViewModel.Address.AddressID;
                shopModel.Email      = shopViewModel.Shop.Email;
                shopModel.Name       = shopViewModel.Shop.Name;
                shopModel.Phone      = shopViewModel.Shop.Phone;
                shopModel.CategoryID = shopViewModel.Shop.CategoryID;
                shopRepository.UpdateShop(shopModel);

                var addressModel = new AddressModel();
                addressModel.AddressID    = shopViewModel.Address.AddressID;
                addressModel.City         = shopViewModel.Address.City;
                addressModel.Country      = shopViewModel.Address.Country;
                addressModel.County       = shopViewModel.Address.County;
                addressModel.PostCode     = shopViewModel.Address.PostCode;
                addressModel.Street       = shopViewModel.Address.Street;
                addressModel.StreetNumber = shopViewModel.Address.StreetNumber;
                addressRepository.UpdateAddress(addressModel);

                shopPaymentMethodsRepository.DeleteShopPaymentMethods(shopViewModel.Shop.ShopId);

                foreach (var paymentMethodViewModel in shopViewModel.PaymentMethods)
                {
                    if (paymentMethodViewModel.Selected == true)
                    {
                        var shopPaymentMethod = new ShopPaymentMethodModel();
                        shopPaymentMethod.PaymentMethodID = paymentMethodViewModel.PaymentMethod.PaymentMethodID;
                        shopPaymentMethod.ShopID          = shopViewModel.Shop.ShopId;

                        shopPaymentMethodsRepository.InsertShopPaymentMethod(shopPaymentMethod);
                    }
                }

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                HandleErrorInfo error = new HandleErrorInfo(ex, "Shop", "Edit");
                return(View("Error", error));
            }
        }
Ejemplo n.º 34
0
        public ActionResult EditShop(ShopModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单验证成功
            if (ModelState.IsValid)
            {
                IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

                T_Shop shop = ShopBll.GetEntity(m => m.Id == model.Id);
                if (shop != null)
                {
                    shop.ShopName          = model.ShopName;
                    shop.Phone             = model.Tel;
                    shop.ProvinceId        = model.ProvinceId;
                    shop.CityId            = model.CityId;
                    shop.CountyId          = model.CountyId;
                    shop.Address           = model.Address;
                    shop.MainSale          = model.MainSale;
                    shop.Content           = model.Content;
                    shop.StartBusinessTime = model.StartBusinessTime;
                    shop.EndBusinessTime   = model.EndBusinessTime;
                    //shop.IsDelivery = model.IsDelivery ? 1 : 0;
                    shop.Type       = model.Types;
                    shop.UpdateTime = DateTime.Now;

                    //修改保存到数据库
                    if (ShopBll.UpdateShop(shop, model.PlaceIds))
                    {
                        //日志记录
                        jm.Content = PropertyUtils.ModelToJsonString(model);
                    }
                    else
                    {
                        jm.Msg = "编辑失败";
                    }
                }
                else
                {
                    jm.Msg = "该门店不存在";
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 35
0
        private ActionResult ShopByName(string shop)
        {
            ShopModel model = new ShopModel
                {
                    Title = "Shop: " + shop,
                    TopText = TopText,
                    Shop = shop
                };

            model.NetsyControl = new NetsySilverlightModel
                {
                    Heading = string.Format("Etsy listings for the shop '{0}'", shop),
                    Params = string.Format("Retrieval=ShopListings,UserId={0},ItemsPerPage=16", shop),
                    Height = 560,
                    Width = 660
                };

            return this.View(model);
        }
Ejemplo n.º 36
0
 bool canBuyCoins(ShopModel model)
 {
     return currencyService.Gems >= model.price;
 }
Ejemplo n.º 37
0
        public ActionResult Shop()
        {
            ShopConfigInfo shopConfigInfo = BSPConfig.ShopConfig;

            ShopModel model = new ShopModel();
            model.IsGuestSC = shopConfigInfo.IsGuestSC;
            model.SCSubmitType = shopConfigInfo.SCSubmitType;
            model.GuestSCCount = shopConfigInfo.GuestSCCount;
            model.MemberSCCount = shopConfigInfo.MemberSCCount;
            model.SCExpire = shopConfigInfo.SCExpire;
            model.OSNFormat = shopConfigInfo.OSNFormat;
            model.OnlinePayExpire = shopConfigInfo.OnlinePayExpire;
            model.OfflinePayExpire = shopConfigInfo.OfflinePayExpire;
            model.BroHisCount = shopConfigInfo.BroHisCount;
            model.MaxShipAddress = shopConfigInfo.MaxShipAddress;
            model.FavoriteCount = shopConfigInfo.FavoriteCount;

            return View(model);
        }
Ejemplo n.º 38
0
 /// <summary>
 /// 添加商户
 /// </summary>
 /// <returns></returns>
 public int AddShop(ShopModel model)
 {
     const string sql = "insert into coupon_shop (innerid, shopname, shopcode, password, telephone, email, headportrait, status, provid, cityid, countyid,address, qq, signature, qrcode, createdtime, modifiedtime,code) " +
                        "values (@innerid, @shopname, @shopcode, @password, @telephone, @email, @headportrait, @status, @provid, @cityid, @countyid,@address, @qq, @signature, @qrcode, @createdtime, @modifiedtime,@code);";
     try
     {
         Helper.Execute(sql, model);
         return 1;
     }
     catch (Exception ex)
     {
         LoggerFactories.CreateLogger().Write("添加商户异常:", TraceEventType.Error, ex);
         return 0;
     }
 }
Ejemplo n.º 39
0
        public ActionResult Shop(ShopModel model)
        {
            if (ModelState.IsValid)
            {
                ShopConfigInfo shopConfigInfo = BSPConfig.ShopConfig;

                shopConfigInfo.IsGuestSC = model.IsGuestSC;
                shopConfigInfo.SCSubmitType = model.SCSubmitType;
                shopConfigInfo.GuestSCCount = model.GuestSCCount;
                shopConfigInfo.MemberSCCount = model.MemberSCCount;
                shopConfigInfo.SCExpire = model.SCExpire;
                shopConfigInfo.OSNFormat = model.OSNFormat;
                shopConfigInfo.OnlinePayExpire = model.OnlinePayExpire;
                shopConfigInfo.OfflinePayExpire = model.OfflinePayExpire;
                shopConfigInfo.BroHisCount = model.BroHisCount;
                shopConfigInfo.MaxShipAddress = model.MaxShipAddress;
                shopConfigInfo.FavoriteCount = model.FavoriteCount;

                BSPConfig.SaveShopConfig(shopConfigInfo);
                Emails.ResetShop();
                SMSes.ResetShop();
                AddAdminOperateLog("修改商城设置");
                return PromptView(Url.Action("shop"), "修改商城设置成功");
            }
            return View(model);
        }
Ejemplo n.º 40
0
 public IPromise Buy(ShopModel model)
 {
     return model.type == ShopType.COINS ? BuyCoins(model) : BuyGems(model);
 }
Ejemplo n.º 41
0
 void registerPurchase(ShopModel model)
 {
     currencyService.IncreaseGems(model.count);
     if (promise != null)
         promise.Resolve();
 }
Ejemplo n.º 42
0
 /// <summary>
 /// 更新商户
 /// </summary>
 /// <returns></returns>
 public int UpdateShop(ShopModel model)
 {
     var sqlStr = new StringBuilder("update coupon_shop set ");
     sqlStr.Append(Helper.CreateField(model).Trim().TrimEnd(','));
     sqlStr.Append(" where innerid = @innerid");
     using (var conn = Helper.GetConnection())
     {
         var tran = conn.BeginTransaction();
         try
         {
             conn.Execute(sqlStr.ToString(), model, tran);
             tran.Commit();
             return 1;
         }
         catch (Exception ex)
         {
             LoggerFactories.CreateLogger().Write("更新商户异常:", TraceEventType.Error, ex);
             tran.Rollback();
             return 0;
         }
     }
 }