internal static void DeleteAlert(int alertId) { ApplicationDbContext _db = new ApplicationDbContext(); UserAlerts thisAlert = _db.UserAlerts.Where(a => a.id == alertId).First(); thisAlert.alertActive = false; _db.Entry(thisAlert).State = System.Data.Entity.EntityState.Modified; _db.SaveChanges(); }
internal static void AddAlert(int simpleUserId, string alertTitle, string alertText, Boolean userCanDelete) { ApplicationDbContext _db = new ApplicationDbContext(); UserAlerts newAlert = new UserAlerts() { alertRead = false, alertText = alertText, alertTitle = alertTitle, simpleUserId = simpleUserId, alertActive = true, alertDate = DateTime.Now, userCanDelete = userCanDelete }; _db.UserAlerts.Add(newAlert); _db.SaveChanges(); }
public IEnumerable <UserAlerts> GetAlert(long userID) { using (SandeepDBEntities db = new SandeepDBEntities()) { List <UserAlerts> alerts = new List <UserAlerts>(); UserAlerts userAlert = new UserAlerts(); var v = db.tblUserAlert.Where(x => x.tblUserID == userID).Select(y => new UserAlerts() { Description = y.tblAlerts.Description, createdAt = y.tblAlerts.CreatedAt, Subject = y.tblAlerts.Subject }).ToList(); return(v); } }
protected void Page_Load(object sender, EventArgs e) { //if (this.KickPage.KickUserProfile.IsBanned) // AddWebSiteAlertMessage("flash flash-information", "NOTE: Your account has been BANNED. This is probably due to submitting spam to the site. Please contact us if you feel that this is in error."); //can add more web site alerts //such as system status/offline/scheduled outages //or chat sessions etc. UserAlerts userAlerts = new UserAlerts(); if (this.KickPage.KickUserProfile.IsBanned) { userAlerts.AddAlertMessage("NOTE: Your account has been BANNED. This is probably due to submitting spam to the site. Please contact us if you feel that this is in error."); } userAlerts.AddAlertMessage(UserBR.UserAlertMessages(this.KickPage.KickUserProfile.UserID)); this.phWebSiteAlert.Controls.Add(userAlerts); }