Esempio n. 1
0
        void LoginUser(Control sender)
        {
            string username = ((TextBox) this.GetControlByID("theUsername")).text;
            string password = ((TextBox) this.GetControlByID("thePassword")).text;

            myUser u = new myUser();

            if (u.GetUserByUserName(username))
            {
                if (u.Password != password)
                {
                    ((Label) this.GetControlByID("theError")).text = "The password was incorrect";
                    return;
                }
            }
            else
            {
                u.UserName = username;
                u.Password = password;
                u.InsertData();
            }
            setUsername(u);

            myGameRoom g = new myGameRoom();
            if (!g.GetGameRoomByGameRoomName("Home"))
            {
                g.GameRoomName = "Home";
                g.InsertData();
            }
            g.AddUser_(u);
            this.Page.Request.TransferToPage("Chat*GameRoomID="+g.GameRoomID);
        }
Esempio n. 2
0
        public void getUsers(Control sender)
        {
            myGameRoom room = new myGameRoom(GameID);

            foreach (myUser s in room.Users)
            {
                sender.GetPanel.Children.Add(new Label(s.UserName));
                sender.GetPanel.Children.Add(new BR());
            }
        }
Esempio n. 3
0
        void Game_Load(Control sender)
        {
            myUser u;
            if (Session.ContainsKey("LoggedInUser"))
                u = ((myUser)Session["LoggedInUser"]);
            else
                return;

            int roomID = 0;

            if (this.UserQuery.ContainsKey("GameRoomID"))
            {
                roomID = int.Parse(this.UserQuery["GameRoomID"]);
            }

            myGameRoom r = new myGameRoom(roomID);
            foreach (myUser user in r.Users)
            {
                this.Children.Add(new Label(user.UserName));
                this.Children.Add(new BR());
            }
        }
Esempio n. 4
0
 public static List<myUser> GetUserByGameRoom(myGameRoom val)
 {
     myUserData tempADO = new myUserData();
     List<myUser> list = new List<myUser>();
     DataSet tempDS = tempADO.GetUserByGameRoomID(val.GameRoomID);
     if (tempADO.HasData)
     {
         foreach (DataRow row in tempDS.Tables[0].Rows)
             list.Add(new myUser(row));
         return list;
     }
     return new List<myUser>();
 }
Esempio n. 5
0
 private void Chat_UnLoad(Control sender)
 {
     myGameRoom g = new myGameRoom(GameID);
     ((myUser)Session["LoggedInUser"]).DeleteGameRoom(g.GameRoomID);
 }
Esempio n. 6
0
        private void theGameList_Init(Control sender)
        {
            GameID = int.Parse(this.Page.UserQuery["GameRoomID"]);

            myGameRoom g = new myGameRoom();
            g.GetGameRoomByGameRoomName("Home");
            if (g.GameRoomID == GameID)

                isHome = true;

            //if (!Page.IsPostBack)
            getGames(sender);
        }
Esempio n. 7
0
        void NewGame(Control sender)
        {
            myGameRoom g = new myGameRoom();
            g.GameRoomName = ((((TextBox)GetControlByID("theGameName")).text));
            g.InsertData();

            g = moveGames(g.GameRoomName);

            this.Page.Request.TransferToPage("Chat*GameRoomID=" + g.GameRoomID);
        }
Esempio n. 8
0
        private myGameRoom moveGames(string s)
        {
            if (s == "Leave")
                s = "Home";

            myGameRoom g = new myGameRoom();
            g.GetGameRoomByGameRoomName(s);
            g.AddUser_(((myUser)Page.Session["LoggedInUser"]));

            myGameRoom g1 = new myGameRoom(GameID);
            ((myUser)Page.Session["LoggedInUser"]).DeleteGameRoom(g1.GameRoomID);

            if (g1.GameRoomName != "Home")
                g1.DeleteGameRoom();
            return g;
        }
Esempio n. 9
0
 public bool UpdateData()
 {
     myGameRoom n = new myGameRoom();
     n.GetGameRoomByGameRoomName(myGameRoomName);
     if (n.GameRoomID != 0 && n.GameRoomID != myGameRoomID){ return false;}
     myGameRoomData data=new myGameRoomData();
     List<SqlParameter> tempAL = new List<SqlParameter>();
     SqlParameter tempP;
     tempP = new SqlParameter();
     tempP.ParameterName = "@GameRoomID";
     tempP.Size = 4;
     tempP.SqlDbType = SqlDbType.Int;
     tempP.Value = myGameRoomID;
     tempP.Direction = ParameterDirection.Input;
     tempAL.Add(tempP);
     tempP = new SqlParameter();
     tempP.ParameterName = "@GameRoomName";
     tempP.Size = 200;
     tempP.SqlDbType = SqlDbType.VarChar;
     tempP.Value = myGameRoomName;
     tempP.Direction = ParameterDirection.Input;
     tempAL.Add(tempP);
     data.RunProcedure("csp_UpdateGameRoom", tempAL);
     foreach(myUser temp in myUser.GetUserByGameRoom(this)) temp.DeleteGameRoom(myGameRoomID);
     foreach(myUser temp in myUser_) temp.UpdateGameRoom(myGameRoomID);
     return true;
 }
Esempio n. 10
0
 public bool InsertData()
 {
     myGameRoom n = new myGameRoom();
     n.GetGameRoomByGameRoomName(myGameRoomName);
     if (n.GameRoomID != 0) return false;
     myGameRoomData data=new myGameRoomData();
     List<SqlParameter> tempAL = new List<SqlParameter>();
     SqlParameter tempP;DataSet tempDS;
     tempP = new SqlParameter();
     tempP.ParameterName = "@GameRoomName";
     tempP.Size = 200;
     tempP.SqlDbType = SqlDbType.VarChar;
     tempP.Value = myGameRoomName;
     tempP.Direction = ParameterDirection.Input;
     tempAL.Add(tempP);
     tempDS = data.RunProcedure("csp_InsertGameRoom", tempAL);
     myGameRoomID= int.Parse(tempDS.Tables[0].Rows[0][0].ToString());
     foreach(myUser temp in myUser.GetUserByGameRoom(this)) temp.DeleteGameRoom(myGameRoomID);
     foreach(myUser temp in myUser_) temp.UpdateGameRoom(myGameRoomID);
     tempDS.Dispose(); return true;
 }