public ExecResult DeleteMember(AuthorInfoQuery authorQuery)
 {
     ExecResult result = new ExecResult();
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         bool flag = authorService.BatchDeleteAuthorInfo(authorQuery);
         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;
 }
        /// <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;
                }
            }
Example #3
0
 public ActionResult GetAuthorList(AuthorInfoQuery query)
 {
     IAuthorFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorFacadeService>();
     query.JournalID = JournalID;
     query.GroupID = (int)EnumMemberGroup.Author;
     int pageIndex = TypeParse.ToInt(Request.Params["page"], 1);
     query.CurrentPage = pageIndex;
     query.PageSize = TypeParse.ToInt(Request.Params["pagesize"], 10);
     Pager<AuthorInfoEntity> pager = service.GetMemberInfoList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
Example #4
0
 /// <summary>
 /// 获取作者列表
 /// </summary>
 /// <returns></returns>
 public ActionResult AuthorSearchList(string RealName)
 {
     IAuthorFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorFacadeService>();
     AuthorInfoQuery query = new AuthorInfoQuery();
     query.RealName = Server.UrlDecode(RealName);
     query.JournalID = JournalID;
     query.GroupID = (int)EnumMemberGroup.Author;
     query.CurrentPage = 1;
     query.PageSize = 10;
     Pager<AuthorInfoEntity> pager = service.GetMemberInfoList(query);
     var filteredItems = pager.ItemList.Select(p => new { RealName=p.RealName,AuthorID=p.AuthorID});
     return Json(filteredItems, JsonRequestBehavior.AllowGet);
 }
        public ActionResult DelOperationSetAjax(long[] IDAarry)
        {
            ExecResult exeResult = new ExecResult();
            if (IDAarry == null || IDAarry.Length == 0)
            {
                exeResult.msg = "请选择要删除的审稿操作";
                exeResult.result = EnumJsonResult.failure.ToString();
                return Content(JsonConvert.SerializeObject(exeResult));
            }
            AuthorInfoQuery authorQuery = new AuthorInfoQuery();
            authorQuery.JournalID = JournalID;
            authorQuery.AuthorIDList = IDAarry.ToList<long>();

            ISiteSystemFacadeService sysService = ServiceContainer.Instance.Container.Resolve<ISiteSystemFacadeService>();
            exeResult = sysService.DelMember(authorQuery);
            return Content(JsonConvert.SerializeObject(exeResult));
        }
Example #6
0
        public ActionResult GetContributionList(long SiteID, string EMail)
        {
            string contributions = string.Empty;

            //根据邮箱获取作者实体-得到作者ID
            IAuthorFacadeService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorFacadeService>();
            AuthorInfoQuery query = new AuthorInfoQuery();
            query.LoginName = EMail;
            query.JournalID = SiteID;
            query.GroupID = (int)EnumMemberGroup.Author;
            AuthorInfoEntity authorInfoEntity = authorService.GetAuthorInfo(query);

            //获取作者最新状态的稿件列表
            IFlowFacadeService flowService = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>();
            CirculationEntity cirEntity = new CirculationEntity();
            cirEntity.JournalID = SiteID;
            cirEntity.CurAuthorID = authorInfoEntity.AuthorID;
            //int pageIndex = TypeParse.ToInt(Request.Params["page"], 1);
            cirEntity.CurrentPage = 1;
            cirEntity.PageSize = TypeParse.ToInt(Request.Params["pagesize"], 100);
            Pager<FlowContribution> pager = flowService.GetAuthorContributionList(cirEntity);

            if (pager.ItemList.Count == 0)
            {
                return base.Json(new { code = "1000002", msg = "没有查询到符合条件的数据。" }, JsonRequestBehavior.AllowGet);//没有稿件数据
            }
            else if (pager.ItemList.Count == 1)
            {
                return base.Json(new { code = "1000003", msg = "查询到1条符合条件的数据。" }, JsonRequestBehavior.AllowGet);
            }
            else
            {
                contributions += "[";
                for (int i = 0; i < pager.ItemList.Count; i++)
                {
                    contributions += "{\"Title\":\"" + pager.ItemList[i].Title + "\",\"AuthorName\":\"" + pager.ItemList[i].AuthorName + "\",\"AuditStatus\":\"" + pager.ItemList[i].AuditStatus + "\",\"AddDate\":\"" + pager.ItemList[i].AddDate + "\"},";
                }
                contributions.Remove(contributions.LastIndexOf(','), 1);
                contributions += "]";
                return base.Json(new { code = "1000004", msg = "查询到" + pager.ItemList.Count + "条符合条件的数据。", Contributions = contributions }, JsonRequestBehavior.AllowGet);
            }
        }
 public AuthorInfoEntity GetAuthorInfo(AuthorInfoQuery query)
 {
     IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
     var authorEntity = authorService.GetAuthorInfo(query);
     return authorEntity;
 }
        /// <summary>
        /// 获取编辑部成员列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public Pager<AuthorInfoEntity> GetMemberInfoPageList(AuthorInfoQuery query)
        {
            int recordCount = 0;
            List<SqlParameter> listParameters = new List<SqlParameter>();
            string sql = "";
            StringBuilder sbSQL = new StringBuilder("SELECT a.AuthorID,a.JournalID,LoginName,Pwd,RealName,Mobile,LoginIP,LoginCount,LoginDate,Status,a.GroupID,a.AddDate,(SELECT ( SELECT ri.RoleName + ',' FROM dbo.RoleInfo ri WITH(NOLOCK) WHERE ISNULL(ra.RoleID,0)=ri.RoleID AND ra.AuthorID=a.AuthorID FOR XML PATH(''))) AS RoleList FROM dbo.AuthorInfo a WITH(NOLOCK) LEFT JOIN dbo.RoleAuthor ra ON a.AuthorID=ra.AuthorID AND a.JournalID=ra.JournalID WHERE a.JournalID=@JournalID");
            StringBuilder sbNoRole = new StringBuilder("SELECT a.AuthorID,a.JournalID,LoginName,Pwd,RealName,Mobile,LoginIP,LoginCount,LoginDate,Status,a.GroupID,a.AddDate,(SELECT ( SELECT ri.RoleName + ',' FROM dbo.RoleInfo ri WITH(NOLOCK) INNER JOIN dbo.RoleAuthor ra WITH(NOLOCK) ON ri.RoleID=ra.RoleID AND ri.JournalID=ra.JournalID WHERE ra.AuthorID=a.AuthorID FOR XML PATH(''))) AS RoleList FROM dbo.AuthorInfo a WITH(NOLOCK) WHERE a.JournalID=@JournalID");
            SqlParameter pJournalID = new SqlParameter("@JournalID", SqlDbType.BigInt);
            pJournalID.Value = query.JournalID;
            listParameters.Add(pJournalID);
            if (!string.IsNullOrEmpty(query.LoginName))
            {
                // SqlParameter p2 = new SqlParameter("@LoginName", SqlDbType.VarChar, 100);
                //  p2.Value = query.LoginName;
                // listParameters.Add(p2);
                //sbSQL.Append(" AND LoginName=@LoginName");
                sbNoRole.Append(" AND LoginName like '%" + query.LoginName + "%'");
            }
            if (!string.IsNullOrEmpty(query.RealName))
            {
                sbSQL.Append(" AND RealName LIKE '%").Append(WKT.Common.Security.SecurityUtils.SafeSqlString(query.RealName)).Append("%'");
                sbNoRole.Append(" AND RealName LIKE '%").Append(WKT.Common.Security.SecurityUtils.SafeSqlString(query.RealName)).Append("%'");
            }
            if (query.GroupID != null)
            {
                SqlParameter pGroupID = new SqlParameter("@GroupID", SqlDbType.TinyInt);
                pGroupID.Value = query.GroupID.Value;
                listParameters.Add(pGroupID);
                sbSQL.Append(" AND a.GroupID=@GroupID");
                sbNoRole.Append(" AND a.GroupID=@GroupID");
            }
            if (query.Status != null)
            {
                SqlParameter pStatus = new SqlParameter("@Status", SqlDbType.TinyInt);
                pStatus.Value = query.Status.Value;
                listParameters.Add(pStatus);
                sbSQL.Append(" AND a.Status=@Status");
                sbNoRole.Append(" AND a.Status=@Status");
            }

            if (query.RoleID != null)
            {
                SqlParameter pRoleID = new SqlParameter("@RoleID", SqlDbType.BigInt);
                pRoleID.Value = query.RoleID;
                listParameters.Add(pRoleID);
                sbSQL.Append(" AND ra.RoleID=@RoleID");
                sql = sbSQL.ToString();
            }
            else
            {
                sql = sbNoRole.ToString();
            }

            DataSet ds = db.PageingQuery(query.CurrentPage, query.PageSize, sql, "a.AuthorID DESC", listParameters.ToArray(), ref recordCount);
            Pager<AuthorInfoEntity> pager = new Pager<AuthorInfoEntity>();
            if (ds != null && ds.Tables.Count > 0)
            {
                List<AuthorInfoEntity> list = new List<AuthorInfoEntity>();
                if (ds != null)
                {
                    AuthorInfoEntity authorInfoEntity = null;
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        authorInfoEntity = new AuthorInfoEntity();
                        authorInfoEntity.AuthorID = (Int64)row["AuthorID"];
                        authorInfoEntity.JournalID = (Int64)row["JournalID"];
                        authorInfoEntity.LoginName = (String)row["LoginName"];
                        authorInfoEntity.RealName = row["RealName"]==System.DBNull.Value?"无姓名":(String)row["RealName"];
                        authorInfoEntity.Mobile = row["Mobile"]==System.DBNull.Value?"":(String)row["Mobile"];
                        authorInfoEntity.LoginIP = row["LoginIP"]==System.DBNull.Value?"127.0.0.1":(String)row["LoginIP"];
                        authorInfoEntity.LoginCount = (Int32)row["LoginCount"];
                        authorInfoEntity.LoginDate = (DateTime)row["LoginDate"];
                        authorInfoEntity.GroupID = (Byte)row["GroupID"];
                        authorInfoEntity.Status = (Byte)row["Status"];
                        authorInfoEntity.RoleName = row.IsNull("RoleList") ? "" : row["RoleList"].ToString();
                        if (!string.IsNullOrEmpty(authorInfoEntity.RoleName))
                        {
                            authorInfoEntity.RoleName = authorInfoEntity.RoleName.Remove(authorInfoEntity.RoleName.Length - 1);
                        }
                        authorInfoEntity.AddDate = (DateTime)row["AddDate"];
                        list.Add(authorInfoEntity);
                    }
                }
                pager.ItemList = list;
            }
            pager.CurrentPage = query.CurrentPage;
            pager.PageSize = query.PageSize;
            pager.TotalRecords = recordCount;
            return pager;
        }
