Esempio n. 1
0
        public SimpleResponse SetDefaultRoom(string accountId, string roomId)
        {
            mServiceLog.Log.InfoFormat("GetDefaultRoom: accountId={0}, roomId={1}", accountId, roomId);
            RoomsUtil roomsUtil = new RoomsUtil();

            roomsUtil.SetAllUserRoomsToNotBeDefault(accountId);

            StringBuilder xmlBuilder = new StringBuilder();

            try
            {
                using (MySqlConnection mysqlConnection = new MySqlConnection(WebConfig.RoomsDBConnectionString))
                {
                    mysqlConnection.Open();

                    //we join accounts here because i don't know if we want the account Id sent down at some point.
                    string getDefaultRoomQuery = "UPDATE AccountToRoomMapping SET IsDefault = '1' WHERE RoomId=@RoomId;";

                    using (MySqlCommand getDefaultRoomCommand = mysqlConnection.CreateCommand())
                    {
                        getDefaultRoomCommand.Parameters.AddWithValue("@RoomId", roomId);
                        getDefaultRoomCommand.CommandText = getDefaultRoomQuery;
                        getDefaultRoomCommand.ExecuteNonQuery();
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }

            return(new SimpleResponse("Success", "true"));
        }
Esempio n. 2
0
        /// <summary>
        /// Switches a disabled room to enabled in the DB
        /// This is to be used like an UN-Delete of sorts
        /// in case someone deleted a room they wanted back
        /// </summary>
        /// <param name="roomId"></param>
        /// <returns></returns>
        public SimpleResponse EnableRoom(string roomId)
        {
            mServiceLog.Log.InfoFormat("EnableRoom: roomId={0}", roomId);
            RoomsUtil roomsUtil = new RoomsUtil();

            roomsUtil.EnableRoom(roomId);
            return(new SimpleResponse("Success", "true"));
        }