Beispiel #1
0
        // 使用者認證 Authentication
        public static UserAccount GetAccount(string email, string password)
        {
            // 檢查登入者身分
            string      jsonResult = AccountProxy.GetUserAccount(email, password);
            UserAccount account    = null;
            var         jobjAcct   = JObject.Parse(jsonResult);

            try
            {
                // 若無效身分則送出登入異常
                switch (jobjAcct["ACCOUNT_TYPE"].ToString())
                {
                case "KKdayAccount":
                    account = jobjAcct["ACCOUNT"].ToObject <KKdayAccount>();
                    break;

                case "B2dAccount":
                    account = jobjAcct["ACCOUNT"].ToObject <B2dAccount>();
                    break;

                default: throw new Exception("Invalid User Login");
                }
            }
            catch
            {
                throw new Exception("Invalid User Login");
            };

            return(account);
        }