public static void Propose(string Email, string SessionTitle, string SessionAbstract) { var ctx = new ICCData(); int eId = Event.GetNextEvent().Id; var session = new Session() { Title = SessionTitle, Abstract = SessionAbstract, EventId = eId }; ctx.Sessions.InsertOnSubmit(session); ctx.SubmitChanges(); var user = ctx.Users.Where(u => string.Compare(u.Email, Email, true) == 0).FirstOrDefault(); Speaker speak = new Speaker() { SessionId = session.Id, UserId = user.Id }; ctx.Speakers.InsertOnSubmit(speak); ctx.SubmitChanges(); }
public static bool ValidateUserAccount(string code) { ICCData ctx = new ICCData(); var userMatch = (from u in ctx.Users where u.ValidationCode == code select u).FirstOrDefault(); if (userMatch.Id > 0) { userMatch.IsValidated = true; ctx.SubmitChanges(); AddUserToRole(userMatch.Email, "attendees"); return(true); } return(false); }
public static bool Update(int SessionId, string Title, string Abstract, bool IsApproved, int SpeakerID) { var ctx = new ICCData(); var session = (from s in ctx.Sessions where s.Id == SessionId select s).First(); session.Title = Title; session.Abstract = Abstract; session.IsApproved = IsApproved; var speakers = (from s in ctx.Speakers where s.SessionId == SessionId select s).First(); ctx.SubmitChanges(); return(true); }
public static void Update(string email, string firstname, string lastname, string password, string displayname, string site, string organization, string city, string region, string country, string comments) { var ctx = new ICCData(); var user = ctx.Users.Where(u => string.Compare(u.Email, email, true) == 0).FirstOrDefault(); user.FirstName = firstname; user.LastName = lastname; if (password.Trim().Length > 0) { SetPassword(user, password); } user.DisplayName = displayname; user.Site = site; user.Organization = organization; user.City = city; user.Region = region; user.Country = country; user.Comments = comments; ctx.SubmitChanges(); }