private void regResult(SocketModelPB model) { CommonResp resp = CommonResp.ParseFrom(model.Content); CommonResp.Types.RespCode result = resp.Code; switch (result) { case CommonResp.Types.RespCode.SUCCESS: ClientDataUtil.warnings.Add("注册成功"); SendMessage("regCannel"); break; case CommonResp.Types.RespCode.REGISTER_ACCOUNT_ALREADY_EXISTS: ClientDataUtil.warnings.Add("帐号已存在,注册失败"); SendMessage("regClick"); break; case CommonResp.Types.RespCode.REGISTER_ACCOUNT_NAME_ILLEGAL: ClientDataUtil.warnings.Add("帐号不合法,注册失败"); SendMessage("regClick"); break; case CommonResp.Types.RespCode.REGISTER_ACCOUNT_PASSWORD_ILLEGAL: ClientDataUtil.warnings.Add("密码不合法,注册失败"); SendMessage("regClick"); break; } }
/** * Save / Update Athlete Details */ public CommonResp SaveAthelte(AthleteTests at) { CommonResp msg = new CommonResp(); try { if (at.Id > 0) { db.AthleteTests.Update(at); } else { db.AthleteTests.Add(at); } db.SaveChanges(); msg.flag = true; msg.message = "Saved Successfully"; } catch (Exception ex) { msg.flag = false; msg.message = ex.Message; } return(msg); }
private void loginResult(SocketModelPB model) { CommonResp resp = CommonResp.ParseFrom(model.Content); CommonResp.Types.RespCode result = resp.Code; switch (result) { case CommonResp.Types.RespCode.LOGIN_ACCOUNT_UNEXIST: ClientDataUtil.warnings.Add("帐号不存在,登录失败"); break; case CommonResp.Types.RespCode.LOGIN_PASSWORD_ERROR: ClientDataUtil.warnings.Add("密码错误,登录失败"); break; case CommonResp.Types.RespCode.LOGIN_ACCOUNT_ALREADY_ONLINE: ClientDataUtil.warnings.Add("帐号已登录,登录失败"); break; default: //TODO 登录成功 跳转到角色选择场景 SendMessage("loading", 1); break; } }