Ejemplo n.º 1
0
        //決済サーバメンテナンス時に決済処理関連ボタンをDisabledにする
        protected void SetPaymentMaintInf()
        {
            //決済処理メンテナンス期間取得
            var maintenance_from = TypeHelper.GetDateTime(ConfigurationManager.AppSettings["PaymentMaintenanceFrom"]);
            var maintenance_to   = TypeHelper.GetDateTime(ConfigurationManager.AppSettings["PaymentMaintenanceTo"]);
            var today            = RegionConfig.GetRegionToday(_currentRegion.CurrentDestination);

            if (maintenance_from <= today && today <= maintenance_to)
            {
                ViewBag.PaymentMaintenanceFrom = maintenance_from;
                ViewBag.PaymentMaintenanceTo   = maintenance_to;
            }
        }
Ejemplo n.º 2
0
        ///// <summary>
        ///// 言語が選択された時の処理。
        ///// </summary>
        ///// <param name="region_cd"></param>
        ///// <returns></returns>
        //public ActionResult SelectLanguage(string language, string ReturnUrl) {

        //    if (!string.IsNullOrWhiteSpace(language)) {
        //        this.CurrentRegionInfo.CurrentLanguage = language;
        //        Session[Constants.SSKEY_CURRENT_REGION] = this.CurrentRegionInfo;

        //        //Cookieに言語設定を保存。(LocalStorageだと1回めのリクエストと同時に送る事が出来ないので、この用途にはCookieの方が良い。)
        //        SetLanguageCookie(language);
        //    }

        //    if (string.IsNullOrWhiteSpace(ReturnUrl)) {
        //        //クロールエラー対策。検索エンジンロボットの場合はUrlReferrerはnullなのでその場合に500エラーにならない様に。
        //        if (Request.UrlReferrer != null) {
        //            ReturnUrl = Request.UrlReferrer.ToString();
        //        } else {
        //            ReturnUrl = "";
        //        }
        //    }
        //    return RedirectToLocal(ReturnUrl);
        //}

        ///// <summary>
        ///// 希望挙式日が選択された時の処理。
        ///// </summary>
        ///// <param name="region_cd"></param>
        ///// <returns></returns>
        //public ActionResult SelectWeddingDate(DateTime? wed_date = null, string region_cd = null, string area_cd = null, bool item_list_display = false, bool type_list_display = false) {

        //    region_cd = string.IsNullOrEmpty(region_cd) ? this.CurrentRegionInfo.CurrentDestination : region_cd;
        //    area_cd = string.IsNullOrEmpty(area_cd) ? this.CurrentSelectItem.area_cd : area_cd;

        //    if (string.IsNullOrEmpty(region_cd)) {
        //        region_cd = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["DefaultRegion"]);
        //    }
        //    if (string.IsNullOrEmpty(area_cd)) {
        //        area_cd = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["DefaultArea"]);
        //    }
        //    if (wed_date == null || wed_date.Value < SqlDateTime.MinValue.Value) {
        //        var default_date = RegionConfig.GetRegionToday(region_cd).AddMonths(2);
        //        wed_date = (this.CurrentSelectItem.wed_date == DateTime.MinValue) ? default_date : this.CurrentSelectItem.wed_date;
        //    }

        //    //URLを編集
        //    var current_url = TypeHelper.GetStr(ConfigurationManager.AppSettings["BaseURL"]);
        //    if (type_list_display) {
        //        current_url += "/Types";
        //    } else if (item_list_display) {
        //        if (String.IsNullOrEmpty(this.CurrentSelectItem.trf_type)) {
        //            current_url += "/Types";
        //        //} else {
        //        //    current_url += "/Items";
        //        }
        //    } else if (String.IsNullOrEmpty(this.CurrentSelectItem.trf_type)) {
        //        current_url += "/Types";
        //    } else if (!String.IsNullOrEmpty(this.CurrentSelectItem.trf_item_cd)) {
        //        current_url += "/Detail";
        //    //} else {
        //    //    current_url += "/Items";
        //    }
        //    current_url += "/" + region_cd;
        //    current_url += "/" + area_cd;
        //    var str_wed_date = wed_date.Value.ToString("yyyyMMdd");
        //    current_url += "/" + str_wed_date;

        //    if (!type_list_display && !String.IsNullOrEmpty(this.CurrentSelectItem.trf_type)) {
        //        current_url += "/" + this.CurrentSelectItem.trf_kind;
        //        current_url += "/" + this.CurrentSelectItem.trf_type;
        //        if (!item_list_display && !String.IsNullOrEmpty(this.CurrentSelectItem.trf_item_cd)) {
        //            current_url += "/" + this.CurrentSelectItem.trf_cat;
        //            current_url += "/" + this.CurrentSelectItem.trf_item_cd;
        //        }
        //    }
        //    return RedirectToLocal(current_url);
        //}

        //[Route("Detail/{region_cd}/{area_cd}/{trf_kind}/{trf_type}/{trf_cat}/{trf_item_cd}")]
        //public ActionResult DefaultDetail(string region_cd, string area_cd, string trf_kind, string trf_type, string trf_cat, string trf_item_cd, string lang = null) {
        //    DateTime default_date = RegionConfig.GetRegionToday(region_cd).AddMonths(2);
        //    if (!string.IsNullOrEmpty(lang)) {
        //        this.CurrentRegionInfo.CurrentLanguage = lang;
        //    }
        //    return Detail(region_cd, area_cd, default_date.ToString("yyyyMMdd"), trf_kind, trf_type, trf_cat, trf_item_cd);
        //}

        //[Route("Detail/{region_cd}/{area_cd}/{str_wed_date}/{trf_kind}/{trf_type}/{trf_cat}/{trf_item_cd}/{page_number:int?}")]
        //public ActionResult Detail(string region_cd, string area_cd, string str_wed_date, string trf_kind, string trf_type, string trf_cat, string trf_item_cd, short? page_number = 1) {
        //    if (this.CurrentSelectItem.session_prior) {
        //        //Login直後でPKGアイアムを購入済の場合は、wed_dateをPKGのwed_dateにする
        //        this.CurrentSelectItem.session_prior = false;
        //        SetInformation(this.CurrentRegionInfo.CurrentDestination, this.CurrentSelectItem.area_cd, this.CurrentSelectItem.str_wed_date, trf_kind, trf_type, trf_cat, trf_item_cd);
        //        return SelectWeddingDate(this.CurrentSelectItem.wed_date, this.CurrentRegionInfo.CurrentDestination, this.CurrentSelectItem.area_cd, false, false);
        //    }
        //    SetInformation(region_cd, area_cd, str_wed_date, trf_kind, trf_type, trf_cat, trf_item_cd);

        //    //表示通貨判断
        //    var is_japan = this.IsJpnClientOrJpnAccount();

        //    var lang = this.CurrentRegionInfo.CurrentLanguage;

        //    //Item詳細取得
        //    var model = new WtbApi.Proxy.Destination.TrfItemRepository(region_cd)
        //                    .FindItem(
        //                        area_cd,
        //                        this.CurrentSelectItem.period_id,
        //                        trf_kind,
        //                        trf_type,
        //                        trf_cat,
        //                        trf_item_cd,
        //                        lang,
        //                        is_japan,
        //                        CurrentSelectItem.wed_date);

        //    ViewBag.PageNum = page_number;
        //    ViewBag.FbUrl = "Detail/" + region_cd + "/" + area_cd + "/" + trf_kind + "/" + trf_type + "/" + trf_cat + "/" + trf_item_cd + "?lang=" + CurrentRegionInfo.CurrentLanguage;
        //    return View("Detail", model);
        //}

        private void SetInformation(string region_cd, string area_cd, string str_wed_date, string item_type, string item_cd = null)
        {
            region_cd    = TypeHelper.GetStr(region_cd).ToUpper();
            area_cd      = TypeHelper.GetStr(area_cd).ToUpper();
            str_wed_date = TypeHelper.GetStr(str_wed_date).ToUpper();
            item_type    = TypeHelper.GetStr(item_type).ToUpper();
            item_cd      = TypeHelper.GetStr(item_cd).ToUpper();

            //CurrentRegionInfo
            //this.CurrentRegionInfo.CurrentLocation = region_cd;
            this.CurrentRegionInfo.CurrentDestination = region_cd;
            SetCurrentRegionInfo();

            DateTime wed_date;

            if (!DateTime.TryParseExact(str_wed_date, "yyyyMMdd", null,
                                        DateTimeStyles.None, out wed_date))
            {
                wed_date = RegionConfig.GetRegionToday(region_cd).AddMonths(2);
            }

            //現在日(現地時間)から3日後より前の日付は指定不可とする。
            var min_date = RegionConfig.GetRegionToday(region_cd).AddDays(3);

            if (wed_date < min_date)
            {
                wed_date = min_date;
            }

            //CurrentSelectItem
            this.CurrentSelectItem.area_cd       = area_cd;
            this.CurrentSelectItem.wed_date      = wed_date;
            this.CurrentSelectItem.min_date      = min_date;
            this.CurrentSelectItem.item_type     = item_type;
            this.CurrentSelectItem.item_cd       = item_cd;
            Session[Constants.SSKEY_SELECT_ITEM] = this.CurrentSelectItem;
        }
