private void button1_Click(object sender, EventArgs e) { if (checkBox1.Checked) { //회원가입 요청 if (textBox2.Text == textBox3.Text) { ICD.User obj = new ICD.User(); ICD.HEADER.HeadBuilder(obj, ICD.COMMAND.NewUser, ICD.TYPE.REQ); obj.userID = textBox1.Text; obj.userPW = textBox2.Text; sendMsgToServer(obj); } else { MessageBox.Show(MSG_DIFF_PW); } } else { //로그인 요청 ICD.User obj = new ICD.User(); ICD.HEADER.HeadBuilder(obj, ICD.COMMAND.Login, ICD.TYPE.REQ); obj.userID = textBox1.Text; obj.userPW = textBox2.Text; sendMsgToServer(obj); } }
private void button1_Click(object sender, EventArgs e) { if (cbNewUser.Checked) { //회원가입 요청 if (edPassword.Text == edPasswordCheck.Text) { ICD.User obj = new ICD.User(); obj.FillClientHeader(ICD.DEF.CMD_NewUser); obj.userID = edUserID.Text; obj.userPW = edPassword.Text; ICDPacketMgr.GetInst().sendMsgToServer(obj); } else { MessageBox.Show(MSG_DIFF_PW); } } else { //로그인 요청 ICD.User obj = new ICD.User(); obj.FillClientHeader(ICD.DEF.CMD_Login); obj.userID = edUserID.Text; obj.userPW = edPassword.Text; ICDPacketMgr.GetInst().sendMsgToServer(obj); } }
private void ICD_NewUser(ICD.HEADER obj) { ICD.User msg = obj as ICD.User; if (DatabaseMgr.GetUserInfo(msg.userID) != null) { //send back error msg : same user id } else { //push db new user //ack good } }
public static int NewUser(ICD.User info) { string sql = string.Format( "INSERT INTO user " + //user DataBase "(recordID, password, time, auth) " + //Column name "VALUES ('{0}', '{1}', '{2}', {3})", //values list info.userID, info.userPW, info.msgTime, 2); MySqlCommand cmd = new MySqlCommand(sql, mConn); int ret = cmd.ExecuteNonQuery(); return(ret); }
private void ICD_Login(int clientID, ICD.HEADER obj) { ICD.User msg = obj as ICD.User; DataRow row = DatabaseMgr.GetUserInfo(msg.userID); if (row != null) { //if(isOKpassword) { //loginUser(); //ack good } //else { //send back error msg : wrong password } } else { //send back error msg : no user id } }