/// <summary> /// Update the history of the local user table /// </summary> /// <param name="userId"></param> public static void updateLogUser(string userId) { UsersAutDataContext context = new UsersAutDataContext(); LocalUser Base = context.LocalUsers.Single(a => a.Email == userId); Base.Updated_at = DateTime.Now; context.SubmitChanges(); }
/// <summary> /// Change password /// </summary> public static bool ChangePassword(string userId, string password) { password = GetMD5(password); UsersAutDataContext context = new UsersAutDataContext(); LocalUser Base = context.LocalUsers.Single(a => a.Email == userId); Base.Password = password; context.SubmitChanges(); return true; }
/// <summary> /// Change password /// </summary> public static bool ChangePassword(string userId, string password) { password = GetMD5(password); UsersAutDataContext context = new UsersAutDataContext(); LocalUser Base = context.LocalUsers.Single(a => a.Email == userId); Base.Password = password; context.SubmitChanges(); return(true); }
/// <summary> /// Save in the LogSessions table /// </summary> /// <param name="userName"></param> /// <param name="password"></param> public static void SaveLogIn(string userId) { UsersAutDataContext context = new UsersAutDataContext(); LogSession ses = new LogSession(); ses.SessionDate = DateTime.Now; ses.UserId = userId; context.LogSessions.InsertOnSubmit(ses); context.SubmitChanges(); }
/// <summary> /// Save in the logAction table /// </summary> /// <param name="userName"></param> /// <param name="password"></param> public static void SaveAction(string action) { UsersAutDataContext context = new UsersAutDataContext(); LogAction actions = new LogAction(); actions.Action = action; actions.UserId = HttpContext.Current.User.Identity.Name; actions.ActionDate = DateTime.Now; context.LogActions.InsertOnSubmit(actions); context.SubmitChanges(); }
/// <summary> /// Create User /// </summary> /// <param name="userName"></param> /// <param name="password"></param> public static bool CreateUser(LocalUser user) { try { UsersAutDataContext context = new UsersAutDataContext(); context.LocalUsers.InsertOnSubmit(user); context.SubmitChanges(); return true; } catch { return false; } }
/// <summary> /// Save donors in Bookmarked table by user id using Linq datacontext to connect with MPX database /// </summary> /// <param name="bookmark">Bookmarked Donor object</param> /// <returns>If the transaction has been succesfull</returns> public bool BookmarkDonor(BookmarkedDonor bookmark) { try { UsersAutDataContext context = new UsersAutDataContext(); context.BookmarkedDonors.InsertOnSubmit(bookmark); context.SubmitChanges(); return(true); } catch { return(false); } }
/// <summary> /// Create User /// </summary> /// <param name="userName"></param> /// <param name="password"></param> public static bool CreateUser(LocalUser user) { try { UsersAutDataContext context = new UsersAutDataContext(); context.LocalUsers.InsertOnSubmit(user); context.SubmitChanges(); return(true); } catch { return(false); } }
public bool UnBookmarkDonor(string idUser, long donorID) { try { UsersAutDataContext context = new UsersAutDataContext(); List <BookmarkedDonor> list = (from a in context.BookmarkedDonors where (a.User_ID == idUser && a.Donor_ID == donorID) select a).ToList <BookmarkedDonor>(); if (list != null && list.Count > 0) { context.BookmarkedDonors.DeleteOnSubmit(list[0]); context.SubmitChanges(); } return(true); } catch { return(false); } return(false); }
/// <summary> /// Save donors in Bookmarked table by user id using Linq datacontext to connect with MPX database /// </summary> /// <param name="bookmark">Bookmarked Donor object</param> /// <returns>If the transaction has been succesfull</returns> public bool BookmarkDonor(BookmarkedDonor bookmark) { var list = BookmarkedByUser(bookmark.User_ID); if (list.Where(r => r.Donor_ID == bookmark.Donor_ID).Count() == 0) { try { UsersAutDataContext context = new UsersAutDataContext(); context.BookmarkedDonors.InsertOnSubmit(bookmark); context.SubmitChanges(); Models.Util.SaveAction(Util.Actions.BookMarked + ":" + bookmark.Donor_ID + " status:true"); return(true); } catch { Models.Util.SaveAction(Util.Actions.BookMarked + ":" + bookmark.Donor_ID + " status:false"); return(false); } } return(false); }
/// <summary> /// Save donors in Bookmarked table by user id using Linq datacontext to connect with MPX database /// </summary> /// <param name="bookmark">Bookmarked Donor object</param> /// <returns>If the transaction has been succesfull</returns> public bool BookmarkDonor(BookmarkedDonor bookmark) { var list = BookmarkedByUser(bookmark.User_ID); if (list.Where(r => r.Donor_ID == bookmark.Donor_ID).Count() == 0) { try { UsersAutDataContext context = new UsersAutDataContext(); context.BookmarkedDonors.InsertOnSubmit(bookmark); context.SubmitChanges(); Models.Util.SaveAction(Util.Actions.BookMarked + ":" + bookmark.Donor_ID + " status:true"); return true; } catch { Models.Util.SaveAction(Util.Actions.BookMarked + ":" + bookmark.Donor_ID + " status:false"); return false; } } return false; }
/// <summary> /// Update the history of the local user table /// </summary> /// <param name="userId"></param> public static void updateLogUser(string userId) { UsersAutDataContext context = new UsersAutDataContext(); if (context.LocalUsers.Count() > 0) { LocalUser Base = context.LocalUsers.Single(a => a.Email == userId); Base.Updated_at = DateTime.Now; context.SubmitChanges(); } }
/// <summary> /// Save donors in Bookmarked table by user id using Linq datacontext to connect with MPX database /// </summary> /// <param name="bookmark">Bookmarked Donor object</param> /// <returns>If the transaction has been succesfull</returns> public bool BookmarkDonor(BookmarkedDonor bookmark) { try { UsersAutDataContext context = new UsersAutDataContext(); context.BookmarkedDonors.InsertOnSubmit(bookmark); context.SubmitChanges(); return true; } catch { return false; } }
public bool UnBookmarkDonor(string idUser, long donorID) { try { UsersAutDataContext context = new UsersAutDataContext(); List<BookmarkedDonor> list = (from a in context.BookmarkedDonors where (a.User_ID == idUser && a.Donor_ID == donorID) select a).ToList<BookmarkedDonor>(); if (list != null && list.Count > 0) { context.BookmarkedDonors.DeleteOnSubmit(list[0]); context.SubmitChanges(); } return true; } catch { return false; } return false; }