Ejemplo n.º 1
0
        /// <summary>
        /// 激活用户通过用户模型
        /// </summary>
        /// <param name="model">用户模型</param>
        public void RefreshAccountByAccount(ForbiddenAccountDspModel model)
        {
            IRepository <ForbiddenAccount> accRep = Factory.Factory <IRepository <ForbiddenAccount> > .GetConcrete <ForbiddenAccount>();

            ForbiddenAccount fac = new ForbiddenAccount()
            {
                AccountID = model.AccountID, ForbiddenTime = model.ForbiddenTime, ForbiddenType = model.ForbiddenType, IP = model.IP, RefreshTime = model.RefreshTime, State = model.State, UserName = model.UserName
            };

            accRep.Update(fac);
            accRep.PersistAll();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 禁用账户通过用户模型
        /// </summary>
        /// <param name="model">用户模型</param>
        /// <returns></returns>
        public bool ForbiddenAccountByAccount(ForbiddenAccountDspModel model)
        {
            IRepository <ForbiddenAccount> accRep = Factory.Factory <IRepository <ForbiddenAccount> > .GetConcrete <ForbiddenAccount>();

            ForbiddenAccount ak = accRep.Find(new Specification <ForbiddenAccount>(uf => uf.AccountID == model.AccountID));

            if (ak == null)
            {
                ForbiddenAccount fac = new ForbiddenAccount(model.AccountID, model.UserName, model.IP, model.ForbiddenTime, model.RefreshTime, model.State, model.ForbiddenType);
                accRep.Add(fac);
                accRep.PersistAll();
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取禁用列表
        /// </summary>
        /// <param name="index"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public IList <ForbiddenAccountDspModel> FetchForbiddenAccountDspModel(int index, int count)
        {
            IRepository <ForbiddenAccount> accRep = Factory.Factory <IRepository <ForbiddenAccount> > .GetConcrete <ForbiddenAccount>();

            IList <ForbiddenAccount> list = accRep.FindAll(new Specification <ForbiddenAccount>(uf => uf.ForbiddenId != Guid.Empty).Skip(index).Take(count).OrderByDescending(u => u.Id));

            IList <ForbiddenAccountDspModel> mylist = new List <ForbiddenAccountDspModel>();

            foreach (ForbiddenAccount ac in list)
            {
                ForbiddenAccountDspModel model = new ForbiddenAccountDspModel()
                {
                    AccountID = ac.AccountID, ForbiddenID = ac.ForbiddenId, UserName = ac.UserName, State = ac.State, RefreshTime = ac.RefreshTime, ForbiddenTime = ac.ForbiddenTime, IP = ac.IP, ForbiddenType = ac.ForbiddenType
                };
                mylist.Add(model);
            }
            return(mylist);
        }