public IList<AuthorDetailEntity> GetExpertGroupMapList(ExpertGroupMapEntity query)
 {
     IAuthorDetailService service = ServiceContainer.Instance.Container.Resolve<IAuthorDetailService>();
     return service.GetExpertGroupMapList(query);
 }
        /// <summary>
        /// 获取显示html
        /// </summary>
        /// <returns></returns>
        private string GetExpertGroupMapHtml(Int32 GroupID)
        {
            StringBuilder strHtml = new StringBuilder();

            IAuthorPlatformFacadeService service = ServiceContainer.Instance.Container.Resolve<IAuthorPlatformFacadeService>();
            ExpertGroupMapEntity query = new ExpertGroupMapEntity();
            query.JournalID = JournalID;
            query.ExpertGroupID = GroupID;
            var list = service.GetExpertGroupMapList(query);
            if (list != null && list.Count > 0)
            {
                strHtml.Append("<table>");
                int i = 1;
                foreach (var model in list)
                {
                    if (i == 1)
                        strHtml.Append("<tr>");
                    strHtml.Append("<td style=\"padding-left:10px;height:25px;width:130px;\">");
                    strHtml.Append("<input id=\"chkExpertGroup_")
                     .Append(model.AuthorID)
                     .Append("\" type=\"checkbox\" name=\"ExpertGroup\" value=\"")
                     .Append(model.AuthorID)
                     .Append("\" ");
                    if (model.IsChecked)
                    {
                        strHtml.Append(" checked=\"checked\" ");
                    }
                    strHtml.Append("  key=\"")
                        .Append(model.AuthorName)
                        .Append("\"/><label for=\"chkExpertGroup_")
                        .Append(model.AuthorID)
                        .Append("\" style=\"margin-right:30px;\" ");
                    if (!string.IsNullOrWhiteSpace(model.ResearchTopics))
                    {
                        strHtml.Append(" title=\"研究方向:");
                        strHtml.Append(model.ResearchTopics);
                        strHtml.Append("\"");
                    }
                    strHtml.Append(" >");
                    strHtml.Append(model.AuthorName);
                    strHtml.Append("</label></td>");
                    if (i == 5)
                    {
                        strHtml.Append("</tr>");
                        i = 0;
                    }
                    i++;
                }
                strHtml.Append("</table>");
            }
            return strHtml.ToString();
        }
 /// <summary>
 /// 获取专家分组信息
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<AuthorDetailEntity> GetExpertGroupMapList(ExpertGroupMapEntity query)
 {
     return AuthorDetailDataAccess.Instance.GetExpertGroupMapList(query);
 }
 /// <summary>
 /// 设置作者为专家
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<AuthorDetailEntity> GetExpertGroupMapList(ExpertGroupMapEntity query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<AuthorDetailEntity> result = clientHelper.Post<IList<AuthorDetailEntity>, ExpertGroupMapEntity>(GetAPIUrl(APIConstant.AUTHOR_GETEXPERTGROUPMAPLIST), query);
     return result;
 }
Esempio n. 5
0
 /// <summary>
 /// 获取专家分组信息
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<AuthorDetailEntity> GetExpertGroupMapList(ExpertGroupMapEntity query)
 {
     return AuthorDetailBusProvider.GetExpertGroupMapList(query);
 }
        /// <summary>
        /// 获取专家分组信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public IList<AuthorDetailEntity> GetExpertGroupMapList(ExpertGroupMapEntity query)
        {
            string strSql = @"    select a.AuthorID,a.LoginName,a.RealName,c.PKID   from
            (SELECT b.AuthorID ,b.LoginName ,b.RealName,B.JournalID FROM dbo.AuthorDetail a with(nolock)
                              RIGHT JOIN dbo.AuthorInfo b with(nolock) ON a.JournalID=b.JournalID and a.AuthorID=b.AuthorID WHERE  b.JournalID=" + query.JournalID + " and (b.GroupID=3 or exists(select 1 from dbo.RoleAuthor m with(nolock) WHERE b.JournalID=m.JournalID and b.AuthorID=m.AuthorID and m.RoleID=3))) as A LEFT JOIN dbo.ExpertGroupMap c  ON   A.JournalID=c.JournalID and a.AuthorID=c.AuthorID and c.ExpertGroupID=" + query.ExpertGroupID + "  ORDER BY RealName";

            return db.GetList<AuthorDetailEntity>(strSql, (dr) =>
            {
                List<AuthorDetailEntity> list = new List<AuthorDetailEntity>();
                AuthorDetailEntity model = null;
                while (dr.Read())
                {
                    model = new AuthorDetailEntity();
                    model.AuthorID = dr.GetDrValue<Int64>("AuthorID");
                    model.Emial = dr.GetDrValue<String>("LoginName");
                    model.AuthorName = dr.GetDrValue<String>("RealName");
                    model.IsChecked = dr.GetDrValue<Int64>("PKID") > 0;
                    list.Add(model);
                }
                return list;
            });
        }
 /// <summary>
 /// 获取专家分类信息
 /// </summary>
 /// <param name="AuthorID"></param>
 /// <returns></returns>
 private IList<ExpertGroupMapEntity> GetExpertGroupMapList(Int64 AuthorID)
 {
     string strSql = "SELECT * FROM dbo.ExpertGroupMap with(nolock) WHERE AuthorID=" + AuthorID;
     return db.GetList<ExpertGroupMapEntity>(strSql, (dr) =>
         {
             List<ExpertGroupMapEntity> list = new List<ExpertGroupMapEntity>();
             ExpertGroupMapEntity model = null;
             while (dr.Read())
             {
                 model = new ExpertGroupMapEntity();
                 model.PKID = dr.GetDrValue<Int64>("PKID");
                 model.JournalID = dr.GetDrValue<Int64>("JournalID");
                 model.AuthorID = dr.GetDrValue<Int64>("AuthorID");
                 model.ExpertGroupID = dr.GetDrValue<Int32>("ExpertGroupID");
                 model.AddDate = dr.GetDrValue<DateTime>("AddDate");
                 list.Add(model);
             }
             return list;
         });
 }
        /// <summary>
        /// 添加专家分类
        /// </summary>
        /// <param name="model"></param>
        /// <param name="trans"></param>
        /// <returns></returns>
        private bool AddExpertGroupMap(ExpertGroupMapEntity model, DbTransaction trans)
        {
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @AuthorID");
            sqlCommandText.Append(", @ExpertGroupID");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.ExpertGroupMap ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString()));

            db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID);
            db.AddInParameter(cmd, "@AuthorID", DbType.Int64, model.AuthorID);
            db.AddInParameter(cmd, "@ExpertGroupID", DbType.Int32, model.ExpertGroupID);

            try
            {
                bool result = false;
                if (trans == null)
                    result = db.ExecuteNonQuery(cmd) > 0;
                else
                    result = db.ExecuteNonQuery(cmd, trans) > 0;
                if (!result)
                    throw new Exception("新增专家分类信息失败!");
                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }