Exemplo n.º 1
0
        public ActionResult SaveAccount(UserProfileModel userProfileModel)
        {
            const MessageIdEnum successMessage = MessageIdEnum.NewAccountSuccess;
            const MessageIdEnum failureMessage = MessageIdEnum.NewAccountFailure;

            if (ModelState.IsValid)
            {
                var userProfileCurrentUser = _userRepository.GetUserProfileByName(User.Identity.Name);

                if (_accountsWorker.RegisterAdditionalAccount(userProfileModel, userProfileCurrentUser))
                {
                    var newUserProfile = _userRepository.GetUserProfileByName(userProfileModel.UserName);
                    if (newUserProfile != null &&
                        _accountsWorker.SendRegistrationConfirmationEmail(newUserProfile.Id))
                    {
                        TempData["Message"] = successMessage;
                        return(RedirectToAction("AdditionalAccounts", "Profile"));
                    }
                }
            }

            // If we got this far, something failed, display failure message
            TempData["Message"] = failureMessage;
            return(RedirectToAction("AdditionalAccounts", "Profile"));
        }
Exemplo n.º 2
0
        public ActionResult Search(SearchModel searchModel)
        {
            const MessageIdEnum successMessage = MessageIdEnum.SearchSuccess;
            const MessageIdEnum failureMessage = MessageIdEnum.SearchFailure;

            searchModel.FoundProducts = new List <Product>();

            if (ModelState.IsValid)
            {
                var tmpFoundProducts = _luceneWorker.SearchDefault(searchModel.SearchString, searchModel.FieldName).ToList();
                if (tmpFoundProducts != null)
                {
                    foreach (var tmpFoundProduct in tmpFoundProducts)
                    {
                        tmpFoundProduct.Images =
                            _imageRepository.GetImagesForProduct(tmpFoundProduct.ProductID).ToList();
                    }

                    TempData["Message"]       = successMessage;
                    searchModel.FoundProducts = tmpFoundProducts;
                }
            }

            if (searchModel.FoundProducts == null)
            {
                // If we got this far, something failed, display failure message
                TempData["Message"] = failureMessage;
            }

            if (TempData != null && TempData["Message"] != null)
            {
                switch ((MessageIdEnum)TempData["Message"])
                {
                case MessageIdEnum.SearchFailure:
                    TempData["StatusMessage"]      = DbRes.T("Messages.SearchFailure", "Resources");
                    TempData["StatusMessageClass"] = "message-error";
                    break;

                case MessageIdEnum.SearchSuccess:
                    TempData["StatusMessage"] = string.Format(DbRes.T("Messages.SearchSuccess", "Resources"),
                                                              searchModel.FoundProducts.Count,
                                                              searchModel.SearchString);
                    TempData["StatusMessageClass"] = "message-success";
                    break;

                default:
                    TempData["StatusMessage"]      = string.Empty;
                    TempData["StatusMessageClass"] = string.Empty;
                    break;
                }
            }

            return(View(searchModel));
        }
Exemplo n.º 3
0
        public ActionResult SaveProfile(EditProfileModel profileModel)
        {
            const MessageIdEnum successMessage = MessageIdEnum.SaveProfileSuccess;
            const MessageIdEnum failureMessage = MessageIdEnum.SaveProfileFailure;

            if (ModelState.IsValid)
            {
                if (_userRepository.SaveProfile(profileModel))
                {
                    TempData["Message"] = successMessage;
                    return(RedirectToAction("EditProfile", "Profile"));
                }
            }

            // If we got this far, something failed, display failure message
            TempData["Message"] = failureMessage;
            return(RedirectToAction("EditProfile", "Profile"));
        }
Exemplo n.º 4
0
    //show box message
    public void showConfirmBox()
    {
        if (selectedCard.Count > 0)
        {
            bool bContaingHighStarCard = false;
            foreach (var card in selectedCard)
            {
                if (card.quality >= 6)
                {
                    bContaingHighStarCard = true;
                    break;
                }
            }
            MessageIdEnum msg = MessageIdEnum.Msg71;
//            string strDescri = "共出售 "+ selectedNum.text + " 个侠士,可获得 " + selectNumMoney.text + " 金币\n";

            if (CheckSellCardArrayContainQxzbCard())
            {
                msg = MessageIdEnum.Msg194;
            }
            else if (bContaingHighStarCard)
            {
                msg = MessageIdEnum.Msg108;
            }

//            BoxManager.showConfirmMessage(strDescri);
            BoxManager.showMessageByID((int)msg, selectedNum.text, selectNumMoney.text);
            UIEventListener.Get(BoxManager.getYesButton()).onClick += sellCard;
            UIEventListener.Get(BoxManager.getNoButton()).onClick  += CancelSellCard;

//			Messenger.AddListener<bool>("BOX",sellCard);
        }
        else
        {
//            BoxManager.showMessage("未选择任何卡牌");
            BoxManager.showMessageByID((int)MessageIdEnum.Msg100);
        }
    }