示例#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;
 }