Ejemplo n.º 1
0
        private void TeamCodeBoxChanged(object sender, TextChangedEventArgs e)
        {
            string         text = TeamCodeBox.Text;
            TeamCodeVerify vir  = DataManager.CheckStr(text);

            switch (vir)
            {
            case TeamCodeVerify.None:
                IsNewTeam.Content    = "새로운 팀을 생성하시는군요!    팀명은 입력하신 정보로 기록됩니다.";
                isCanuseTeamName     = true;
                IsNewTeam.Foreground = Brushes.Green;
                break;

            case TeamCodeVerify.TeamCodeContains:
                IsNewTeam.Content    = "팀을 발견했습니다!    팀명은 \" " + DataManager.GetTeamName(text) + " \" 입니다!";
                isCanuseTeamName     = true;
                IsNewTeam.Foreground = Brushes.Green;
                break;

            case TeamCodeVerify.TeamNameContains:
                IsNewTeam.Content    = "이미 존재하는 팀입니다!    다른 이름을 입력하거나 팀코드를 입력해주세요.";
                isCanuseTeamName     = false;
                IsNewTeam.Foreground = Brushes.Red;
                break;

            case TeamCodeVerify.Empty:
                IsNewTeam.Content    = "이곳을 공백으로 남겨둘순 없습니다.";
                isCanuseTeamName     = false;
                IsNewTeam.Foreground = Brushes.Red;
                break;
            }
        }
Ejemplo n.º 2
0
        private void RegisterButton_Click(object sender, RoutedEventArgs e)
        {
            if (!isCanUseEmail)
            {
                EmailCanUseSetter(false);
            }
            if (!isCanUsePassword)
            {
                PasswordCanUseSetter(false);
            }
            if (!isCanUseUsername)
            {
                CanUseUsernameSetter(false);
            }
            if (PasswordBox.Password == "")
            {
                PasswordWarring.Foreground = Brushes.Red;
            }
            if (!isCanuseTeamName)
            {
                IsNewTeam.Foreground = Brushes.Red;
                IsNewTeam.Content    = "이곳을 공백으로 남겨둘순 없습니다.";
            }
            if (isCanUseUsername && isCanUsePassword && isCanUseEmail && PasswordBox.Password != "" && isCanuseTeamName)
            {
                string         text = TeamCodeBox.Text;
                TeamCodeVerify vir  = DataManager.CheckStr(text);

                StringBuilder builder = new StringBuilder();
                switch (vir)
                {
                case TeamCodeVerify.None:
                    builder.Append("새로운 팀 창설 | 팀명 : " + text);
                    break;

                case TeamCodeVerify.TeamCodeContains:
                    builder.Append("기존의 팀 가입 | 팀명 : " + DataManager.GetTeamName(text));
                    break;
                }
                string results = builder.ToString();

                MessageBoxResult result = MessageBox.Show("다음 정보를 확인해주세요.\n사용자명 : " +
                                                          userNameBox.Text + "\n이메일 : " + EmailBox.Text + "@" + EmailTextBox.Text + "\n" +
                                                          results, "정보가 맞습니다", MessageBoxButton.OKCancel);

                if (result == MessageBoxResult.OK)
                {
                    DataManager.RegisterUser(userNameBox.Text, EmailBox.Text + "@" + EmailTextBox.Text, PasswordBox.Password, text, DataManager.CheckStr(text));
                    this.Close();
                }
                else
                {
                    MessageBox.Show("알겠습니다. 다시한번 정보를 확인해주세요.");
                }
            }
        }
Ejemplo n.º 3
0
        public static void RegisterUser(string name, string id, string password, string team, TeamCodeVerify verify)
        {
            if (verify == TeamCodeVerify.None)
            {
                MakeNewTeam(team, name);
            }
            int    newId = GetUserList() + 1;
            string code  = (verify == TeamCodeVerify.TeamCodeContains ? team : GetTeamCode(team));

            string sql = "INSERT INTO userdatas VALUES(" + newId + ",\"" + name + "\",\"" + id + "\",\"" + password + "\",\"" + code + "\",\"" + GetTeamName(code) + "\",\"false" + "\");";

            connection.Open();
            MySqlCommand command = new MySqlCommand(sql, connection);

            try
            {
                if (command.ExecuteNonQuery() != 1)
                {
                    MessageBox.Show("오류가 발생했습니다. 0- 회원가입\n관리자에게 문의해주세요.");
                }
            }catch (Exception e) { Debug.WriteLine(e.ToString()); }
            connection.Close();

            if (verify == TeamCodeVerify.None)
            {
                UserToCaptain(team, name);
            }
        }
Ejemplo n.º 4
0
        internal static void RegisterUser(string name, string id, string password, string team, TeamCodeVerify teamCodeVerify)
        {
            if (teamCodeVerify == TeamCodeVerify.None)
            {
                MakeNewTeam(team, team);
            }

            string code = (teamCodeVerify == TeamCodeVerify.TeamCodeContains ? team : GetTeamCode(team));

            var client = new WebClient();

            client.Headers[HttpRequestHeader.ContentType] = "application/json";
            client.Encoding = UTF8Encoding.UTF8;
            JObject obj = new JObject();

            obj.Add("name", name);
            obj.Add("email", id);
            obj.Add("password", DataFormatter.Encrypt512(password));
            obj.Add("teamCode", teamCodeVerify == TeamCodeVerify.TeamCodeContains ? team : GetTeamCode(team));
            client.UploadString("http://danny-dataserver.kro.kr:8080/addUser", obj.ToString());
        }