public bool AddSong(string url, int profileId) { DBSong dbSong = new DBSong(); DbActivity dbActivity = new DbActivity(); using (IDbTransaction tran = DbConnection.GetInstance().BeginTransaction()) { try { Song song = dbSong.FindSongByURL(url); if (song != null) { return(false); } int activityId = dbActivity.CreateActivity(profileId); if (activityId > 0 && dbSong.AddSong(GetVideoTitle(url), GetVideoDuration(url), url, activityId) > 0) { tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } catch (Exception) { tran.Rollback(); return(false); } } }
public ChatController() { dbChat = new DbChat(); dbActivity = new DbActivity(); profileController = new ProfileController(); groupController = new GroupController(); }
public SongTests() { dbActivity = new DbActivity(); songController = new SongController(); dbConnection = DbConnection.GetInstance(); dbSong = new DBSong(); }
/// <summary> /// Creates an activity object from id /// </summary> /// <param name="id">id of activity</param> public Activity(int id) { var dr = DbActivity.GetActivity(id); ActivityText = (string)dr["ActivityText"]; Timestamp = (DateTime)dr["Timestamp"]; UserId = (int)dr["User"]; }
/// <summary> /// returns all activities for user /// </summary> /// <param name="user">id of user</param> /// <returns></returns> public static List <Activity> UserActivities(int user) { var list = new List <Activity>(); var tb = DbActivity.UserActivity(user); foreach (DataRow row in tb.Rows) { list.Add(new Activity(row)); } return(list); }
public SongTests() { dbActivity = new DbActivity(); songController = new SongController(); dbSong = new DBSong(); }
public PlayListController() { dbPlayList = new DbPlayList(); dbActivity = new DbActivity(); }
/// <summary> /// adds an activity for this user /// </summary> /// <param name="text">text of activity</param> public void AddActivity(string text) { DbActivity.InsertActivity(text, Id); }
/// <summary> /// adds a new activity to the database /// </summary> /// <param name="text">activity text</param> /// <param name="userId">id of user</param> public static void AddActivity(string text, int userId) { DbActivity.InsertActivity(text, userId); }
public GroupController() { dbGroup = new DbGroup(); dbActivity = new DbActivity(); profileController = new ProfileController(); }
public PlayListController() { dbPlayList = new DbPlayList(); con = DbConnection.GetInstance(); dbActivity = new DbActivity(); }
public MessageController() { dbMessage = new DbMessage(); dbActivity = new DbActivity(); }
public PlayListTests() { playListController = new PlayListController(); songController = new SongController(); dbActivity = new DbActivity(); }