public ActionResult Index(PlayerRegistration subscriber) { var applicants = context.Applicaitons.Select(x => x.AspNetUsersId).ToList(); var userName = User.Identity.GetUserName(); var user = context.Users.Where(x => x.UserName == userName).First(); if (applicants.Contains(user.Id)) { return(RedirectToAction("AlreadyApplied", "PlayerApplication")); } else { ApplicationModels applicant = new ApplicationModels(); user.FirstName = subscriber.FirstName; user.LastName = subscriber.LastName; user.Address = subscriber.Address; user.City = subscriber.City; user.State = subscriber.State; user.Phone = subscriber.PhoneNumber; user.Zip = subscriber.Zip; user.Position = subscriber.SelectedPosition; applicant.AspNetUsersId = user.Id; applicant.ApplicationDate = DateTime.Today; context.Applicaitons.Add(applicant); context.SaveChanges(); return(RedirectToAction("AwaitConfirmation", "PlayerApplication")); } }
public void PlayerBalance(string name, decimal balance) { var playerService = Processor.GetSystemUnderTest <PlayerService>(); var registration = new PlayerRegistration { UserName = name }; playerService.Register(registration); playerService.PlayerWithUserName(name).AdjustBalance(balance); }
public static void WelcomePacketReply() { using (Packet packet = new Packet((byte)ClientPackets.welcomeReceived)) { packet.Write(Client.Instance.ClientID); packet.Write(PlayerRegistration.GetUsername()); SendTCPPacket(packet); } }
public Registration(CharacterSelector selector, RegisteredPlayerUIView ui, RegistrationState registrationState, NetworkMode networkMode, PlayerRegistration context) { this.selector = selector; this.ui = ui; this.registrationState = registrationState; this.context = context; this.localID = -1; this.networkMode = networkMode; this.echoPosition = Vector2.zero; }
public void GetJogadorInscrito(int JogadorId, int InscritoId, int JogadorIdOld, int InscritoIdOld) { try { string sql = ""; SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder { DataSource = "SQL5028.SmarterASP.NET", UserID = "DB_9D81D5_societypro_admin", Password = "******", InitialCatalog = "DB_9D81D5_societypro" }; using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) { connection.Open(); sql = "select * from [dbo].[JogadorInscrito] WHERE IDInscrito = " + InscritoIdOld; sql += " and IDJogador =" + JogadorIdOld; using (SqlCommand command = new SqlCommand(sql, connection)) { IDataReader dtreader = command.ExecuteReader(); DataTable dtresult = new DataTable(); dtresult.Load(dtreader); dtreader.Close(); for (int i = 0; i < dtresult.Rows.Count; i++) { PlayerRegistration c = new PlayerRegistration { Active = true, RegisterDate = Convert.ToDateTime(dtresult.Rows[i]["dDataCadastro"].ToString()), PlayerId = JogadorId, SubscriptionId = InscritoId, State = Convert.ToChar(dtresult.Rows[i]["STATUS"].ToString()), ApprovedDate = Convert.ToDateTime(dtresult.Rows[i]["dDataCadastro"].ToString()) }; Db.PlayerRegistrations.Add(c); } Db.SaveChanges(); } } } catch (SqlException e) { e.Message.ToString(); } }
// GET: PlayerApplication public ActionResult Index() { var position = new List <string> { "Goal Keeper", "Defender", "Mid-Fielder", "Forward" }; var playerApplication = new PlayerRegistration() { PositionType = new SelectList(position) }; return(View(playerApplication)); }
public ActionResult Create(PlayerRegistration playerRegistration) { try { // TODO: Add insert logic here //var user = context.Users.Create(); //user.FirstName = playerRegistration.FirstName; //user.LastName = playerRegistration.LastName; //user.Address = playerRegistration.Address; //user.City = playerRegistration.City; //user.State = playerRegistration.State; //user.Zip = playerRegistration.Zip; //user.PhoneNumber = playerRegistration.PhoneNumber; //user.Position = playerRegistration.SelectedPosition; return(RedirectToAction("Index", "Home")); } catch { return(View()); } }
public override void Reset() { registration = new PlayerRegistration(); SetSystemUnderTest(registration); }
public void PlayerBalance(string name, decimal balance) { var playerService = Processor.GetSystemUnderTest<PlayerService>(); var registration = new PlayerRegistration {UserName = name}; playerService.Register(registration); playerService.PlayerWithUserName(name).AdjustBalance(balance); }
public Registration(CharacterSelector selector, RegisteredPlayerUIView ui, RegistrationState registrationState, int localID, NetworkMode networkMode, PlayerRegistration context) : this(selector, ui, registrationState, networkMode, context) { this.localID = localID; }
public override void OnConnected(EventArgs e) { base.OnConnected(e); this.SetSkillLevel(WeaponSkill.Pistol, 998); this.SetSkillLevel(WeaponSkill.MicroUzi, 998); this.SetSkillLevel(WeaponSkill.SawnoffShotgun, 998); AcceptMP = true; dbContext = ((GameMode)GameMode.Instance).DbContext; bool userExist = false; userExist = dbContext.Accounts.Any(a => a.Username == this.Name); if (userExist) { AccountData = dbContext.Accounts .Single(a => a.Username == this.Name); } else { Character charactere = dbContext.Characters.Select(x => x).Where(a => a.Name == this.Name).FirstOrDefault(); if (charactere != null) { this.Name = charactere.Account.Username; AccountData = dbContext.Accounts .Single(a => a.Username == this.Name); userExist = true; } } this.ToggleSpectating(true); if (userExist) { PlayerLogin login = new PlayerLogin(this, SemiRP.Constants.PASSWORD_MAX_ATTEMPTS); login.DialogEnded += (sender, e) => { dbContext.Accounts.Attach(this.AccountData); this.AccountData.LastConnectionIP = this.IP; this.AccountData.LastConnectionTime = DateTime.Now; dbContext.SaveChanges(); PlayerCharacterChoice chrChoiceMenu = new PlayerCharacterChoice(this); chrChoiceMenu.Show(); }; login.Begin(); } else { PlayerRegistration regMenu = new PlayerRegistration(); regMenu.GetMenu().Ended += (sender, e) => { if (!(e.Data.ContainsKey("password") && e.Data.ContainsKey("email"))) { regMenu.Show(this); return; } Account acc = new Account { Email = (string)e.Data["email"], Username = this.Name, Nickname = this.Name, Password = (string)e.Data["password"], LastConnectionIP = this.IP, LastConnectionTime = DateTime.Now, PermsSet = new PermissionSet() }; dbContext.Add(acc); dbContext.SaveChanges(); this.AccountData = dbContext.Accounts.Single(a => a.Username == this.Name); PlayerCharacterChoice chrChoiceMenu = new PlayerCharacterChoice(this); chrChoiceMenu.Show(); }; var regex = new Regex(@"[A-Z][a-z]+_[A-Z][a-z]+([A-Z][a-z]+)*"); if (regex.IsMatch(this.Name)) { InputDialog nameChangerDialog = new InputDialog("Changement de nom", "Bienvenue sur le serveur.\nCe compte n'existe pas, cependant, nous avons détecté que vous utilisez un nom Roleplay.\n" + "Ce serveur utilise un système de compte avec personnage, vous créerez votre personnage par la suite.\n" + "Il est donc inutile de garder un nom de compte respectant le format roleplay Prénom_Nom.\n" + "Nous vous proposons donc de le changer ou non suivant votre souhait. Vous pouvez très bien garder le format Prénom_Nom mais il ne correspondera\n" + "pas au nom de votre personnage.\n" + "Veuillez écrire le nom du compte que vous souhaitez utiliser (max 24 charactères) :", false, "Confirmer", "Retour"); nameChangerDialog.Response += (sender, eventArg) => { if (eventArg.DialogButton == DialogButton.Right) { nameChangerDialog.Show(this); return; } if (eventArg.InputText.Length > 24) { nameChangerDialog.Show(this); return; } if (dbContext.Accounts.Where(x => x.Username == eventArg.InputText).Any() || dbContext.Characters.Where(x => x.Name == eventArg.InputText).Any()) { nameChangerDialog.Show(this); return; } this.Name = eventArg.InputText; regMenu.Show(this); }; nameChangerDialog.Show(this); return; } regMenu.Show(this); } }