Ejemplo n.º 3
0
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!filterContext.IsChildAction)
            {
                //メンテナンス中の場合、メンテナンス中画面に遷移
                var maintenance_file_name = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["MaintenanceFileName"]);
                if (System.IO.File.Exists(GetMaintenanceFilePath() + maintenance_file_name))
                {
                    var url = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["BaseURL"]);
                    if (!url.EndsWith("/"))
                    {
                        url += "/";
                    }
                    url += maintenance_file_name;
                    filterContext.Result = RedirectToLocal(url);
                    return;
                }
            }

            if (User != null && User.Identity != null && User.Identity.IsAuthenticated)
            {
                //LoginUserをセッションからインスタンス変数にセット。
                _loginUser = Session[Constants.SSKEY_LOGIN_USER] as CAccount;
                if (_loginUser == null)
                {
                    //セッションから取得出来ない場合はDBから読み込んでセッションにセット。
                    var userEmail = User.Identity.GetUserId();
                    var repo      = new CAccountRepository();
                    _loginUser = repo.FindById(userEmail);
                    if (_loginUser == null)
                    {
                        AuthenticationManager.SignOut();
                    }
                    Session[Constants.SSKEY_LOGIN_USER] = _loginUser;
                }
            }

            //RegionInfoをセッションからインスタンス変数にセット。(無ければ生成してセット。)
            if (Session[Constants.SSKEY_CURRENT_REGION] != null && Session[Constants.SSKEY_CURRENT_REGION] is RegionInfo)
            {
                _currentRegion = Session[Constants.SSKEY_CURRENT_REGION] as RegionInfo;
            }
            if (_currentRegion == null)
            {
                _currentRegion = new RegionInfo();
                _currentRegion.CurrentDestination = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["DefaultRegion"]);
            }
            Session[Constants.SSKEY_CURRENT_REGION] = _currentRegion;
            SetCurrentRegionInfo();

            //表示言語がセッションから取得出来ない場合はCookieから取得する。
            if (String.IsNullOrEmpty(_currentRegion.CurrentLanguage))
            {
                var cookie = Request.Cookies.Get(Constants.COOKIE_LANG);
                //Cookieがセットされており、かつ値が'J'または'E'のいずれかであればそれを保持する。J,E以外の不正な値は無視する。
                if (cookie != null && !string.IsNullOrEmpty(cookie.Value) &&
                    "JE".Contains(cookie.Value) && cookie.Value.Length == 1)
                {
                    _currentRegion.CurrentLanguage = cookie.Value;
                }
            }

            //表示言語がSessionにもCookieにも設定されていない場合はブラウザの言語設定(Accept-Languageヘッダ)を反映する。
            //  1. 言語指定が一つも無い場合は日本語。(検索エンジンのロボットなど)
            //  2. 'ja*'があれば日本語。
            //  3. 上記以外の場合は英語。
            if (String.IsNullOrEmpty(_currentRegion.CurrentLanguage))
            {
                var is_japan = (Request.UserLanguages == null) ||
                               Request.UserLanguages.Any(i => i.StartsWith("ja"));
                _currentRegion.CurrentLanguage = is_japan ? Constants.LANGUAGEKEY_JAPANESE : Constants.LANGUAGEKEY_ENGLISH;
            }

            //selectItemをセッションからインスタンス変数にセット。
            if (Session[Constants.SSKEY_SELECT_ITEM] != null && Session[Constants.SSKEY_SELECT_ITEM] is CurrentItemInfo)
            {
                _selectItem = Session[Constants.SSKEY_SELECT_ITEM] as CurrentItemInfo;
            }
            if (_selectItem == null)
            {
                _selectItem = new CurrentItemInfo();
                //                _selectItem.area_cd = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["DefaultArea"]);
                //                this.CurrentSelectItem.wed_date = RegionConfig.GetRegionToday(_currentRegion.CurrentDestination).AddMonths(2);
                this.CurrentSelectItem.wed_date = RegionConfig.GetRegionToday(_currentRegion.CurrentDestination).AddMonths(2);
            }
            Session[Constants.SSKEY_SELECT_ITEM] = _selectItem;

            ////LoginUser, RegionInfoをViewBagに格納。(Viewから使いやすい様に。)
            //ViewBag.CurrentLoginUser = _loginUser;
            //ViewBag.CurrentRegionInfo = _currentRegion;
            //ViewBag.CurrentSelectItem = _selectItem;
            //ViewBag.ClientIP = this.GetClientIPAddress();

            base.OnActionExecuting(filterContext);
        }