string IPrimeAccount.SelectAccount(string OptCode, ref int FlagCode) { int NewCallCount = Interlocked.Increment(ref CallCount); string SendReceiveString; //更新可视化界面 SendReceiveString = string.Format("SelectAccount:[次数:{0}][OptCode:{1}][FlagCode:{2}]", CallCount, OptCode, FlagCode); OutPut(SendReceiveString); AccountTest mAccountTest = MyTestListAccount.Find( delegate(AccountTest AccountUser) { return(AccountUser.AccountID.Equals(OptCode)); }); if (mAccountTest != null) { string ReturnStr = mAccountTest.TeleCode; FlagCode = 100; return(ReturnStr);//成功 } else { FlagCode = 200; return(null);//失败 } }
int IPrimeAccount.EditAccount(string AccountID, int FlagCode, string OptCode, string[] ParaArray) { int NewCallCount = Interlocked.Increment(ref CallCount); string SendReceiveString; SendReceiveString = string.Format("EditAccount:[次数:{0}][AccountID:{1}] [{2}] [{3}]", CallCount, AccountID, FlagCode, OptCode); OutPut(SendReceiveString); if (FlagCode == 10) { //传头像 string HeadImageStr = OptCode.Substring(23); OutPut(HeadImageStr); if (!string.IsNullOrEmpty(HeadImageStr)) { byte[] HeadImageBytes = Convert.FromBase64String(HeadImageStr); OutPut("Bytes:[" + HeadImageBytes.Length.ToString() + "] [0]:" + HeadImageBytes[0].ToString()); } } if (FlagCode == 11) { //传手机号 AccountTest mAccountTest = MyTestListAccount.Find( delegate(AccountTest AccountUser) { return(AccountUser.LoginName.Equals(AccountID)); }); if (mAccountTest != null) { mAccountTest.TeleCode = OptCode; } OutPut("手机号:" + OptCode); } if (ParaArray != null && ParaArray.Length > 0) { //测试数组传输 OutPut("ParaArray[0]:" + ParaArray[0]); } //byte[] HeadImageBytes = Convert.FromBase64String(HeadImageStr); //OutPut("字节长度:"+HeadImageBytes.Length.ToString()); //OutPut(HeadImageBytes[0].ToString()); //OutPut(HeadImageBytes[1].ToString()); //OutPut(HeadImageBytes[2].ToString()); return(100); }
int IPrimeAccount.LoginCloud(string LoginName, string PassWord, ref string AccountID) { int NewCallCount = Interlocked.Increment(ref CallCount); string SendReceiveString; string mAccountID = AccountID; //更新可视化界面 SendReceiveString = string.Format("LoginCloud:[次数:{0}][LoginName:{1}][PassWord:{2}][AccountID:{3}]", CallCount, LoginName, PassWord, mAccountID); OutPut(SendReceiveString); AccountTest mAccountTest = MyTestListAccount.Find( delegate(AccountTest AccountUser) { return(AccountUser.LoginName.Equals(LoginName) && AccountUser.PassWord.Equals(PassWord)); }); if (mAccountTest != null) { AccountID = mAccountTest.AccountID; //更新列表 if (UIContext != null && UpdateCallLogin != null) { string str = AccountID; UIContext.Post(UpdateCallLogin, str); } SendReceiveString = string.Format("LoginCloud:[次数:{0}][Get AccountID:{1}]", CallCount, mAccountTest.AccountID); OutPut(SendReceiveString); return(100);//成功,测试表明,必须直接返回值 } else { AccountID = mAccountID; return(200);//200:失败,测试表明,必须直接返回值 } }
int IPrimeAccount.RegisterAccount(string LoginName, string PassWord, ref string AccountID) { int NewCallCount = Interlocked.Increment(ref CallCount); string SendReceiveString; //更新可视化界面 SendReceiveString = string.Format("Register:[次数:{0}][LoginName:{1}][PassWord:{2}][MobileID:{3}]", CallCount, LoginName, PassWord, AccountID); OutPut(SendReceiveString); string mMobileID = AccountID; if (string.IsNullOrEmpty(AccountID) || string.IsNullOrEmpty(LoginName)) { OutPut(SendReceiveString); return(200); } //---1.------------------- AccountTest mAccountTest = MyTestListAccount.Find( delegate(AccountTest AccountUser) { return(AccountUser.MobileID.Equals(mMobileID));//AccountUser.LoginName.Equals(LoginName); }); //---2.------------------- if (mAccountTest == null) { //新手机:分3种情况: AccountTest mnAccountTest = MyTestListAccount.Find( delegate(AccountTest AccountUser) { return(AccountUser.LoginName.Equals(LoginName));// && AccountUser.PassWord.Equals(PassWord) }); if (mnAccountTest != null) { if (mnAccountTest.PassWord == PassWord) { //1.种情况登录名正确密码正确(可能换手机),注册到新手机 AccountID = mnAccountTest.AccountID; //更新列表 if (UIContext != null && UpdateCallAccount != null) { string str = AccountID + "," + LoginName + "," + PassWord + "," + mMobileID; UIContext.Post(UpdateCallAccount, str); } SendReceiveString = string.Format("Register:[次数:{0}][Get AccountID:{1}]", CallCount, mnAccountTest.AccountID); AccountTest MyAccountTest = new AccountTest(); MyAccountTest.AccountID = mnAccountTest.AccountID; MyAccountTest.LoginName = LoginName; MyAccountTest.PassWord = PassWord; MyAccountTest.MobileID = mMobileID; MyTestListAccount.Add(MyAccountTest); OutPut(SendReceiveString); return(100);//新手机已经注册返回成功,【测试表明,必须直接返回值】 } else { //2.种情况登录名正确密码错误 AccountID = null; return(200);//已经注册登录名密码错误无效;【测试表明,必须直接返回值】 } } else { //3.种情况无登录名新手机(新手机新用户) string CreateAccountID; //int NewAccountID = Interlocked.Increment(ref AccountCount); //int Temp = 10000 + NewAccountID; //CreateAccountID="1234567" + Temp.ToString(); CreateAccountID = CreateMobileID.GetMobileIDNumberCode12(); AccountTest MyAccountTest = new AccountTest(); MyAccountTest.AccountID = CreateAccountID; MyAccountTest.LoginName = LoginName; MyAccountTest.PassWord = PassWord; MyAccountTest.MobileID = mMobileID; MyTestListAccount.Add(MyAccountTest); AccountID = CreateAccountID; //更新列表 if (UIContext != null && UpdateCallAccount != null) { string str = CreateAccountID + "," + LoginName + "," + PassWord + "," + mMobileID; UIContext.Post(UpdateCallAccount, str); } SendReceiveString = string.Format("Register:[次数:{0}][Create AccountID:{1}]", CallCount, CreateAccountID); OutPut(SendReceiveString); return(100);//新手机新注册;【测试表明,必须直接返回值】 } } else { //老手机:分两种情况: if (mAccountTest.LoginName == LoginName && mAccountTest.PassWord == PassWord) { AccountID = mAccountTest.AccountID; //更新列表 if (UIContext != null && UpdateCallLogin != null) { string str = AccountID; UIContext.Post(UpdateCallLogin, str); } SendReceiveString = string.Format("Register:[次数:{0}][Get AccountID:{1}]", CallCount, mAccountTest.AccountID); OutPut(SendReceiveString); return(100);//老手机已经注册或者设备已经注册(可能认为卸载重装因素造成);【测试表明,必须直接返回值】 } else { AccountID = null; return(200);//已经注册或者设备已经注册;【测试表明,必须直接返回值】 } } }