Пример #1
0
        /// <summary>
        /// 作者登录
        /// </summary>
        /// <param name="loginAuthor"></param>
        /// <returns></returns>
        public AuthorInfoEntity AuthorLogin(AuthorInfoQuery queryAuthor)
        {
            HttpClientHelper clientHelper = new HttpClientHelper();
            AuthorInfoEntity authorEntity = clientHelper.PostAuth<AuthorInfoEntity, AuthorInfoQuery>(GetAPIUrl(APIConstant.AUTHORLOGIN), queryAuthor);
            if (authorEntity != null)
            {
                if (authorEntity.Pwd == WKT.Common.Security.MD5Handle.Encrypt(queryAuthor.Pwd))
                {
                    # region 设置该用户的角色列表

                    RoleAuthorQuery roleAuthorQuery = new RoleAuthorQuery();
                    roleAuthorQuery.JournalID = queryAuthor.JournalID;
                    roleAuthorQuery.AuthorID = authorEntity.AuthorID;
                    IList<RoleAuthorEntity> roleAuthorList = clientHelper.PostAuth<IList<RoleAuthorEntity>, RoleAuthorQuery>(GetAPIUrl(APIConstant.AUTHORGETROLELIST), roleAuthorQuery);
                    if (roleAuthorList != null && roleAuthorList.Count > 0)
                    {
                        authorEntity.RoleIDList = roleAuthorList.Select(p => p.RoleID).ToList<long>();
                        authorEntity.RoleID = authorEntity.RoleIDList[0];
                    }
                    # endregion
                    if (authorEntity.RoleIDList == null)
                    {
                        authorEntity.RoleIDList = new List<long> { -1};
                    }

                    return authorEntity;
                }
                else
                {
                    return null;
                }
            }
 /// <summary>
 /// 获取一个实体对象
 /// </summary>
 /// <param name="mapID"></param>
 /// <returns></returns>
 public RoleAuthorEntity GetRoleAuthor(long mapID)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     RoleAuthorQuery roleAuthorQuery = new RoleAuthorQuery();
     roleAuthorQuery.MapID = mapID;
     RoleAuthorEntity roleAuthorEntity = clientHelper.PostAuth<RoleAuthorEntity, RoleAuthorQuery>(GetAPIUrl(APIConstant.GETROLEAUTHORLIST), roleAuthorQuery);
     return roleAuthorEntity;
 }
 public Pager<RoleAuthorEntity> GetRoleAuthorPageList(RoleAuthorQuery roleAuthorQuery)
 {
     IRoleAuthorService service = ServiceContainer.Instance.Container.Resolve<IRoleAuthorService>();
     Pager<RoleAuthorEntity> pager = service.GetRoleAuthorPageList(roleAuthorQuery);
     return pager;
 }
 public IList<RoleAuthorEntity> GetRoleAuthorList(RoleAuthorQuery roleAuthorQuery)
 {
     IRoleAuthorService service = ServiceContainer.Instance.Container.Resolve<IRoleAuthorService>();
     IList<RoleAuthorEntity> list = service.GetRoleAuthorList(roleAuthorQuery);
     return list;
 }
Пример #5
0
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="roleAuthorQuery">RoleAuthorQuery查询实体对象</param>
 /// <returns>Pager<RoleAuthorEntity></returns>
 public Pager<RoleAuthorEntity> GetRoleAuthorPageList(RoleAuthorQuery roleAuthorQuery)
 {
     return RoleAuthorBusProvider.GetRoleAuthorPageList(roleAuthorQuery);
 }
Пример #6
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="roleAuthorQuery">RoleAuthorQuery查询实体对象</param>
 /// <returns>List<RoleAuthorEntity></returns>
 public List<RoleAuthorEntity> GetRoleAuthorList(RoleAuthorQuery roleAuthorQuery)
 {
     return RoleAuthorBusProvider.GetRoleAuthorList(roleAuthorQuery);
 }
