コード例 #1
0
        private void Yes_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Dictionary <string, string> dict = new Dictionary <string, string>();

                using (RequestPublicKeyModel req2 = new RequestPublicKeyModel())
                {
                    using (ResponsePublicKeyModel res2 = WebApiLib.SyncCall <ResponsePublicKeyModel, RequestPublicKeyModel>(req2))
                    {
                        dict = EncodingLib.AesEncryptKey(res2.data.pubKeyModule, res2.data.pubKeyExponent);
                    }
                }

                using (RequestPinNumbrInitModel req = new RequestPinNumbrInitModel())
                {
                    req.userEmail = MainViewModel.LoginDataModel.userEmail;
                    req.userPwd   = EncodingLib.AesEncrypt(userPwd.Text, dict["gid"]);
                    req.clientPe  = dict["acekey"];

                    using (ResponsePinNumbrInitModel res = WebApiLib.SyncCall <ResponsePinNumbrInitModel, RequestPinNumbrInitModel>(req))
                    {
                        if (res.resultStrCode == "000")
                        {
                            if (res.data.failCd.Equals(""))
                            {
                                alert = new Alert(Localization.Resource.MemberInfo_Pop_19 + "\n" + Localization.Resource.MemberInfo_Pop_17, 330);
                                alert.ShowDialog();

                                this.DialogResult = true;
                                this.Close();
                            }
                            else if (res.data.failCd.Equals("998"))
                            {
                                alert = new Alert(Localization.Resource.MemberInfo_Pop_18);
                                alert.ShowDialog();
                            }
                            else if (res.data.failCd.Equals("997"))
                            {
                                alert = new Alert(Localization.Resource.MemberInfo_Pop_20);
                                alert.ShowDialog();
                            }
                            else if (res.data.failCd.Equals("996"))
                            {
                                alert = new Alert(Localization.Resource.MemberInfo_Pop_16 + "\n" + Localization.Resource.MemberInfo_Pop_17, 330);
                                alert.ShowDialog();
                            }
                            else if (res.data.failCd.Equals("993"))
                            {
                                //비밀번호 미일치.
                                alert = new Alert(Localization.Resource.MemberInfo_Pop_35 + "\n" + Localization.Resource.MemberInfo_Pop_36, 330);
                                alert.ShowDialog();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
        }
コード例 #2
0
ファイル: LoginViewModel.cs プロジェクト: choidh08/CSharp
        //로그인 Command
        public async void Login()
        {
            try
            {
                if (IsMaintenance)
                {
                    return;
                }

                if (TempUserName != UserName)
                {
                    TempUserName     = UserName;
                    LoginSubmitCount = 0;
                    LoginSubmitCheck = true;
                }

                if (LoginSubmitCount == 5 && LoginSubmitCheck)
                {
                    using (RequestLoginFailModel req = new RequestLoginFailModel())
                    {
                        req.userEmail = UserName;

                        using (ResponseLoginFailModel res = await WebApiLib.AsyncCall <ResponseLoginFailModel, RequestLoginFailModel>(req))
                        {
                            LoginSubmitCount = 0;
                            LoginSubmitCheck = false;
                            Alert alert = new Alert(Localization.Resource.Login_4, 400);
                            alert.ShowDialog();
                            return;
                        }
                    }
                }

                if (string.IsNullOrWhiteSpace(UserName))
                {
                    Alert alert = new Alert(Localization.Resource.Login_5);
                    alert.ShowDialog();
                    return;
                }
                if (string.IsNullOrWhiteSpace(Password))
                {
                    Alert alert = new Alert(Localization.Resource.Login_6);
                    alert.ShowDialog();
                    return;
                }

                #region ID 저장 Check

                if (IsCheck)
                {
                    ini.SetCheckID(UserName.Trim(), "Login", "ID");
                }
                else
                {
                    ini.SetCheckID(string.Empty, "Login", "ID");
                }

                ini.SetCheckID(SelectedLang.Lv, "Language", "Country");

                #endregion

                IsBusy = true;

                Dictionary <string, string> dict = null;

                using (RequestPublicKeyModel req = new RequestPublicKeyModel())
                {
                    using (ResponsePublicKeyModel res = WebApiLib.SyncCall <ResponsePublicKeyModel, RequestPublicKeyModel>(req))
                    {
                        //dict = EncodingLib.AesEncrypt(Password.Trim(), res.data.pubKeyModule, res.data.pubKeyExponent);
                        dict = EncodingLib.AesEncryptKey(res.data.pubKeyModule, res.data.pubKeyExponent);
                    }
                }

                if (dict.Count == 2)
                {
                    using (RequestLoginModel req = new RequestLoginModel())
                    {
                        req.userEmail = UserName.Trim();
                        req.userPwd   = EncodingLib.AesEncrypt(Password.Trim(), dict["gid"]);
                        req.clientPe  = dict["acekey"];
                        req.langCd    = SelectedLang.Lv.ToString().Split('-')[0];
                        req.regIp     = CommonLib.Client_IP;

                        using (ResponseLoginModel res = await WebApiLib.AsyncCall <ResponseLoginModel, RequestLoginModel>(req))
                        {
                            if (res.data.loginYn.Equals("Y"))
                            {
                                if (res.data.isIpFirst.Equals("Y"))
                                {
                                    Views.NoticePopup note = new Views.NoticePopup(NoticePopup.KindNotice.HTS_IP_CHECK_1);
                                    note.Title = Localization.Resource.NoticePopup_3;
                                    if (note.ShowDialog() == true)
                                    {
                                        note       = new Views.NoticePopup(NoticePopup.KindNotice.HTS_IP_CHECK_2);
                                        note.Title = Localization.Resource.NoticePopup_3;
                                        note.ShowDialog();

                                        IsLoginView = Visibility.Collapsed;
                                        Messenger.Default.Send(res.data);
                                    }
                                    else
                                    {
                                        //IP삭제
                                        using (RequestIpRegModel req2 = new RequestIpRegModel())
                                        {
                                            req2.userEmail = UserName.Trim();
                                            req2.ip        = res.data.regIp;
                                            req2.limtHr    = 0;
                                            using (ResponseIpRegModel res2 = await WebApiLib.AsyncCall <ResponseIpRegModel, RequestIpRegModel>(req2))
                                            {
                                                //IP삭제 완료
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    IsLoginView = Visibility.Collapsed;
                                    Messenger.Default.Send(res.data);
                                }
                            }
                            else
                            {
                                IsBusy = false;
                                if (res.resultMsg != null)
                                {
                                    if (res.data.lockYn == "Y")
                                    {
                                        Alert alert = new Alert("[" + Localization.Resource.Login_20 + "]" + "\n" + Localization.Resource.Login_18 + "\n" + Localization.Resource.Login_19, 460, 180);
                                        if (alert.ShowDialog() == true)
                                        {
                                            using (RequestPwdChangeModel req2 = new RequestPwdChangeModel())
                                            {
                                                req2.userEmail = UserName.Trim();

                                                using (ResponsePwdChagneModel res2 = WebApiLib.SyncCall <ResponsePwdChagneModel, RequestPwdChangeModel>(req2))
                                                {
                                                    if (res2.resultStrCode == "000")
                                                    {
                                                        alert = new Alert(Localization.Resource.Login_23, 330);
                                                        alert.ShowDialog();
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.notExistPassword)))
                                        {
                                            LoginSubmitCount++;
                                            if (LoginSubmitCount == 5)
                                            {
                                                LoginSubmitCheck = true;
                                            }
                                            Alert alert = new Alert(string.Format(Localization.Resource.Login_24, LoginSubmitCount) + "\n" + Localization.Resource.Login_25, 300);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.blockID)))
                                        {
                                            LoginSubmitCount = 0;
                                            LoginSubmitCheck = false;

                                            Alert alert = new Alert(Localization.Resource.Login_4, 400);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.userEmailFail)))
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_11, 300);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.userPasswordFail)))
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_12, 300);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.notExistEmail)))
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_13, 300);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.NotRegIP)))
                                        {
                                            NoticePopup note = new NoticePopup(NoticePopup.KindNotice.HTS_IP_NOT_CHECK_1);
                                            note.Title = Localization.Resource.NoticePopup_4;
                                            NoticePopupViewModel.UserName = UserName.Trim();
                                            if (note.ShowDialog() == true)
                                            {
                                                IpRegisterViewModel.regIp     = res.data.regIp;
                                                IpRegisterViewModel.userEmail = UserName.Trim();
                                                IpRegister ip = new IpRegister();
                                                ip.ShowDialog();
                                            }
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.NotUseID)))
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_16, 300);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.loginFailCode)))
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_17, 350);
                                            alert.ShowDialog();
                                        }
                                        else if (res.data.failCd.Equals(StringEnum.GetStringValue(EnumLib.LoginFailCode.ReSettingPW)))
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_21, 300, 140, Localization.Resource.Login_22);
                                            if (alert.ShowDialog() == true)
                                            {
                                                using (RequestPwdChangeModel req2 = new RequestPwdChangeModel())
                                                {
                                                    req2.userEmail = UserName.Trim();

                                                    using (ResponsePwdChagneModel res2 = WebApiLib.SyncCall <ResponsePwdChagneModel, RequestPwdChangeModel>(req2))
                                                    {
                                                        if (res2.resultStrCode == "000")
                                                        {
                                                            alert = new Alert(Localization.Resource.Login_23, 330);
                                                            alert.ShowDialog();
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            Alert alert = new Alert(Localization.Resource.Login_17, 350);
                                            alert.ShowDialog();
                                        }
                                    }
                                }
                                else
                                {
                                    Alert alert = new Alert(Localization.Resource.Login_7, 320);
                                    alert.ShowDialog();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Alert alert = new Alert(Localization.Resource.Login_8, Alert.ButtonType.Ok);
                    alert.ShowDialog();
                }

                IsBusy = false;
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
                IsBusy = false;

                Alert alert = new Alert(Localization.Resource.Login_9, Alert.ButtonType.Ok);
                alert.ShowDialog();
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #3
0
        public async void OnSelCardChanged()
        {
            try
            {
                if (SelCard != null)
                {
                    if (SelCard.Value.Equals("00"))
                    {
                        cardRemPrc = 0;
                        return;
                    }

                    Dictionary <string, string> dict = null;

                    IsBusy = true;

                    using (RequestPublicKeyModel req = new RequestPublicKeyModel())
                    {
                        using (ResponsePublicKeyModel res = WebApiLib.SyncCall <ResponsePublicKeyModel, RequestPublicKeyModel>(req))
                        {
                            //dict = EncodingLib.AesEncrypt(SelCard.Value, res.data.pubKeyModule, res.data.pubKeyExponent);
                            dict = EncodingLib.AesEncryptKey(res.data.pubKeyModule, res.data.pubKeyExponent);
                        }
                    }

                    using (RequestCardRemPrcModel req = new RequestCardRemPrcModel())
                    {
                        req.userEmail = MainViewModel.LoginDataModel.userEmail;
                        req.cardNum   = EncodingLib.AesEncrypt(SelCard.Value, dict["gid"]);
                        req.clientPe  = dict["acekey"];

                        using (ResponseCardRemPrcModel res = await WebApiLib.AsyncCall <ResponseCardRemPrcModel, RequestCardRemPrcModel>(req))
                        {
                            if (res.resultStrCode == "000")
                            {
                                string resultCd = res.data.failCd;
                                if (resultCd.Equals("999"))
                                {
                                    SelCard = cardList[0];
                                    alert   = new Alert(Localization.Resource.RechargeDepositWithdraw_Card_Pop_4);
                                    alert.ShowDialog();
                                    return;
                                }
                                else if (resultCd.Equals("998"))
                                {
                                    SelCard = cardList[0];
                                    alert   = new Alert(Localization.Resource.RechargeDepositWithdraw_Card_Pop_11);
                                    alert.ShowDialog();
                                    return;
                                }
                                else if (resultCd.Equals("997"))
                                {
                                    SelCard = cardList[0];
                                    alert   = new Alert(Localization.Resource.RechargeDepositWithdraw_Card_Pop_12);
                                    alert.ShowDialog();
                                    return;
                                }

                                cardRemPrc = res.data.remPrc;
                                //if (string.IsNullOrWhiteSpace(res.data.bankNo))
                                //{
                                //    bankNo = "-";
                                //}
                                //else
                                //{
                                //    string bankNm = string.Empty;
                                //    if (LoginViewModel.LanguagePack.IndexOf("ko") > 0)
                                //    {
                                //        bankNm = "(신한은행)";
                                //    }
                                //    else
                                //    {
                                //        bankNm = "(ShinHan Bank)";
                                //    }

                                //    bankNo = res.data.bankNo + bankNm;
                                //}
                            }

                            IsBusy = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #4
0
        //선불카드 충전
        public async void CmdCardCharging()
        {
            try
            {
                //alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Card_Pop_15);
                //alert.ShowDialog();
                //return;

                IsBusy = true;

                if (SelCard.Value.Equals("00"))
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_10, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (cardMonth.Length != 2)
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_3, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (cardYear.Length != 2)
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_4, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (cardCvc.Length != 3)
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_5, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (cardPw.Length != 4)
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_6, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (cardRemPrc < RechargePrc)
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_7, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (RechargePrc < 5000)
                {
                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_22, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (RechargePrc > 2000000)
                {
                    alert = new Alert(string.Format(Localization.Resource.RechargeDepositWithdraw_Common_29, decimal.Parse("2000000").ToString("#,#"), SC), 330);
                    alert.ShowDialog();
                    return;
                }

                //GetExRate();
                OnRechargePrcChanged();

                alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_8, Alert.ButtonType.YesNo, 330);
                if (alert.ShowDialog() == true)
                {
                    Dictionary <string, string> dict = new Dictionary <string, string>();

                    using (RequestPublicKeyModel req2 = new RequestPublicKeyModel())
                    {
                        using (ResponsePublicKeyModel res2 = WebApiLib.SyncCall <ResponsePublicKeyModel, RequestPublicKeyModel>(req2))
                        {
                            dict = EncodingLib.AesEncryptKey(res2.data.pubKeyModule, res2.data.pubKeyExponent);
                        }
                    }

                    using (RequestDepositCardModel req = new RequestDepositCardModel())
                    {
                        req.userEmail = MainViewModel.LoginDataModel.userEmail;
                        req.crgPrc    = RechargePrc;
                        req.cardNum   = EncodingLib.AesEncrypt(SelCard.Value, dict["gid"]);
                        req.cardDate  = EncodingLib.AesEncrypt(("20" + cardYear + cardMonth), dict["gid"]);
                        req.cardCvc   = EncodingLib.AesEncrypt(cardCvc, dict["gid"]);
                        req.cardPwd   = EncodingLib.AesEncrypt(cardPw, dict["gid"]);
                        req.clientPe  = dict["acekey"];

                        using (ResponseDepositCardModel res = await WebApiLib.AsyncCall <ResponseDepositCardModel, RequestDepositCardModel>(req))
                        {
                            if (res.resultStrCode == "000")
                            {
                                string resultCd = res.data.failCd;
                                if (resultCd.Equals("999"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_12, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("998"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_13, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("997"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_14, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("996"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_15, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("995"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_16, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("994"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_17, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("993"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_18, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("992"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_12, 330);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("991"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_20, 330);
                                    alert.ShowDialog();
                                }
                                else
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_9, 330);
                                    alert.ShowDialog();

                                    SelCard     = cardList[0];
                                    cardMonth   = string.Empty;
                                    cardYear    = string.Empty;
                                    cardCvc     = string.Empty;
                                    cardPw      = string.Empty;
                                    cardRemPrc  = 0;
                                    RechargePrc = 0;
                                    fee         = 0;
                                    ResultPrc   = 0;

                                    GetCardList();
                                    GetKrwRecharge(EnumLib.PaymentWay.prepaidCard);
                                    //GetExRate();
                                }

                                IsBusy = false;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
            finally
            {
                IsBusy = false;
            }
        }
コード例 #5
0
        public async void CmdRegistCard()
        {
            try
            {
                int intValue = 0;

                if (string.IsNullOrEmpty(CardNumStatic))
                {
                    alert = new Alert(Localization.Resource.AtmPwdSetting_14, 330);
                    alert.ShowDialog();
                    return;
                }
                else if (string.IsNullOrWhiteSpace(InsertPwd) || string.IsNullOrWhiteSpace(CheckPwd))
                {
                    alert = new Alert(Localization.Resource.AtmPwdSetting_13);
                    alert.ShowDialog();
                    return;
                }
                else if (InsertPwd.Length < 4 || CheckPwd.Length < 4)
                {
                    alert = new Alert(Localization.Resource.AtmPwdSetting_12);
                    alert.ShowDialog();
                    return;
                }
                else if (InsertPwd != CheckPwd)
                {
                    alert = new Alert(Localization.Resource.Login_14);
                    alert.ShowDialog();
                    return;
                }
                else if (!int.TryParse(InsertPwd, out intValue) || !int.TryParse(CheckPwd, out intValue))
                {
                    alert = new Alert(Localization.Resource.AtmPwdSetting_12);
                    alert.ShowDialog();
                    return;
                }

                alert = new Alert(Localization.Resource.AtmPwdSetting_15, Alert.ButtonType.YesNo, 330);
                if (alert.ShowDialog() == true)
                {
                    Dictionary <string, string> dict = new Dictionary <string, string>();

                    using (RequestPublicKeyModel req = new RequestPublicKeyModel())
                    {
                        using (ResponsePublicKeyModel res = WebApiLib.SyncCall <ResponsePublicKeyModel, RequestPublicKeyModel>(req))
                        {
                            dict = EncodingLib.AesEncryptKey(res.data.pubKeyModule, res.data.pubKeyExponent);
                        }
                    }

                    using (RequestCardPwdSetModel req2 = new RequestCardPwdSetModel())
                    {
                        req2.cardNum  = EncodingLib.AesEncrypt(CardNumStatic, dict["gid"]);
                        req2.atmPwd   = EncodingLib.AesEncrypt(InsertPwd, dict["gid"]);
                        req2.clientPe = dict["acekey"];

                        using (ResponseCardPwdSetModel res2 = await WebApiLib.AsyncCall <ResponseCardPwdSetModel, RequestCardPwdSetModel>(req2))
                        {
                            if (res2.resultStrCode == "000")
                            {
                                string resultCd = res2.data.failCd;

                                if (resultCd.Equals(""))
                                {
                                    alert = new Alert(Localization.Resource.AtmPwdSetting_16);
                                    alert.ShowDialog();
                                    WindowService.Close();
                                }
                                else if (resultCd.Equals("999"))
                                {
                                    alert = new Alert(Localization.Resource.RechargeDepositWithdraw_Common_15);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("998"))
                                {
                                    alert = new Alert(Localization.Resource.AtmPwdSetting_19);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("997"))
                                {
                                    alert = new Alert(Localization.Resource.AtmPwdSetting_18);
                                    alert.ShowDialog();
                                }
                                else if (resultCd.Equals("996"))
                                {
                                    alert = new Alert(Localization.Resource.AtmPwdSetting_17);
                                    alert.ShowDialog();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SysLog.Error("Message[{0}], StackTrace[{1}]", ex.Message, ex.StackTrace);
            }
        }