/// <summary> /// 保存期刊 /// </summary> /// <param name="query"></param> /// <returns></returns> public ExecResult SaveIssueContent(IssueContentEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post <ExecResult, IssueContentEntity>(GetAPIUrl(APIConstant.ISSUECONTENT_SAVE), model); return(result); }
/// <summary> /// 判断当前节点是否已存在相同的 /// </summary> /// <param name="entity"></param> /// <returns></returns> public int ExistNum(IssueContentEntity entity) { ///id=0,判断总数,ID>0判断除自己之外的总数 string sql = @"Select count(1) from dbo.[IssueContent] WITH(NOLOCK) "; string where = "where "; if (entity.Id == 0) { where += " IssueTitle=@IssueTitle"; } else { where += " Id!=@Id AND IssueTitle=@IssueTitle"; } sql = sql + where; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@IssueTitle", DbType.String, entity.IssueTitle); if (entity.Id > 0) { db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); } object identity = db.ExecuteScalar(cmd); if (identity == null || identity == DBNull.Value) { return(0); } return(Convert.ToInt32(identity)); }
public IssueContentEntity GetIssueContentModel(IssueContentQuery query) { IIssueService service = ServiceContainer.Instance.Container.Resolve <IIssueService>(); IssueContentEntity model = service.GetIssueContent(query); return(model); }
/// <summary> /// 获取期刊实体 /// </summary> /// <param name="query"></param> /// <returns></returns> public IssueContentEntity GetIssueContentModel(IssueContentQuery query) { HttpClientHelper clientHelper = new HttpClientHelper(); IssueContentEntity model = clientHelper.Post <IssueContentEntity, IssueContentQuery>(GetAPIUrl(APIConstant.ISSUECONTENT_GETMODEL), query); return(model); }
public IssueContentEntity GetIssueContentByName(string title) { string sql = @"SELECT [Id],[ClassId],[IssueTitle],[IssueContent],[IsActive],[Sort] FROM dbo.[IssueContent] WITH(NOLOCK) WHERE [IssueTitle]=@IssueTitle" ; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@IssueTitle", DbType.String, title); IssueContentEntity entity = new IssueContentEntity(); using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.ClassId = StringUtils.GetDbInt(reader["ClassId"]); entity.IssueTitle = StringUtils.GetDbString(reader["IssueTitle"]); entity.IssueContent = StringUtils.GetDbString(reader["IssueContent"]); entity.IsActive = StringUtils.GetDbInt(reader["IsActive"]); entity.Sort = StringUtils.GetDbInt(reader["Sort"]); } } return(entity); }
public ActionResult UpdateLocalDataAjax(Int64 PKID) { //获取站点配置信息 SiteConfigQuery sitequery = new SiteConfigQuery(); sitequery.JournalID = CurAuthor.JournalID; ISiteConfigFacadeService siteservice = ServiceContainer.Instance.Container.Resolve <ISiteConfigFacadeService>(); SiteConfigEntity model = siteservice.GetSiteConfigModel(sitequery); //获取DOI注册日志实体 IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve <IIssueFacadeService>(); DoiRegLogQuery query = new DoiRegLogQuery(); query.PKID = PKID; query.JournalID = CurAuthor.JournalID; string DoiFileName = service.GetDoiRegLog(query).DoiFileName.Trim(); //保存DOI注册结果 DoiRegResultFilePath = System.DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff") + ".xml"; WKT.Common.Utils.DoiUtils.GetDoiRegResult(DoiFileName, model.DoiUserName, model.DoiUserPwd, Utils.GetMapPath(SiteConfig.RootPath + "/data/" + DoiRegResultFilePath)); XElement root = XElement.Load(Utils.GetMapPath(SiteConfig.RootPath + "/data/" + DoiRegResultFilePath), LoadOptions.SetLineInfo); XElement journal = root.Element("body").Element("journal"); var Articles = from Article in journal.Elements("journal_article") select Article; foreach (var Article in Articles) { string doi = Article.Element("doi_data").Element("doi").Value; string resource = Article.Element("doi_data").Element("resource").Value; Int64 ContentID = Convert.ToInt64(resource.Substring(resource.LastIndexOf('=') + 1, resource.Length - resource.LastIndexOf('=') - 4)); IIssueFacadeService IssueService = ServiceContainer.Instance.Container.Resolve <IIssueFacadeService>(); IssueContentEntity issueContentEntity = new IssueContentEntity(); //获取期刊实体 IssueContentQuery IssueQuery = new IssueContentQuery(); IssueQuery.JournalID = CurAuthor.JournalID; IssueQuery.contentID = ContentID; IssueQuery.IsAuxiliary = true; issueContentEntity = IssueService.GetIssueContentModel(IssueQuery); //更新期刊DOI数据 issueContentEntity.DOI = doi; issueContentEntity.isRegDoi = true; ExecResult result = IssueService.SaveIssueContent(issueContentEntity); } //更新DOI注册日志 DoiRegLogEntity doiRegLogEntity = new DoiRegLogEntity(); doiRegLogEntity.State = "已更新"; doiRegLogEntity.PKID = PKID; doiRegLogEntity.isUpdate = true; service.SaveDoiRegLog(doiRegLogEntity); //删除临时文件 System.IO.File.Delete(Utils.GetMapPath(SiteConfig.RootPath + "/data/" + DoiRegResultFilePath)); return(Json(new { flag = 1 })); }
/// <summary> /// 购物指南 /// </summary> /// <returns></returns> public ActionResult ShoppingDirectory() { int _id = QueryString.IntSafeQ("id", 0); IssueContentEntity _entity = IssueContentBLL.Instance.GetIssueContent(_id); IssueClassEntity _classentity = IssueClassBLL.Instance.GetIssueClass(_entity.ClassId); ViewBag.entity = _entity; ViewBag.classentity = _classentity; return(View()); }
public ActionResult SaveIssueContent(IssueContentEntity model) { IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve <IIssueFacadeService>(); model.JournalID = CurAuthor.JournalID; model.InUser = CurAuthor.AuthorID; model.EditUser = CurAuthor.AuthorID; ExecResult result = service.SaveIssueContent(model); return(Json(new { result = result.result, msg = result.msg })); }
public JsonResult DownStat(long CID) { try { IssueContentQuery issueCQuery = new IssueContentQuery(); issueCQuery.contentID = CID; issueCQuery.JournalID = JournalID; IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve <IIssueFacadeService>(); IssueContentEntity issueEntity = service.GetIssueContentModel(issueCQuery); if (issueEntity == null) { return(Json(new { flag = "NOfile" })); } else { if (!string.IsNullOrEmpty(issueEntity.FilePath)) { string downPath = GetUploadPath(issueEntity.FilePath); if (!System.IO.File.Exists(downPath)) { return(Json(new { flag = "NOfile" })); } //更新下载次数 service.UpdateIssueContentDownloads(issueCQuery); # region 记录下载日志 try { IssueDownLogEntity issueLogEntity = new IssueDownLogEntity(); issueLogEntity.ContentID = CID; issueLogEntity.JournalID = JournalID; //issueLogEntity.IP = Utils.GetRealIP(); issueLogEntity.Daytime = TypeParse.ToInt(DateTime.Now.ToString("yyyyMMdd")); issueLogEntity.Year = DateTime.Now.Year; issueLogEntity.Month = DateTime.Now.Month; issueLogEntity.AuthorID = 0; service.SaveDownloadLog(issueLogEntity); } catch { } # endregion return(Json(new { flag = "success", URL = "http://" + Request.Url.Host + issueEntity.FilePath })); } else { return(Json(new { flag = "NOfile" })); } }
/// <summary> /// 获取期刊实体 /// </summary> /// <param name="contentID"></param> /// <returns></returns> public IssueContentEntity GetIssueContent(IssueContentQuery query) { IssueContentEntity model = IssueBusProvider.GetIssueContent(query); if (query.IsAuxiliary) { model.ReferenceList = GetIssueReferenceList(new IssueReferenceQuery() { JournalID = query.JournalID, ContentID = query.contentID }); } return(model); }
public ActionResult CreateIssueContent(Int64 contentID = 0) { IssueContentEntity model = GetIssueContentModel(contentID); if (model.ReferenceList == null) { model.ReferenceList = new List <IssueReferenceEntity>() { new IssueReferenceEntity() } } ; return(View(model)); }
/// <summary> /// 根据主键值更新记录的全部字段(注意:该方法不会对自增字段、timestamp类型字段以及主键字段更新!如果要更新主键字段,请使用Update方法)。 /// 如果数据库有数据被更新了则返回True,否则返回False /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="issueContent">待更新的实体对象</param> public int UpdateIssueContent(IssueContentEntity entity) { string sql = @" UPDATE dbo.[IssueContent] SET [ClassId]=@ClassId,[IssueTitle]=@IssueTitle,[IssueContent]=@IssueContent,[IsActive]=@IsActive,[Sort]=@Sort WHERE [Id]=@id"; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@Id", DbType.Int32, entity.Id); db.AddInParameter(cmd, "@ClassId", DbType.Int32, entity.ClassId); db.AddInParameter(cmd, "@IssueTitle", DbType.String, entity.IssueTitle); db.AddInParameter(cmd, "@IssueContent", DbType.String, entity.IssueContent); db.AddInParameter(cmd, "@IsActive", DbType.Int32, entity.IsActive); db.AddInParameter(cmd, "@Sort", DbType.Int32, entity.Sort); return(db.ExecuteNonQuery(cmd)); }
/// <summary> /// 购物指南添加 /// </summary> /// <returns></returns> public int ShoppingDirectoryAdd() { string _issuetitle = FormString.SafeQ("issuetitle"); string _issuecontent = FormString.SafeQNo("issuecontent", 1000000); int _isactive = FormString.IntSafeQ("isactive"); int _classid = FormString.IntSafeQ("classid"); IssueContentEntity entity = new IssueContentEntity(); entity.IssueTitle = _issuetitle; entity.IssueContent = _issuecontent; entity.IsActive = _isactive; entity.ClassId = _classid; return(IssueContentBLL.Instance.AddIssueContent(entity)); }
/// <summary> /// 插入一条记录到表IssueContent,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0。 /// 该方法提供给界面等UI层调用 /// </summary> /// <param name="issueContent">要添加的IssueContent数据实体对象</param> public int AddIssueContent(IssueContentEntity issueContent) { if (issueContent.Id > 0) { return(UpdateIssueContent(issueContent)); } else if (IssueContentBLL.Instance.IsExist(issueContent)) { return((int)CommonStatus.ADD_Fail_Exist); } else { return(IssueContentDA.Instance.AddIssueContent(issueContent)); } }
public ActionResult HelpContent() { IssueContentEntity entity = new IssueContentEntity(); int contentid = QueryString.IntSafeQ("id"); if (contentid > 0) { entity = IssueContentBLL.Instance.GetIssueContent(contentid); } else { string title = QueryString.SafeQ("title"); entity = IssueContentBLL.Instance.GetIssueContentByName(title); } ViewBag.Content = entity; return(View()); }
/// <summary> /// 帮助中心详情 /// </summary> /// <returns></returns> public ActionResult HelpC() { int _id = QueryString.IntSafeQ("id", 0); if (_id == 0) { _id = StringUtils.GetDbInt(RouteData.Values["id"]); } IssueContentEntity entity = IssueContentBLL.Instance.GetIssueContent(_id); var _classid = entity.ClassId; var _parentId = IssueClassBLL.Instance.GetIssueClass(_classid).ParentId; ViewBag.SecondLevelName = IssueClassBLL.Instance.GetIssueClass(_classid).ClassName; ViewBag.FirstLevelName = IssueClassBLL.Instance.GetIssueClass(_parentId).ClassName; ViewBag.entity = entity; return(View()); }
private IssueContentEntity GetIssueContentModel(Int64 contentID) { IssueContentEntity model = null; if (contentID > 0) { IssueContentQuery query = new IssueContentQuery(); query.JournalID = CurAuthor.JournalID; query.contentID = contentID; query.IsAuxiliary = true; IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve <IIssueFacadeService>(); model = service.GetIssueContentModel(query); } if (model == null) { model = new IssueContentEntity(); } return(model); }
/// <summary> /// 插入一条记录到表IssueContent,如果表中存在自增字段,则返回值为新记录的自增字段值,否则返回0 /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="issueContent">待插入的实体对象</param> public int AddIssueContent(IssueContentEntity entity) { string sql = @"insert into IssueContent( [ClassId],[IssueTitle],[IssueContent],[IsActive],[Sort])VALUES ( @ClassId,@IssueTitle,@IssueContent,@IsActive,@Sort); SELECT SCOPE_IDENTITY();" ; DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@ClassId", DbType.Int32, entity.ClassId); db.AddInParameter(cmd, "@IssueTitle", DbType.String, entity.IssueTitle); db.AddInParameter(cmd, "@IssueContent", DbType.String, entity.IssueContent); db.AddInParameter(cmd, "@IsActive", DbType.Int32, entity.IsActive); db.AddInParameter(cmd, "@Sort", DbType.Int32, entity.Sort); object identity = db.ExecuteScalar(cmd); if (identity == null || identity == DBNull.Value) { return(0); } return(Convert.ToInt32(identity)); }
/// <summary> /// 读取记录列表。 /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param> public IList <IssueContentEntity> GetIssueContentAll() { string sql = @"SELECT [Id],[ClassId],[IssueTitle],[IssueContent],[IsActive],[Sort] from dbo.[IssueContent] WITH(NOLOCK) "; IList <IssueContentEntity> entityList = new List <IssueContentEntity>(); DbCommand cmd = db.GetSqlStringCommand(sql); using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { IssueContentEntity entity = new IssueContentEntity(); entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.ClassId = StringUtils.GetDbInt(reader["ClassId"]); entity.IssueTitle = StringUtils.GetDbString(reader["IssueTitle"]); entity.IssueContent = StringUtils.GetDbString(reader["IssueContent"]); entity.IsActive = StringUtils.GetDbInt(reader["IsActive"]); entity.Sort = StringUtils.GetDbInt(reader["Sort"]); entityList.Add(entity); } } return(entityList); }
/// <summary> /// 查看期刊 /// </summary> /// <param name="ID"></param> /// <returns></returns> public ActionResult Show(long ID) { IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve <IIssueFacadeService>(); IssueContentQuery contentQuery = new IssueContentQuery(); contentQuery.JournalID = JournalID; contentQuery.contentID = ID; IssueContentEntity contentEntity = service.GetIssueContentModel(contentQuery); if (contentEntity == null) { contentEntity = new IssueContentEntity(); } else { service.UpdateIssueContentHits(contentQuery); # region 记录浏览日志 if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["RecodeViewLog"])) { try { IssueViewLogEntity issueLogEntity = new IssueViewLogEntity(); issueLogEntity.ContentID = ID; issueLogEntity.JournalID = JournalID; issueLogEntity.IP = Utils.GetRealIP(); issueLogEntity.Daytime = TypeParse.ToInt(DateTime.Now.ToString("yyyyMMdd")); issueLogEntity.Year = DateTime.Now.Year; issueLogEntity.Month = DateTime.Now.Month; issueLogEntity.AuthorID = 0; service.SaveViewLog(issueLogEntity); } catch { } } # endregion }
/// <summary> /// 保存期刊信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveIssueContent(IssueContentEntity model) { ExecResult execResult = new ExecResult(); model.Title = model.Title.TextFilter(); model.EnTitle = model.EnTitle.TextFilter(); model.Authors = model.Authors.TextFilter(); model.EnAuthors = model.EnAuthors.TextFilter(); model.WorkUnit = model.WorkUnit.TextFilter(); model.EnWorkUnit = model.EnWorkUnit.TextFilter(); model.Keywords = model.Keywords.TextFilter(); model.EnKeywords = model.EnKeywords.TextFilter(); model.CLC = model.CLC.TextFilter(); model.DOI = model.DOI.TextFilter(); model.Abstract = model.Abstract.HtmlFilter(); model.EnAbstract = model.EnAbstract.HtmlFilter(); model.Reference = model.Reference.HtmlFilter(); model.Funds = model.Funds.HtmlFilter(); model.AuthorIntro = model.AuthorIntro.HtmlFilter(); model.StartPageNum = model.StartPageNum; model.EndPageNum = model.EndPageNum; model.FileKey = model.FileKey.TextFilter(); model.ContentID = IssueBusProvider.SaveIssueContent(model); if (model.ContentID > 0) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "保存期刊信息成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "保存期刊信息失败!"; } execResult.resultID = model.ContentID; return(execResult); }
/// <summary> /// 编辑期刊表信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateIssueContent(IssueContentEntity model) { return(IssueDataAccess.Instance.UpdateIssueContent(model)); }
/// <summary> /// 更新一条IssueContent记录。 /// 该方法提供给界面等UI层调用 /// </summary> /// <param name="issueContent">待更新的实体对象</param> /// <param name="columns">要更新的列名,不提供任何列名时默认将更新主键之外的所有列</param> public int UpdateIssueContent(IssueContentEntity issueContent) { return(IssueContentDA.Instance.UpdateIssueContent(issueContent)); }
/// <summary> /// 读取记录列表。 /// </summary> /// <param name="db">数据库操作对象</param> /// <param name="columns">需要返回的列,不提供任何列名时默认将返回所有列</param> public IList <IssueContentEntity> GetIssueContentList(int pagesize, int pageindex, ref int recordCount, int id, string issuetitle, int isactive, int classid, int _systype) { string where = "WHERE 1=1"; if (id > 0) { where += " AND a.Id=@Id"; } if (!string.IsNullOrEmpty(issuetitle)) { where += " AND a.IssueTitle like @IssueTitle"; } if (isactive > -1) { where += " AND a.IsActive=@IsActive"; } if (classid > 0) { where += " AND ClassId=@ClassId"; } if (_systype != -1) { where += " AND a.[SystemType]=@SystemType"; } string sql = @"SELECT [Id],[ClassId],ClassName,[IssueTitle],[IssueContent],[IsActive],[Sort] FROM (SELECT ROW_NUMBER() OVER (ORDER BY a.[Sort] desc) AS ROWNUMBER, a.[Id],a.[ClassId],b.ClassName,a.[IssueTitle],a.[IssueContent],a.[IsActive],a.[Sort] from dbo.[IssueContent] a WITH(NOLOCK) inner join IssueClass b WITH(NOLOCK) on a.ClassId=b.id " + where + @" ) as temp where rownumber BETWEEN ((@PageIndex - 1) * @PageSize + 1) AND @PageIndex * @PageSize" ; string sql2 = @"Select count(1) from dbo.[IssueContent] a with (nolock) " + where; IList <IssueContentEntity> entityList = new List <IssueContentEntity>(); DbCommand cmd = db.GetSqlStringCommand(sql); db.AddInParameter(cmd, "@PageIndex", DbType.Int32, pageindex); db.AddInParameter(cmd, "@PageSize", DbType.Int32, pagesize); if (id > 0) { db.AddInParameter(cmd, "@Id", DbType.Int32, id); } if (!string.IsNullOrEmpty(issuetitle)) { db.AddInParameter(cmd, "@IssueTitle", DbType.String, "%" + issuetitle + "%"); } if (isactive > -1) { db.AddInParameter(cmd, "@IsActive", DbType.Int32, isactive); } if (classid > 0) { db.AddInParameter(cmd, "@ClassId", DbType.Int32, classid); } if (_systype != -1) { db.AddInParameter(cmd, "@SystemType", DbType.Int32, _systype); } using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { IssueContentEntity entity = new IssueContentEntity(); entity.Id = StringUtils.GetDbInt(reader["Id"]); entity.ClassId = StringUtils.GetDbInt(reader["ClassId"]); entity.ClassName = StringUtils.GetDbString(reader["ClassName"]); entity.IssueTitle = StringUtils.GetDbString(reader["IssueTitle"]); entity.IssueContent = StringUtils.GetDbString(reader["IssueContent"]); entity.IsActive = StringUtils.GetDbInt(reader["IsActive"]); entity.Sort = StringUtils.GetDbInt(reader["Sort"]); entityList.Add(entity); } } cmd = db.GetSqlStringCommand(sql2); if (id > 0) { db.AddInParameter(cmd, "@Id", DbType.Int32, id); } if (!string.IsNullOrEmpty(issuetitle)) { db.AddInParameter(cmd, "@IssueTitle", DbType.String, "%" + issuetitle + "%"); } if (isactive > -1) { db.AddInParameter(cmd, "@IsActive", DbType.Int32, isactive); } if (classid > 0) { db.AddInParameter(cmd, "@ClassId", DbType.Int32, classid); } if (_systype != -1) { db.AddInParameter(cmd, "@SystemType", DbType.Int32, _systype); } using (IDataReader reader = db.ExecuteReader(cmd)) { if (reader.Read()) { recordCount = StringUtils.GetDbInt(reader[0]); } else { recordCount = 0; } } return(entityList); }
/// <summary> /// 判断对象是否存在 /// </summary> /// <param name="dicEnum"></param> /// <returns></returns> public bool IsExist(IssueContentEntity issueContent) { return(IssueContentDA.Instance.ExistNum(issueContent) > 0); }
/// <summary> /// 新增期刊表信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddIssueContent(IssueContentEntity model) { return(IssueDataAccess.Instance.AddIssueContent(model)); }
/// <summary> /// 新增期刊表信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddIssueContent(IssueContentEntity model) { return(IssueBusProvider.AddIssueContent(model)); }
/// <summary> /// 编辑期刊表信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateIssueContent(IssueContentEntity model) { return(IssueBusProvider.UpdateIssueContent(model)); }
public ExecResult SaveIssueContent(IssueContentEntity model) { IIssueService service = ServiceContainer.Instance.Container.Resolve <IIssueService>(); return(service.SaveIssueContent(model)); }
/// <summary> /// 保存期刊信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public Int64 SaveIssueContent(IssueContentEntity model) { return(IssueDataAccess.Instance.SaveIssueContent(model)); }