Пример #7
0
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string RoleAuthorQueryToSQLWhere(RoleAuthorQuery query)
 {
     StringBuilder sbWhere = new StringBuilder(" JournalID = " + query.JournalID);
     if (query.AuthorID != null)
     {
         sbWhere.Append(" AND AuthorID = ").Append(query.AuthorID.Value).Append("");
     }
     if (query.RoleID != null)
     {
         sbWhere.Append(" AND RoleID = ").Append(query.RoleID.Value).Append("");
     }
     return sbWhere.ToString();
 }
Пример #8
0
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string RoleAuthorQueryToSQLOrder(RoleAuthorQuery query)
 {
     if (query.OrderStr != null)
         return query.OrderStr;
     else
         return " MapID ASC";
 }
Пример #9
0
 public Pager<RoleAuthorEntity> GetRoleAuthorPageList(RoleAuthorQuery query)
 {
     int recordCount=0;
     string whereSQL=RoleAuthorQueryToSQLWhere(query);
     string orderBy=RoleAuthorQueryToSQLOrder(query);
     DataSet ds=db.GetPagingData("RoleAuthor","MapID,JournalID,RoleID,AuthorID,AddDate",orderBy,whereSQL,query.CurrentPage,query.PageSize,out recordCount);
     Pager<RoleAuthorEntity>  pager=new Pager<RoleAuthorEntity>();
     if(ds!=null && ds.Tables.Count>0)
     {
          pager.ItemList= MakeRoleAuthorList(ds.Tables[0]);
     }
     pager.CurrentPage=query.CurrentPage;
     pager.PageSize=query.PageSize;
     pager.TotalRecords=recordCount;
     return pager;
 }
Пример #10
0
 public List<RoleAuthorEntity> GetRoleAuthorList(RoleAuthorQuery query)
 {
     List<RoleAuthorEntity> list = new List<RoleAuthorEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT MapID,JournalID,RoleID,AuthorID,AddDate FROM dbo.RoleAuthor WITH(NOLOCK)");
     string whereSQL = RoleAuthorQueryToSQLWhere(query);
     string orderBy=RoleAuthorQueryToSQLOrder(query);
     if(!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     if(!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using(IDataReader dr = db.ExecuteReader(cmd))
     {
         list = MakeRoleAuthorList(dr);
     }
     return list;
 }
Пример #11
0
 public List<RoleAuthorEntity> GetRoleAuthorDetailList(RoleAuthorQuery query)
 {
     List<RoleAuthorEntity> list = new List<RoleAuthorEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append(@"SELECT MapID,RA.JournalID,RA.AuthorID,AI.LoginName,AI.RealName,RA.RoleID,RI.RoleName,RA.AddDate FROM dbo.RoleAuthor RA WITH(NOLOCK)
                             LEFT JOIN dbo.AuthorInfo AI WITH(NOLOCK) ON RA.AuthorID=AI.AuthorID AND AI.Status=1
                             LEFT JOIN dbo.RoleInfo RI WITH(NOLOCK) ON RA.JournalID=RI.JournalID AND RA.RoleID=RI.RoleID ");
     string whereSQL = RoleAuthorDetailQueryToSQLWhere(query);
     string orderBy = RoleAuthorQueryToSQLOrder(query);
     if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
     if (!string.IsNullOrEmpty(orderBy)) sqlCommandText.Append(" ORDER BY " + orderBy);
     DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         list = MakeRoleAuthorDetailList(dr);
     }
     return list;
 }
 /// <summary>
 /// 根据条件获取所有实体对象(包含角色名称)
 /// </summary>
 /// <param name="roleAuthorQuery"></param>
 /// <returns></returns>
 public IList<RoleAuthorEntity> GetRoleAuthorDetailList(RoleAuthorQuery roleAuthorQuery)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<RoleAuthorEntity> roleAuthorList = clientHelper.PostAuth<IList<RoleAuthorEntity>, RoleAuthorQuery>(GetAPIUrl(APIConstant.GETROLEAUTHORDETAILLIST), roleAuthorQuery);
     return roleAuthorList;
 }
 public Pager<RoleAuthorEntity> GetRoleAuthorPageList(RoleAuthorQuery roleAuthorQuery)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<RoleAuthorEntity> RoleAuthorPageList = clientHelper.PostAuth<Pager<RoleAuthorEntity>, RoleAuthorQuery>(GetAPIUrl(APIConstant.GETROLEAUTHORPAGELIST), roleAuthorQuery);
     return RoleAuthorPageList;
 }
