Ejemplo n.º 1
0
        public static bool AddNewNotification(string session, int userId, int courseId, Notification toAdd)
        {
            try
            {
                int result = new DataAccess(ConnectionString).ExecuteNonQuerySP("SP_AddNewNotification",
                        "@SessionID", session,
                        "@UserID", userId,
                        "@CourseID", courseId,
                        "@Subject", toAdd.Subject,
                        "@Content", toAdd.Content);

                return result > 0;
            }
            catch (Exception)
            {
                return false;
            }
        }
Ejemplo n.º 2
0
 public bool AddNewNotification(string sessionId, int userId, int courseId, Notification noti)
 {
     return CMDal.AddNewNotification(sessionId, userId, courseId, noti);
 }
Ejemplo n.º 3
0
        public static List<Notification> GetUserHistoryAndNotification(string sessionId, int userId, DateTime lastDate)
        {
            List<Notification> toReturn = new List<Notification>();
            try
            {
                DataTable table = new DataAccess(ConnectionString).ExecuteQuerySP("SP_GetUserNotifications",
                        "@SessionID", sessionId,
                        "@UserID", userId,
                        "@LastNTime", lastDate);

                if (table == null || table.Rows.Count == 0)
                    return toReturn;
                foreach (DataRow row in table.Rows)
                {
                    Notification n = new Notification();
                    n.Subject = ParseCellDataToString(row["Subject"]);
                    n.Content = ParseCellDataToString(row["Content"]);
                    n.Owner = ParseCellDataToString(row["Owner"]);
                    n.CourseName = ParseCellDataToString(row["CourseName"]);
                    n.CreatedTime = ParseCellDataToDateTime(row["Time"]);

                    toReturn.Add(n);
                }
                return toReturn;
            }
            catch (Exception)
            {
                return toReturn;
            }
        }