示例#1
0
        public static string resetPassword(ERP_CMSEntities cntx, int UserID)
        {
            var    usr         = cntx.Users.Find(UserID);
            string UserName    = usr.UserName;
            string newPassword = EncryptionHelper.Encrypt("ERP_CMS2k18", UserName + "@12345");

            usr.Password = newPassword;
            cntx.SaveChanges();
            return(newPassword);
        }
示例#2
0
        public static bool isUserAdmin(ERP_CMSEntities cntx, int userID)
        {
            // bool isAdmin = false;
            bool isAdmin = (bool)(from d in cntx.Users
                                  where d.UserID == userID
                                  select d.IsAdmin).FirstOrDefault();

            //isAdmin = Convert.ToBoolean(chkAdmin);
            return(isAdmin);
        }
示例#3
0
        public static bool fnHaveRights(int intUserID, int intMenuLink)
        {
            bool haveRights = false;

            using (ERP_CMSEntities cntx = new ERP_CMSEntities())
            {
                var objUserLinks = cntx.UserLinks.Where(f => f.UserID == intUserID && f.MenuLinkID == intMenuLink).ToList().FirstOrDefault();
                if (objUserLinks != null)
                {
                    haveRights = true;
                }
            }
            return(haveRights);
        }