Пример #1
0
        /// <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();
        }
Пример #2
0
 /// <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;
 }
Пример #3
0
        /// <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);
        }
Пример #4
0
        /// <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();
        }
Пример #5
0
        /// <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();
        }
Пример #6
0
 /// <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;
     }
 }
Пример #7
0
 /// <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);
     }
 }
Пример #8
0
 /// <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);
     }
 }
Пример #9
0
 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);
 }
Пример #10
0
        /// <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);
        }
Пример #11
0
        /// <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;
        }
Пример #12
0
        /// <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();

            }
        }
Пример #13
0
 /// <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();
 }
Пример #14
0
 /// <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();
 }
Пример #15
0
 /// <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;
     }
 }
Пример #16
0
 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;
 }