Example #1
0
        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);
        }
Example #2
0
        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);
            }
        }
Example #3
0
 public static ClubcReader ReadPost(ClubcUser user, string title)
 {
     return(ReadPost(user.UserName, user.Password, title));
 }
Example #4
0
 public static bool WritePost(ClubcUser user, string PostLevel, string title, string writing)
 {
     return(WritePost(user.UserName, user.Password, PostLevel, title, writing));
 }
Example #5
0
 public static ClubcReader ReadPost(ClubcUser user, int id)
 {
     return(ReadPost(user.UserName, user.Password, id));
 }