public static bool Login(string UserName, string Password, ClubcUser user) { SqlConnection con = new SqlConnection(); SqlDataReader reader; SqlCommand cmd; string strCmd; bool bRet; try { con.ConnectionString = "Server=(local);database=ClubcDb;User ID=sa;Pwd=qax_sa_1939"; con.Open(); strCmd = string.Format("exec ClubcSvrLogin \'{0}\', \'{1}\'", UserName, Password); cmd = new SqlCommand(strCmd, con); reader = cmd.ExecuteReader(); if (reader.Read()) { if (user != null) { user.UserName = (string)reader["ID"]; user.Password = (string)reader["Pass"]; user.Nickname = (string)reader["Nickname"]; user.m_UserClassStr = (string)reader["Class"]; } bRet = true; } else { bRet = false; } } catch (SqlException /*ex*/) { // return(false); } catch (InvalidOperationException /*ex*/) { // return(false); } con.Close(); return(bRet); }
public static ClubcUser CreateUser(string user, string pass, string ClassStr, string Nickname) { bool bSuccessed; ClubcReader r = Utility.ExecSql(string.Format("exec CreateClubcUser '{0}', '{1}', '{2}', '{3}'", user, pass, ClassStr, Nickname), out bSuccessed); if (bSuccessed) { ClubcUser cu = new ClubcUser(); cu.UserName = user; cu.Password = pass; cu.Nickname = Nickname; cu.m_UserClassStr = ClassStr; return(cu); } else { return(null); } }
public static ClubcReader ReadPost(ClubcUser user, string title) { return(ReadPost(user.UserName, user.Password, title)); }
public static bool WritePost(ClubcUser user, string PostLevel, string title, string writing) { return(WritePost(user.UserName, user.Password, PostLevel, title, writing)); }
public static ClubcReader ReadPost(ClubcUser user, int id) { return(ReadPost(user.UserName, user.Password, id)); }