Example #1
0
        public MemberData JoinMember(string account, string nickname, string IP, string email, string joinTime, byte memberType)
        {
            MemberData memberData = new MemberData();

            memberData.ReturnCode    = "(Logic)S100";
            memberData.ReturnMessage = "";
            string SNSType = "";

            try
            {
                switch (memberType)
                {
                case 2:     //Google
                    SNSType = "Google";
                    break;

                case 3:     //Facebook
                    SNSType = "Facebook";
                    break;

                case 4:     // Twitter
                    SNSType = "Twitter";
                    break;
                }

                // 驗證成功後再進行IO寫入 寫入後存入 memberData
                MemberIO memberIO = new MemberIO();
                // memberData = memberIO.JoinMember(account,"25d55ad283aa400af464c76d713c07ad", nickname,IP,joinTime, SNSType); //MD5
                memberData = memberIO.JoinMember(account, "12345678", nickname, IP, email, joinTime, SNSType);
            }
            catch (Exception e)
            {
                throw e;
            }

            return(memberData); //回傳資料
        }
Example #2
0
        public MemberData MemberLogin(string account, string password)
        {
            MemberData memberData = new MemberData();

            memberData.ReturnCode    = "S200";
            memberData.ReturnMessage = "";
            try
            {
                TextUtility textUtility = new TextUtility();

                // 檢查會員帳號
                if (textUtility.SaveTextChk(account) != 1)
                {
                    memberData.ReturnCode    = "S202";
                    memberData.ReturnMessage = "會員帳號內含不合法字元!!";
                    return(memberData);
                }

                // 檢查密碼
                if (textUtility.SaveTextChk(password, new char[] { '#', '$', '%', '^', '&', '*', '(', ')' }) != 1)
                {
                    memberData.ReturnCode    = "S203";
                    memberData.ReturnMessage = "會員密碼內含不合法字元!!";
                    return(memberData);
                }

                //如果檢查成功 進行會員資料比對
                MemberIO memberIO = new MemberIO();
                memberData = memberIO.MemberLogin(account, password);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(memberData);
        }
Example #3
0
        public MemberData JoinMember(string account, string password, string nickname, byte age, byte sex, string IP, string email, string joinTime)
        {
            MemberData memberData = new MemberData();

            memberData.ReturnCode    = "(Logic)S100";
            memberData.ReturnMessage = "";

            try
            {
                TextUtility textUtility = new TextUtility();

                // 檢查會員帳號
                if (textUtility.SaveTextChk(account) != 1)
                {
                    memberData.ReturnCode    = "S102";
                    memberData.ReturnMessage = "會員帳號內含不合法字元!!";
                    return(memberData);
                }
                else if (account.Length < 8 || account.Length > 16)
                {
                    memberData.ReturnCode    = "S102";
                    memberData.ReturnMessage = "會員帳號長度不正確(8~16字元)!!";
                    return(memberData);
                }

                // 檢查密碼
                if (textUtility.SaveTextChk(password, new char[] { '#', '$', '%', '^', '&', '*', '(', ')' }) != 1)
                {
                    memberData.ReturnCode    = "S103";
                    memberData.ReturnMessage = "會員密碼內含不合法字元!!";
                    return(memberData);
                }
                else if (password.Length < 8 || password.Length > 16)
                {
                    memberData.ReturnCode    = "S103";
                    memberData.ReturnMessage = "會員密碼長度不正確(8~16字元)!!";
                    return(memberData);
                }

                // 檢查暱稱
                if (textUtility.SaveTextChk(nickname, new char[] { '#', '$', '%', '^', '&', '*', '(', ')' }) != 1)
                {
                    memberData.ReturnCode    = "S104";
                    memberData.ReturnMessage = "會員暱稱內含不合法字元!!";
                    return(memberData);
                }
                else if (nickname == "" || nickname.Length <= 0 || nickname.Length > 12)
                {
                    memberData.ReturnCode    = "S104";
                    memberData.ReturnMessage = "會員暱稱長度不正確(1~12字元)!!";
                    return(memberData);
                }

                // 檢查年齡
                if ((textUtility.NumTextChk(age.ToString()) != 1) || age <= 0 || age >= 100)
                {
                    memberData.ReturnCode    = "S105";
                    memberData.ReturnMessage = "請選擇正確年齡!!";
                    return(memberData);
                }

                // 檢查性別
                if (sex < 0 || sex > 1)
                {
                    memberData.ReturnCode    = "S106";
                    memberData.ReturnMessage = "請選擇正確性別!!";
                    return(memberData);
                }

                // 檢查Email
                if (textUtility.EMailChk(email) != 1)
                {
                    memberData.ReturnCode    = "S107";
                    memberData.ReturnMessage = "請輸入正確Email !!";
                    return(memberData);
                }
                else if (email.Length <= 5 || email.Length > 48)
                {
                    memberData.ReturnCode    = "S107";
                    memberData.ReturnMessage = "Email長度不正確(6~48字元)!!";
                    return(memberData);
                }

                // 驗證成功後再進行IO寫入 寫入後存入 memberData
                MemberIO memberIO = new MemberIO();
                memberData = memberIO.JoinMember(account, password, nickname, age, sex, IP, email, joinTime, "Gansol");
            }
            catch (Exception e)
            {
                throw e;
            }

            return(memberData); //回傳資料
        }