Example #9
0
 public ActionResult GetExpertList(AuthorInfoQuery query)
 {
     IAuthorFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorFacadeService>();
     query.JournalID = CurAuthor.JournalID;
     if (query.GroupID == null) query.GroupID = 0;
     if (query.GroupID.Value == 0)
         query.GroupID = CurAuthor.GroupID;
     else
         query.GroupID = null;
     int pageIndex = TypeParse.ToInt(Request.Params["page"], 1);
     query.CurrentPage = pageIndex;
     query.PageSize = TypeParse.ToInt(Request.Params["pagesize"], 10);
     Pager<AuthorInfoEntity> pager = service.GetExpertPageList(query);
     return Json(new { Rows = pager.ItemList, Total = pager.TotalRecords });
 }
 /// <summary>
 /// 获取作者信息
 /// </summary>
 /// <param name="AuthorID"></param>
 /// <returns></returns>
 private AuthorInfoEntity GetAuthorInfoModel(Int64 AuthorID)
 {
     IAuthorFacadeService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorFacadeService>();
     AuthorInfoQuery authorQuery = new AuthorInfoQuery();
     authorQuery.JournalID = JournalID;
     authorQuery.AuthorID = AuthorID;
     var model = authorService.GetAuthorInfo(authorQuery);
     return model;
 }
        public ExecResult Reg(AuthorInfoEntity authorEntity)
        {
            ExecResult execResult = new ExecResult();
            try
            {
                IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();

                AuthorInfoQuery queryAuthor = new AuthorInfoQuery();
                queryAuthor.LoginName = authorEntity.LoginName;
                queryAuthor.JournalID = authorEntity.JournalID;

                IList<AuthorInfoEntity> list = authorService.GetAuthorInfoList(queryAuthor);
                if (list != null && list.Count > 0)
                {
                    execResult.result = EnumJsonResult.failure.ToString();
                    execResult.msg = "该登录邮箱已经存在";
                }
                else
                {

                    authorEntity.Pwd = WKT.Common.Security.MD5Handle.Encrypt(authorEntity.Pwd);
                    authorService.AddAuthorInfo(authorEntity);
                    execResult.result = EnumJsonResult.success.ToString();
                    execResult.msg = "注册成功";
                }
            }
            catch (Exception ex)
            {
                execResult.result = EnumJsonResult.error.ToString();
                execResult.msg = "注册失败:" + ex.Message;
                LogProvider.Instance.Error("作者注册出现异常:" + ex.Message);
            }
            return execResult;
        }
 public Pager<AuthorInfoEntity> GetMemberInfoList(AuthorInfoQuery authorQueryEntity)
 {
     Pager<AuthorInfoEntity> pagerMember = new Pager<AuthorInfoEntity>();
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         pagerMember = authorService.GetMemberInfoPageList(authorQueryEntity);
     }
     catch (Exception ex)
     {
         pagerMember = null;
         WKT.Log.LogProvider.Instance.Error("获取编辑部成员列表信息时出现异常:" + ex.Message);
     }
     return pagerMember;
 }
 public IDictionary<long, string> GetMemberDict(AuthorInfoQuery authoerQuery)
 {
     IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
     return authorService.GetAuthorDict(authoerQuery);
 }
        /// <summary>
        /// 获取作者信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public AuthorInfoEntity GetAuthorInfo(AuthorInfoQuery query)
        {
            AuthorInfoEntity authorInfoEntity = null;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("SELECT TOP 1  AuthorID,JournalID,LoginName,Pwd,RealName,Mobile,LoginIP,LoginCount,LoginDate,GroupID,Status,AddDate FROM dbo.AuthorInfo WITH(NOLOCK)");
            string whereSQL = AuthorInfoQueryToSQLWhere(query);
            if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                authorInfoEntity = MakeAuthorInfo(dr);
            }
            return authorInfoEntity;
        }
 /// <summary>
 /// 获取人员数据字典
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IDictionary<Int64, String> GetAuthorDict(AuthorInfoQuery query)
 {
     IDictionary<Int64, String> dict = new Dictionary<Int64, String>();
     string strSql = "SELECT AuthorID,RealName FROM dbo.AuthorInfo with(nolock) WHERE " + AuthorInfoQueryToSQLWhere(query);
     DbCommand cmd = db.GetSqlStringCommand(strSql);
     using (IDataReader dr = db.ExecuteReader(cmd))
     {
         Int64 id = 0;
         while (dr.Read())
         {
             id = (Int64)dr["AuthorID"];
             if (!dict.ContainsKey(id))
                 dict.Add(id, (String)dr["RealName"]);
         }
         dr.Close();
     }
     return dict;
 }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="authorID">作者信息</param>
        /// <returns>true:删除成功 false:删除失败</returns>
        public bool BatchDeleteAuthorInfo(AuthorInfoQuery authorQuery)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.AppendFormat("DELETE FROM dbo.AuthorInfo WHERE AuthorID IN ({0}) AND JournalID=@JournalID", string.Join(",", authorQuery.AuthorIDList));

            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, authorQuery.JournalID);
            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }

            return flag;
        }
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string AuthorInfoQueryToSQLWhere(AuthorInfoQuery query)
 {
     StringBuilder sbWhere = new StringBuilder(" JournalID = " + query.JournalID);
     if (query.AuthorID != null)
     {
         sbWhere.Append(" AND AuthorID = " + query.AuthorID);
     }
     else
     {
         if (!string.IsNullOrWhiteSpace(query.LoginName))
         {
             sbWhere.Append(" AND LoginName = '").Append(WKT.Common.Security.SecurityUtils.SafeSqlString(query.LoginName)).Append("'");
         }
         if (!string.IsNullOrWhiteSpace(query.Pwd))
         {
             sbWhere.Append(" AND Pwd = '").Append(WKT.Common.Security.MD5Handle.Encrypt(query.Pwd)).Append("'");
         }
         if (query.Status != null)
         {
             sbWhere.Append(" AND Status = '").Append(query.Status.Value).Append("'");
         }
         if (query.GroupID != null)
         {
             sbWhere.Append(" AND GroupID = '").Append(query.GroupID.Value).Append("'");
         }
         if (query.AuthorIDs != null && query.AuthorIDs.Length > 0)
         {
             if (query.AuthorIDs.Length == 1)
                 sbWhere.AppendFormat(" AND AuthorID = {0}", query.AuthorIDs[0]);
             else
                 sbWhere.AppendFormat(" AND AuthorID in ({0})", string.Join(",", query.AuthorIDs));
         }
     }
     return sbWhere.ToString();
 }
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string AuthorInfoQueryToSQLOrder(AuthorInfoQuery query)
 {
     return " AuthorID DESC";
 }
 public IList<AuthorInfoEntity> GetAuthorInfoListByRole(AuthorInfoQuery authorQuery)
 {
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         IList<AuthorInfoEntity> listAuthor = authorService.GetAuthorInfoListByRole(authorQuery);
         return listAuthor;
     }
     catch (Exception ex)
     {
         LogProvider.Instance.Error("作者登录出现异常:" + ex.Message);
         throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.ExpectationFailed, ex.Message));
     }
 }
 public List<AuthorInfoEntity> GetAuthorInfoList(AuthorInfoQuery query)
 {
     List<AuthorInfoEntity> list = new List<AuthorInfoEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT AuthorID,JournalID,LoginName,Pwd,RealName,Mobile,LoginIP,LoginCount,LoginDate,Status,GroupID,AddDate FROM dbo.AuthorInfo WITH(NOLOCK)");
     string whereSQL = AuthorInfoQueryToSQLWhere(query);
     string orderBy = AuthorInfoQueryToSQLOrder(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 = MakeAuthorInfoList(dr);
     }
     return list;
 }
 public Pager<AuthorInfoEntity> GetExpertPageList(AuthorInfoQuery query)
 {
     Pager<AuthorInfoEntity> pagerExpert = new Pager<AuthorInfoEntity>();
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         pagerExpert = authorService.GetExpertPageList(query);
     }
     catch (Exception ex)
     {
         pagerExpert = null;
         WKT.Log.LogProvider.Instance.Error("获取专家列表时出现异常:" + ex.Message);
     }
     return pagerExpert;
 }
        /// <summary>
        /// 根据角色获取作者列表
        /// </summary>
        /// <param name="authorInfoQuery">AuthorInfoQuery查询实体对象</param>
        /// <returns>List<AuthorInfoEntity></returns>
        public List<AuthorInfoEntity> GetAuthorInfoListByRole(AuthorInfoQuery authorInfoQuery)
        {
            List<AuthorInfoEntity> list = new List<AuthorInfoEntity>();
            string sql = @"SELECT a.AuthorID,a.JournalID,LoginName,Pwd,RealName,a.Mobile,LoginIP,LoginCount,LoginDate,Status,a.GroupID,a.AddDate ,b.RoleID,c.RoleName
                            FROM dbo.AuthorInfo a WITH(NOLOCK),dbo.RoleAuthor b WITH(NOLOCK),dbo.RoleInfo as c
                            WHERE a.JournalID=@JournalID AND a.GroupID=@GroupID and b.RoleID=c.RoleID and a.GroupID=c.GroupID  AND a.AuthorID=b.AuthorID AND a.JournalID=b.JournalID ";
            if (authorInfoQuery.RoleID >0)
            {
                sql += " and b.RoleID=@RoleID";
            }
            DbCommand cmd = db.GetSqlStringCommand(sql.ToString());
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, authorInfoQuery.JournalID);
            db.AddInParameter(cmd, "@GroupID", DbType.Byte, authorInfoQuery.GroupID);
            if (authorInfoQuery.RoleID > 0)
            {
                db.AddInParameter(cmd, "@RoleID", DbType.Int64, authorInfoQuery.RoleID.Value);

            }
            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                list = MakeAuthorInfoList(dr);
            }
            return list;
        }
 public AuthorInfoEntity GetMemberInfo(AuthorInfoQuery authorQueryEntity)
 {
     AuthorInfoEntity authorEntity = new AuthorInfoEntity();
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         authorEntity = authorService.GetMemberInfo(authorQueryEntity);
     }
     catch (Exception ex)
     {
         authorEntity = null;
         WKT.Log.LogProvider.Instance.Error("获取编辑部成员信息出现异常:" + ex.Message);
     }
     return authorEntity;
 }
