Beispiel #1
0
        public ActionResult CreateRebrandingMarketingAgreeEntry(RebrandingMarketingModels model)
        {
            try {
                if (service.IsRebrandingMarketingEntryLimit(2590))
                {
                    throw new RebrandingEventServiceException("400", "선착순이 마감되었습니다.", null);
                }
                long?userId = Session["RebrandingMarketingAgreeEntryId"] as long?;
                if (!userId.HasValue)
                {
                    throw new RebrandingEventServiceException("400", "휴대폰 인증을 다시 받아주세요.", null);
                }
                var rebrandingMarketingModel = model.RebrandingMarketingModel;

                if (!ModelState.IsValid)
                {
                    var errorProp = ModelState.Values.Where(x => x.Errors.Count > 0).FirstOrDefault();
                    if (errorProp != null)
                    {
                        throw new RebrandingEventServiceException("400", errorProp.Errors[0].ErrorMessage, null);
                    }
                }
                var user = service.GetRebrandingMarketingAgreeEntryById(userId.Value);
                // 기존 저장 개인정보와 다른값 체크
                if (user.Name != rebrandingMarketingModel.Name || user.Mobile != rebrandingMarketingModel.Mobile || user.Gender != rebrandingMarketingModel.Gender || user.BirthDay != rebrandingMarketingModel.BirthDay)
                {
                    throw new RebrandingEventServiceException("400", "휴대폰 인증을 받아 다시 시도해주세요.", null);
                }
                var entry   = mapperConfig.CreateMapper().Map <RebrandingMarketingModel, RebrandingMarketingAgreeEntry>(rebrandingMarketingModel, user);
                var message = string.Format("[오렌지라이프] 마케팅동의 처리안내\r\n\r\n안녕하세요, 고객님\r\n{0}년 {1}월 {2}일에 오렌지라이프에 신청하신\r\n'상품의 소개 등을 위한 개인(신용)정보 처리 동의'\r\n(마케팅동의)가 정상반영되어 안내드립니다.\r\n오렌지라이프 대표번호 : 1588-5005", common.Now.Year, common.Now.Month, common.Now.Day);
                entry.IsMessage  = smsService.SendMMS("", entry.Mobile, "0222009867", message, "L");
                entry.UpdateDate = common.Now;

                service.UpdateRebrandingMarketingAgreeEntry(entry);

                Session.Remove("RebrandingMarketingAgreeEntryId");

                return(Json(new {
                    Result = true
                }));
            } catch (RebrandingEventServiceException e) {
                return(Json(new {
                    Result = false,
                    Message = e.Message
                }));
            } catch (Exception e) {
                logger.Error(e);
                return(Json(new {
                    Result = false,
                    Message = "서비스 점검중입니다. 잠시 후 시도해보시거나, 담당자에게 문의하시기 바랍니다."
                }));
            }
        }
Beispiel #2
0
        public ActionResult Index()
        {
            var isMarketingEntryLimit = service.IsRebrandingMarketingEntryLimit(2590);
            var now     = common.Now;
            var isClose = now >= new DateTime(2018, 10, 22);
            var isOpen  = now >= new DateTime(2018, 10, 15);

            var date = common.Now.ToString("yyyyMMddHHmmss");

            var kmcState       = ConfigurationManager.AppSettings["kmc.state"] as string;
            var urlCode        = "004004";
            var trMarketingUrl = "http://dev.www.orange-event.kr/ma/callback";

            var kmcMarketingModel = new RequestKMCModel {
            };

            // 실서버 적용시 urlCode,trUrl 실서버용으로 변경
            if (kmcState == "release")
            {
                urlCode        = "002005";
                trMarketingUrl = "https://www.orange-event.kr/ma/callback";
            }
            else if (kmcState == "debug")
            {
                urlCode        = "003010";
                trMarketingUrl = "http://test.www.orange-event.kr/ma/callback";
            }

            ViewBag.IsClose = true;

            if (!isClose && !isMarketingEntryLimit && isOpen)
            {
                ViewBag.IsClose   = false;
                kmcMarketingModel = kmcService.RequestKMC(date, urlCode, trMarketingUrl);
            }

            var model = new RebrandingMarketingModels {
                RebrandingMarketingModel = new RebrandingMarketingModel {
                },
                RequestMarketingKMCModel = kmcMarketingModel
            };

            return(View(model));
        }