示例#1
0
        private bool ValidateUser(string userName, string passWord)
        {
            EPE.Common.Entities.Page.Page usersPage = DAOFactory.Instance.GetPageInfoDAO().GetPageConfig("", "Users");
            Entity entity = EntityUtils.CreateEntity(usersPage);

            entity.SetProperty("USE_Login", userName);
            entity.SetProperty("USE_Password", passWord);

            IList <Entity> list = DAOFactory.Instance.GetCatalogDAO().FindEntities(entity, FilterInfo.SearchType.AND);

            if (list.Count == 1)
            {
                Session["CurrentUser"]      = list[0];
                Session["CurrentUserLogin"] = userName;
                return(true);
            }

            return(false);
        }
示例#2
0
        private Entity GetUser(string userLogin)
        {
            if (string.IsNullOrEmpty(userLogin))
            {
                return(null);
            }

            if (Session["CurrentUser"] == null)
            {
                EPE.Common.Entities.Page.Page usersPage = DAOFactory.Instance.GetPageInfoDAO().GetPageConfig("", "Users");
                Entity entity = EntityUtils.CreateEntity(usersPage);
                entity.SetProperty("USE_Login", userLogin);

                IList <Entity> list = DAOFactory.Instance.GetCatalogDAO().FindEntities(entity);
                if (list.Count == 1)
                {
                    Session["CurrentUser"] = list[0];
                    Entity user = (Entity)Session["CurrentUser"];
                    Session["CurrentUserName"] = user.GetProperty("USE_Name");
                }
            }

            return((Entity)Session["CurrentUser"]);
        }