Example #24
0
 /// <summary>
 /// 组装数据
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 private List<DictValueEntity> GetDictValueList(List<DictValueEntity> list, DictValueQuery dictValueQuery)
 {
     if (list == null || list.Count == 0)
         return list;
     AuthorInfoService service = new AuthorInfoService();
     AuthorInfoQuery query = new AuthorInfoQuery();
     query.JournalID = dictValueQuery.JournalID;
     var dict = service.AuthorInfoBusProvider.GetAuthorDict(query);
     foreach (var mode in list)
     {
         mode.InUserName = dict.GetValue(mode.InUserID, mode.InUserID.ToString());
     }
     return list;
 }
 public AuthorInfoEntity Login(AuthorInfoQuery authorQuery)
 {
     try
     {
         IAuthorInfoService authorService = ServiceContainer.Instance.Container.Resolve<IAuthorInfoService>();
         IList<AuthorInfoEntity> listAuthor = authorService.GetAuthorInfoList(authorQuery);
         if (listAuthor != null && listAuthor.Count == 1)
         {
             return listAuthor[0];
         }
         return null;
     }
     catch (Exception ex)
     {
         LogProvider.Instance.Error("作者登录出现异常:" + ex.Message);
         throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.ExpectationFailed,ex.Message));
     }
 }
        /// <summary>
        /// 获取专家列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public Pager<AuthorInfoEntity> GetExpertPageList(AuthorInfoQuery query)
        {
            int recordCount = 0;
            string sql = "";
            //            string sql = @"
            //                        SELECT ai.AuthorID,ai.Mobile,ai.LoginName,ai.RealName,
            //                        (SELECT ( SELECT dv.ValueText + ','
            //	                        FROM dbo.ExpertGroupMap e WITH(NOLOCK)
            //	                        INNER JOIN dbo.DictValue dv WITH(NOLOCK) ON e.ExpertGroupID=dv.ValueID AND ai.AuthorID=e.AuthorID AND ai.JournalID=e.JournalID
            //	                        WHERE dv.DictKey='ExpertGroupMap' AND dv.JournalID=ai.JournalID FOR XML PATH(''))) AS ExpertList,
            //	                        (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=0) AS AuditCount,
            //                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=1) AS AuditedCount
            //                        FROM dbo.AuthorInfo ai WITH(NOLOCK) INNER JOIN dbo.AuthorDetail ad WITH(NOLOCK) ON ai.AuthorID=ad.AuthorID AND ai.JournalID=ad.JournalID
            //                        WHERE ai.JournalID=@JournalID AND ai.GroupID=3 {0}
            //                        UNION
            //                        SELECT ai.AuthorID,ai.Mobile,ai.LoginName,ai.RealName,
            //                        (SELECT ( SELECT dv.ValueText + ','
            //	                        FROM dbo.ExpertGroupMap e WITH(NOLOCK)
            //	                        INNER JOIN dbo.DictValue dv WITH(NOLOCK) ON e.ExpertGroupID=dv.ValueID AND ai.AuthorID=e.AuthorID AND ai.JournalID=e.JournalID
            //	                        WHERE dv.DictKey='ExpertGroupMap' AND dv.JournalID=ai.JournalID FOR XML PATH(''))) AS ExpertList,
            //	                        (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=0) AS AuditCount,
            //                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=1) AS AuditedCount
            //                        FROM dbo.AuthorInfo ai WITH(NOLOCK) INNER JOIN dbo.RoleAuthor ra WITH(NOLOCK) ON ai.AuthorID=ra.AuthorID AND ai.JournalID=ra.JournalID AND ra.RoleID=3
            //                                 INNER JOIN dbo.AuthorDetail ad WITH(NOLOCK) ON ai.AuthorID=ad.AuthorID AND ai.JournalID=ad.JournalID
            //                        WHERE ai.JournalID=@JournalID {0}";
            //2014-1-15 文海峰

            if (query.IsSelEnExpert == true)
            {
                sql = @"
                        SELECT ai.AuthorID,ai.Mobile,ai.LoginName,ai.RealName,ad.ResearchTopics,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=0) AS AuditCount,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=1) AS AuditedCount
                        FROM dbo.AuthorInfo ai WITH(NOLOCK) INNER JOIN dbo.AuthorDetail ad WITH(NOLOCK) ON ai.AuthorID=ad.AuthorID AND ai.JournalID=ad.JournalID
                        WHERE ai.JournalID=@JournalID AND ai.GroupID=4 {0}
                        UNION
                        SELECT ai.AuthorID,ai.Mobile,ai.LoginName,ai.RealName,ad.ResearchTopics,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=0) AS AuditCount,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=1) AS AuditedCount
                        FROM dbo.AuthorInfo ai WITH(NOLOCK) INNER JOIN dbo.RoleAuthor ra WITH(NOLOCK) ON ai.AuthorID=ra.AuthorID AND ai.JournalID=ra.JournalID AND ra.RoleID=4
                                 INNER JOIN dbo.AuthorDetail ad WITH(NOLOCK) ON ai.AuthorID=ad.AuthorID AND ai.JournalID=ad.JournalID
                        WHERE ai.JournalID=@JournalID {0}";
            }
            else
            {
                sql = @"
                        SELECT ai.AuthorID,ai.Mobile,ai.LoginName,ai.RealName,ad.ResearchTopics,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=0) AS AuditCount,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=1) AS AuditedCount
                        FROM dbo.AuthorInfo ai WITH(NOLOCK) INNER JOIN dbo.AuthorDetail ad WITH(NOLOCK) ON ai.AuthorID=ad.AuthorID AND ai.JournalID=ad.JournalID
                        WHERE ai.JournalID=@JournalID AND ai.GroupID=3 {0}
                        UNION
                        SELECT ai.AuthorID,ai.Mobile,ai.LoginName,ai.RealName,ad.ResearchTopics,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=0) AS AuditCount,
                            (SELECT COUNT(DISTINCT fi.CID) FROM dbo.FlowLogInfo fi WITH(NOLOCK) WHERE fi.RecUserID=ai.AuthorID AND fi.JournalID=ai.JournalID AND fi.Status=1) AS AuditedCount
                        FROM dbo.AuthorInfo ai WITH(NOLOCK) INNER JOIN dbo.RoleAuthor ra WITH(NOLOCK) ON ai.AuthorID=ra.AuthorID AND ai.JournalID=ra.JournalID AND ra.RoleID=3
                                 INNER JOIN dbo.AuthorDetail ad WITH(NOLOCK) ON ai.AuthorID=ad.AuthorID AND ai.JournalID=ad.JournalID
                        WHERE ai.JournalID=@JournalID {0}";
            }

            List<SqlParameter> listParameters = new List<SqlParameter>();
            SqlParameter pJournalID = new SqlParameter("@JournalID", SqlDbType.BigInt);
            pJournalID.Value = query.JournalID;
            listParameters.Add(pJournalID);
            string whereCondition = "";
            if (!string.IsNullOrEmpty(query.LoginName))
            {
                SqlParameter p2 = new SqlParameter("@LoginName", SqlDbType.VarChar, 100);
                p2.Value = query.LoginName;
                listParameters.Add(p2);
                whereCondition += " AND ai.LoginName like '%" + p2.Value + "%'";
            }

            //研究方向
            if (!string.IsNullOrEmpty(query.ResearchTopics))
            {
                whereCondition += " AND ad.ResearchTopics  LIKE '%" + WKT.Common.Security.SecurityUtils.SafeSqlString(query.ResearchTopics) + "%'";
            }
            if (!string.IsNullOrEmpty(query.RealName))
            {
                whereCondition += " AND RealName LIKE '%" + WKT.Common.Security.SecurityUtils.SafeSqlString(query.RealName) + "%'";
            }
            if (!string.IsNullOrEmpty(query.Remark))
            {
                whereCondition += " AND ad.Remark LIKE '%" + WKT.Common.Security.SecurityUtils.SafeSqlString(query.Remark) + "%'";
            }
            if (query.ExpertGroupID != null && query.ExpertGroupID.Value > 0)
            {
                whereCondition += " AND EXISTS(SELECT TOP 1 1 FROM dbo.ExpertGroupMap e WITH(NOLOCK),dbo.DictValue d WITH(NOLOCK)WHERE e.AuthorID=ai.AuthorID AND e.JournalID=ai.JournalID AND e.ExpertGroupID=d.ValueID AND e.JournalID=d.JournalID AND d.DictKey='ExpertGroupMap' AND d.ValueID=" + query.ExpertGroupID.Value + ")";
            }
            string execSQL = string.Format(sql, whereCondition);
            DbCommand cmd = db.GetSqlStringCommand(execSQL);
            foreach (SqlParameter pItem in listParameters)
            {
                db.AddInParameter(cmd, pItem.ParameterName, pItem.DbType, pItem.Value);
            }
            DataSet ds = db.ExecuteDataSet(cmd);
            Pager<AuthorInfoEntity> pager = new Pager<AuthorInfoEntity>();
            if (ds != null && ds.Tables.Count > 0)
            {
                List<AuthorInfoEntity> list = new List<AuthorInfoEntity>();
                recordCount = ds.Tables[0].Rows.Count;
                int startID = (query.CurrentPage - 1) * query.PageSize;
                int endID = startID + query.PageSize;
                if (endID >= recordCount)
                {
                    endID = recordCount;
                }
                AuthorInfoEntity authorInfoEntity = null;
                for (int i = startID; i < endID; i++)
                {
                    authorInfoEntity = new AuthorInfoEntity();
                    authorInfoEntity.AuthorID = (Int64)ds.Tables[0].Rows[i]["AuthorID"];
                    authorInfoEntity.JournalID = query.JournalID;
                    authorInfoEntity.LoginName = (String)ds.Tables[0].Rows[i]["LoginName"];
                    authorInfoEntity.RealName = (String)ds.Tables[0].Rows[i]["RealName"];
                    authorInfoEntity.Mobile = (String)ds.Tables[0].Rows[i]["Mobile"];
                    authorInfoEntity.ExpertList = ds.Tables[0].Rows[i].IsNull("ResearchTopics") ? "" : ds.Tables[0].Rows[i]["ResearchTopics"].ToString();
                    authorInfoEntity.AuditCount = (Int32)ds.Tables[0].Rows[i]["AuditCount"];
                    authorInfoEntity.AuditedCount = (Int32)ds.Tables[0].Rows[i]["AuditedCount"];
                    if (!string.IsNullOrEmpty(authorInfoEntity.ExpertList))
                    {
                        authorInfoEntity.ExpertList = authorInfoEntity.ExpertList.Remove(authorInfoEntity.ExpertList.Length - 1);
                    }
                    list.Add(authorInfoEntity);
                }
                pager.ItemList = list;
            }
            pager.CurrentPage = query.CurrentPage;
            pager.PageSize = query.PageSize;
            pager.TotalRecords = recordCount;
            return pager;
        }
