/// <summary>
 /// 获取所有符合查询条件的数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public List<ExpertApplyLogEntity> GetExpertApplyInfoList(ExpertApplyLogQuery query)
 {
     return ExpertApplyBusProvider.GetExpertApplyInfoList(query);
 }
 public Pager<ExpertApplyLogEntity> GetPageList(ExpertApplyLogQuery query)
 {
     IExpertApplyService service = ServiceContainer.Instance.Container.Resolve<IExpertApplyService>();
     Pager<ExpertApplyLogEntity> pager = service.GetExpertApplyInfoPageList(query);
     return pager;
 }
 /// <summary>
 /// 获取一个实体对象
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExpertApplyLogEntity GetExpertApplyInfo(ExpertApplyLogQuery query)
 {
     return ExpertApplyBusProvider.GetExpertApplyInfo(query);
 }
 public IList<ExpertApplyLogEntity> GetList(ExpertApplyLogQuery query)
 {
     IExpertApplyService service = ServiceContainer.Instance.Container.Resolve<IExpertApplyService>();
     IList<ExpertApplyLogEntity> list = service.GetExpertApplyInfoList(query);
     return list;
 }
 public ExpertApplyLogEntity GetModel(ExpertApplyLogQuery query)
 {
     IExpertApplyService service = ServiceContainer.Instance.Container.Resolve<IExpertApplyService>();
     ExpertApplyLogEntity model = service.GetExpertApplyInfo(query);
     return model;
 }
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<ExpertApplyLogEntity> GetExpertApplyInfoPageList(ExpertApplyLogQuery query)
 {
     return ExpertApplyDataAccess.Instance.GetExpertApplyInfoPageList(query);
 }
        public ExecResult SubmitApply(ExpertApplyLogEntity expertApplyEntity)
        {
            ExecResult execResult = new ExecResult();
            try
            {
                IExpertApplyService expertApplyService = ServiceContainer.Instance.Container.Resolve<IExpertApplyService>();

                ExpertApplyLogQuery queryExpertApply = new ExpertApplyLogQuery();
                queryExpertApply.LoginName = expertApplyEntity.LoginName;
                queryExpertApply.JournalID = expertApplyEntity.JournalID;

                //验证是否提交过申请
                IList<ExpertApplyLogEntity> list = expertApplyService.GetExpertApplyInfoList(queryExpertApply);
                if (list != null && list.Count > 0)
                {
                    execResult.result = EnumJsonResult.failure.ToString();
                    execResult.msg = "此邮箱提交过申请!请更换其他邮箱提交申请或联系编辑部。";
                }
                else//提交申请
                {
                    expertApplyService.SubmitApply(expertApplyEntity);
                    execResult.result = EnumJsonResult.success.ToString();
                    execResult.msg = "申请提交成功,请等待编辑部审核。\r\n审核结果将会以邮件形式发送到您的邮箱。";
                }
            }
            catch (Exception ex)
            {
                execResult.result = EnumJsonResult.error.ToString();
                execResult.msg = "提交申请失败:" + ex.Message;
                LogProvider.Instance.Error("提交申请出现异常:" + ex.Message);
            }
            return execResult;
        }
 /// <summary>
 /// 获取专家申请分页数据
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public Pager<ExpertApplyLogEntity> GetExpertApplyInfoPageList(ExpertApplyLogQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     Pager<ExpertApplyLogEntity> pager = clientHelper.Post<Pager<ExpertApplyLogEntity>, ExpertApplyLogQuery>(GetAPIUrl(APIConstant.EXPERTAPPLY_GETPAGELIST), query);
     return pager;
 }
 /// <summary>
 /// 获取一个实体对象
 /// </summary>
 /// <param name="query">专家申请信息</param>
 /// <returns>获取一个实体,如果数据不存在返回Null</returns>
 public ExpertApplyLogEntity GetExpertApplyInfo(ExpertApplyLogQuery query)
 {
     return ExpertApplyDataAccess.Instance.GetExpertApplyInfo(query);
 }
 /// <summary>
 /// 获取专家申请信息实体
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public ExpertApplyLogEntity GetExpertApplyInfo(ExpertApplyLogQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExpertApplyLogEntity expertApplyEntity = clientHelper.PostAuth<ExpertApplyLogEntity, ExpertApplyLogQuery>(GetAPIUrl(APIConstant.EXPERTAPPLY_GETMODEL), query);
     return expertApplyEntity;
 }
 /// <summary>
 /// 获取专家申请信息列表
 /// </summary>
 /// <param name="query"></param>
 /// <returns></returns>
 public IList<ExpertApplyLogEntity> GetExpertApplyInfoList(ExpertApplyLogQuery query)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     IList<ExpertApplyLogEntity> listExpertApplyInfo = clientHelper.PostAuth<IList<ExpertApplyLogEntity>, ExpertApplyLogQuery>(GetAPIUrl(APIConstant.EXPERTAPPLY_GETLIST), query);
     return listExpertApplyInfo;
 }
 /// <summary>
 /// 将查询实体转换为Order语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Order语句,不包含Order</returns>
 /// </summary>
 public string ExpertApplyQueryToSQLOrder(ExpertApplyLogQuery query)
 {
     if (query.OrderByStr != null)
         return query.OrderByStr;
     else
         return " PKID DESC";
 }
 /// <summary>
 /// 分页获取符合查询条件的数据
 /// </summary>
 /// <param name="CommonQuery">查询对象</param>
 /// <returns>Pager<AuthorInfoEntity></returns>
 public Pager<ExpertApplyLogEntity> GetExpertApplyInfoPageList(ExpertApplyLogQuery query)
 {
     int recordCount = 0;
     DataSet ds = db.GetPagingData("ExpertApplyLog", "PKID,JournalID,LoginName,RealName,Gender,Birthday,Education,JobTitle,Tel,Mobile,WorkUnit,Address,ReviewDomain,ResearchTopics,BankID,BankType,ZipCode,Remark,Status,AddDate,ActionUser,ActionDate", query.OrderByStr, "", query.CurrentPage, query.PageSize, out recordCount);
     Pager<ExpertApplyLogEntity> pager = new Pager<ExpertApplyLogEntity>();
     if (ds != null && ds.Tables.Count > 0)
     {
         pager.ItemList = MakeExpertApplyInfoList(ds.Tables[0]);
     }
     pager.CurrentPage = query.CurrentPage;
     pager.PageSize = query.PageSize;
     pager.TotalRecords = recordCount;
     return pager;
 }
 public List<ExpertApplyLogEntity> GetExpertApplyInfoList(ExpertApplyLogQuery query)
 {
     List<ExpertApplyLogEntity> list = new List<ExpertApplyLogEntity>();
     StringBuilder sqlCommandText = new StringBuilder();
     sqlCommandText.Append("SELECT * FROM dbo.ExpertApplyLog WITH(NOLOCK)");
     string whereSQL = ExpertApplyQueryToSQLWhere(query);
     string orderBy = ExpertApplyQueryToSQLOrder(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 = MakeExpertApplyInfoList(dr);
     }
     return list;
 }
        /// <summary>
        /// 获取专家申请信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        public ExpertApplyLogEntity GetExpertApplyInfo(ExpertApplyLogQuery query)
        {
            ExpertApplyLogEntity expertApplyEntity = null;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append("SELECT TOP 1 * FROM dbo.ExpertApplyLog WITH(NOLOCK)");
            string whereSQL = ExpertApplyQueryToSQLWhere(query);
            if (!string.IsNullOrEmpty(whereSQL)) sqlCommandText.Append(" WHERE " + whereSQL);
            DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString());

            using (IDataReader dr = db.ExecuteReader(cmd))
            {
                expertApplyEntity = MakeExpertApplyInfo(dr);
            }
            return expertApplyEntity;
        }
 /// <summary>
 /// 将查询实体转换为Where语句
 /// <param name="query">查询实体</param>
 /// <returns>获取Where语句,不包含Where</returns>
 /// </summary>
 public string ExpertApplyQueryToSQLWhere(ExpertApplyLogQuery query)
 {
     StringBuilder sbWhere = new StringBuilder(" JournalID = " + query.JournalID);
     if (query.PKID>0)
     {
         sbWhere.Append(" AND PKID = " + query.PKID);
     }
     else
     {
         if (!string.IsNullOrWhiteSpace(query.LoginName))
         {
             sbWhere.Append(" AND LoginName = '").Append(WKT.Common.Security.SecurityUtils.SafeSqlString(query.LoginName)).Append("'");
         }
         //if (!string.IsNullOrWhiteSpace(query.RealName))
         //{
         //    sbWhere.Append(" AND RealName like '%").Append(WKT.Common.Security.SecurityUtils.SafeSqlString(query.RealName)).Append("%'");
         //}
         //if (query.Status != null)
         //{
         //    sbWhere.Append(" AND Status = '").Append(query.Status).Append("'");
         //}
         //if (query.ActionUser != null)
         //{
         //    sbWhere.Append(" AND ActionUser = '******'");
         //}
     }
     return sbWhere.ToString();
 }