Пример #14
0
 public IList<RoleAuthorEntity> GetAuthorRoleList(RoleAuthorQuery authorQuery)
 {
     try
     {
         IRoleAuthorService roleAuthorService = ServiceContainer.Instance.Container.Resolve<IRoleAuthorService>();
         IList<RoleAuthorEntity> listAuthor = roleAuthorService.GetRoleAuthorList(authorQuery);
         return listAuthor;
     }
     catch (Exception ex)
     {
         LogProvider.Instance.Error("作者登录出现异常:" + ex.Message);
         throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.Message));
     }
 }
Пример #15
0
        public string RoleAuthorDetailQueryToSQLWhere(RoleAuthorQuery query)
        {
            StringBuilder sbWhere = new StringBuilder(" RA.JournalID = " + query.JournalID);
            if (query.AuthorID != null)
            {
                sbWhere.Append(" AND RA.AuthorID = ").Append(query.AuthorID.Value).Append("");
            }

            if (query.RealName != null)
            {
                sbWhere.Append(" AND RealName like '%").Append(query.RealName).Append("%'");
            }

            if (query.GroupID != null)
            {
                sbWhere.Append(" AND AI.GroupID = ").Append(query.GroupID.Value).Append("");
            }

            if (query.RoleID != null)
            {
                sbWhere.Append(" AND RI.RoleID = ").Append(query.RoleID.Value).Append("");
            }

            if (query.RoleID != null)
            {
                sbWhere.Append(" AND RA.RoleID = ").Append(query.RoleID.Value).Append("");
            }
            if (query.RoleName != null)
            {
                sbWhere.Append(" AND RI.RoleName = ").Append(query.RoleName).Append("");
            }
            return sbWhere.ToString();
        }
Пример #16
0
        public ExecResult SetAurhoRole(RoleAuthorEntity roleAuthorEntity)
        {
            ExecResult result = new ExecResult();
            try
            {
                RoleAuthorQuery roleAuthorQuery = new RoleAuthorQuery();
                roleAuthorQuery.AuthorID = roleAuthorEntity.AuthorID;
                roleAuthorQuery.JournalID = roleAuthorEntity.JournalID;
                roleAuthorQuery.RoleID = roleAuthorEntity.RoleID;

                IRoleAuthorService roleAuthorService = ServiceContainer.Instance.Container.Resolve<IRoleAuthorService>();
                List<RoleAuthorEntity> checkIsExist = roleAuthorService.GetRoleAuthorList(roleAuthorQuery);
                if (checkIsExist != null && checkIsExist.Count > 0)
                {
                    result.result = EnumJsonResult.success.ToString();
                    result.msg = "成功";
                }
                else
                {
                    bool flag = roleAuthorService.AddRoleAuthor(roleAuthorEntity);
                    if (flag)
                    {
                        result.result = EnumJsonResult.success.ToString();
                        result.msg = "成功";
                    }
                    else
                    {
                        result.result = EnumJsonResult.failure.ToString();
                        result.msg = "设置作者角色失败,请确认作者信息是否正确";
                    }
                }
            }
            catch (Exception ex)
            {
                result.result = EnumJsonResult.error.ToString();
                result.msg = "设置作者角色时出现异常:" + ex.Message;
            }
            return result;
        }
Пример #17
0
 /// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="roleAuthorQuery">RoleAuthorQuery查询实体对象</param>
 /// <returns>List<RoleAuthorEntity></returns>
 public List<RoleAuthorEntity> GetRoleAuthorList(RoleAuthorQuery roleAuthorQuery)
 {
     return RoleAuthorDataAccess.Instance.GetRoleAuthorList(roleAuthorQuery);
 }