Example #27
0
 /// <summary>
 /// 组装数据
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 private List<SiteMessageEntity> GetMsgList(List<SiteMessageEntity> list, SiteMessageQuery sQuery)
 {
     if (list == null || list.Count == 0)
         return list;
     AuthorInfoService service = new AuthorInfoService();
     AuthorInfoQuery query = new AuthorInfoQuery();
     query.JournalID = sQuery.JournalID;
     var dict = service.AuthorInfoBusProvider.GetAuthorDict(query);
     foreach (var model in list)
     {
         model.SendUserName = dict.GetValue(model.SendUser, model.SendUser.ToString());
         model.ReciverName = dict.GetValue(model.ReciverID, model.ReciverID.ToString());
         model.SimpleContent = TextHelper.GetSubHtmlText(model.Content, 100);
     }
     return list;
 }
        /// <summary>
        /// 获取编辑部成员信息
        /// </summary>
        /// <param name="authorID"></param>
        /// <returns></returns>
        public AuthorInfoEntity GetMemberInfo(AuthorInfoQuery authorQuery)
        {
            AuthorInfoEntity authorInfoEntity = null;
            string sql = @"SELECT TOP 1 a.AuthorID,a.JournalID,LoginName,Pwd,RealName,Mobile,LoginIP,LoginCount,LoginDate,a.GroupID,Status,a.AddDate,
                            ISNULL(r.RoleID,0) AS RoleID
                            FROM dbo.AuthorInfo a WITH(NOLOCK) LEFT JOIN dbo.RoleAuthor r WITH(NOLOCK) ON a.AuthorID=r.AuthorID
                            WHERE  a.AuthorID=@AuthorID AND a.JournalID=@JournalID";

            DbCommand cmd = db.GetSqlStringCommand(sql);
            db.AddInParameter(cmd, "@AuthorID", DbType.Int64, authorQuery.AuthorID);
            db.AddInParameter(cmd, "@JournalID", DbType.Int64, authorQuery.JournalID);

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                authorInfoEntity = new AuthorInfoEntity();
                if (dr.Read())
                {
                    authorInfoEntity = new AuthorInfoEntity();
                    authorInfoEntity.AuthorID = (Int64)dr["AuthorID"];
                    authorInfoEntity.JournalID = (Int64)dr["JournalID"];
                    authorInfoEntity.LoginName = (String)dr["LoginName"];
                    authorInfoEntity.Pwd = (String)dr["Pwd"];
                    authorInfoEntity.RealName = (String)dr["RealName"];
                    authorInfoEntity.Mobile = (String)dr["Mobile"];
                    authorInfoEntity.Status = (Byte)dr["Status"];
                    authorInfoEntity.RoleID = (Int64)dr["RoleID"];
                }
                dr.Close();
            }
            return authorInfoEntity;
        }
 public Pager<AuthorInfoEntity> GetAuthorInfoPageList(AuthorInfoQuery query)
 {
     int recordCount = 0;
     string whereSQL = AuthorInfoQueryToSQLWhere(query);
     string orderBy = AuthorInfoQueryToSQLOrder(query);
     DataSet ds = db.GetPagingData("AuthorInfo", "AuthorID,JournalID,LoginName,Pwd,RealName,Mobile,LoginIP,LoginCount,LoginDate,Status,GroupID,AddDate", orderBy, whereSQL, query.CurrentPage, query.PageSize, out recordCount);
     Pager<AuthorInfoEntity> pager = new Pager<AuthorInfoEntity>();
     if (ds != null && ds.Tables.Count > 0)
     {
         pager.ItemList = MakeAuthorInfoList(ds.Tables[0]);
         foreach (AuthorInfoEntity item in pager.ItemList)
         {
             item.Pwd = "";
         }
     }
     pager.CurrentPage = query.CurrentPage;
     pager.PageSize = query.PageSize;
     pager.TotalRecords = recordCount;
     return pager;
 }
 /// <summary>
 /// 删除成员
 /// </summary>
 /// <param name="queryRole"></param>
 /// <returns></returns>
 public ExecResult DelMember(AuthorInfoQuery authorQuery)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult execResult = clientHelper.PostAuth<ExecResult, AuthorInfoQuery>(GetAPIUrl(APIConstant.SYSDELMEMBERINFO), authorQuery);
     return execResult;
 }