/// <summary> /// 编辑期刊内容 /// </summary> /// <param name="issueContentEntity"></param> /// <param name="trans"></param> /// <returns></returns> private bool UpdateIssueContent(IssueContentEntity issueContentEntity, DbTransaction trans = null) { StringBuilder whereCommandText = new StringBuilder(); whereCommandText.Append(" ContentID=@ContentID"); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" Year=@Year"); sqlCommandText.Append(", Volume=@Volume"); sqlCommandText.Append(", Issue=@Issue"); sqlCommandText.Append(", JChannelID=@JChannelID"); sqlCommandText.Append(", Title=@Title"); sqlCommandText.Append(", EnTitle=@EnTitle"); sqlCommandText.Append(", Authors=@Authors"); sqlCommandText.Append(", EnAuthors=@EnAuthors"); sqlCommandText.Append(", WorkUnit=@WorkUnit"); sqlCommandText.Append(", EnWorkUnit=@EnWorkUnit"); sqlCommandText.Append(", Keywords=@Keywords"); sqlCommandText.Append(", EnKeywords=@EnKeywords"); sqlCommandText.Append(", CLC=@CLC"); sqlCommandText.Append(", DOI=@DOI"); sqlCommandText.Append(", isRegDoi=@isRegDoi"); sqlCommandText.Append(", Abstract=@Abstract"); sqlCommandText.Append(", EnAbstract=@EnAbstract"); sqlCommandText.Append(", Reference=@Reference"); sqlCommandText.Append(", Funds=@Funds"); sqlCommandText.Append(", AuthorIntro=@AuthorIntro"); sqlCommandText.Append(", StartPageNum=@StartPageNum"); sqlCommandText.Append(", EndPageNum=@EndPageNum"); sqlCommandText.Append(", FilePath=@FilePath"); sqlCommandText.Append(", FileKey=@FileKey"); sqlCommandText.Append(", FileSize=@FileSize"); sqlCommandText.Append(", FileExt=@FileExt"); sqlCommandText.Append(", HtmlPath=@HtmlPath"); sqlCommandText.Append(", HtmlSize=@HtmlSize"); //sqlCommandText.Append(", Hits=@Hits"); //sqlCommandText.Append(", Downloads=@Downloads"); sqlCommandText.Append(", ViewMoney=@ViewMoney"); sqlCommandText.Append(", IsHot=@IsHot"); sqlCommandText.Append(", IsCommend=@IsCommend"); sqlCommandText.Append(", IsTop=@IsTop"); sqlCommandText.Append(", SortID=@SortID"); sqlCommandText.Append(", EditUser=@EditUser"); sqlCommandText.Append(", EditDate=getdate()"); DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.IssueContent SET {0} WHERE {1}", sqlCommandText.ToString(), whereCommandText.ToString())); db.AddInParameter(cmd, "@ContentID", DbType.Int64, issueContentEntity.ContentID); db.AddInParameter(cmd, "@Year", DbType.Int32, issueContentEntity.Year); db.AddInParameter(cmd, "@Volume", DbType.Int32, issueContentEntity.Volume); db.AddInParameter(cmd, "@Issue", DbType.Int32, issueContentEntity.Issue); db.AddInParameter(cmd, "@JChannelID", DbType.Int64, issueContentEntity.JChannelID); db.AddInParameter(cmd, "@Title", DbType.AnsiString, issueContentEntity.Title); db.AddInParameter(cmd, "@EnTitle", DbType.AnsiString, issueContentEntity.EnTitle); db.AddInParameter(cmd, "@Authors", DbType.AnsiString, issueContentEntity.Authors); db.AddInParameter(cmd, "@EnAuthors", DbType.AnsiString, issueContentEntity.EnAuthors); db.AddInParameter(cmd, "@WorkUnit", DbType.AnsiString, issueContentEntity.WorkUnit); db.AddInParameter(cmd, "@EnWorkUnit", DbType.AnsiString, issueContentEntity.EnWorkUnit); db.AddInParameter(cmd, "@Keywords", DbType.AnsiString, issueContentEntity.Keywords); db.AddInParameter(cmd, "@EnKeywords", DbType.AnsiString, issueContentEntity.EnKeywords); db.AddInParameter(cmd, "@CLC", DbType.AnsiString, issueContentEntity.CLC); db.AddInParameter(cmd, "@DOI", DbType.AnsiString, issueContentEntity.DOI); db.AddInParameter(cmd, "@isRegDoi", DbType.Boolean, issueContentEntity.isRegDoi); db.AddInParameter(cmd, "@Abstract", DbType.AnsiString, issueContentEntity.Abstract); db.AddInParameter(cmd, "@EnAbstract", DbType.AnsiString, issueContentEntity.EnAbstract); db.AddInParameter(cmd, "@Reference", DbType.AnsiString, issueContentEntity.Reference); db.AddInParameter(cmd, "@Funds", DbType.AnsiString, issueContentEntity.Funds); db.AddInParameter(cmd, "@AuthorIntro", DbType.AnsiString, issueContentEntity.AuthorIntro); db.AddInParameter(cmd, "@StartPageNum", DbType.Int32, issueContentEntity.StartPageNum); db.AddInParameter(cmd, "@EndPageNum", DbType.Int32, issueContentEntity.EndPageNum); db.AddInParameter(cmd, "@FilePath", DbType.AnsiString, issueContentEntity.FilePath); db.AddInParameter(cmd, "@FileKey", DbType.AnsiString, issueContentEntity.FileKey); db.AddInParameter(cmd, "@FileSize", DbType.Decimal, issueContentEntity.FileSize); db.AddInParameter(cmd, "@FileExt", DbType.AnsiString, issueContentEntity.FileExt); db.AddInParameter(cmd, "@HtmlPath", DbType.AnsiString, issueContentEntity.HtmlPath); db.AddInParameter(cmd, "@HtmlSize", DbType.Decimal, issueContentEntity.HtmlSize); //db.AddInParameter(cmd, "@Hits", DbType.Int32, issueContentEntity.Hits); //db.AddInParameter(cmd, "@Downloads", DbType.Int32, issueContentEntity.Downloads); db.AddInParameter(cmd, "@ViewMoney", DbType.Decimal, issueContentEntity.ViewMoney); db.AddInParameter(cmd, "@IsHot", DbType.Boolean, issueContentEntity.IsHot); db.AddInParameter(cmd, "@IsCommend", DbType.Boolean, issueContentEntity.IsCommend); db.AddInParameter(cmd, "@IsTop", DbType.Boolean, issueContentEntity.IsTop); db.AddInParameter(cmd, "@SortID", DbType.Int32, issueContentEntity.SortID); db.AddInParameter(cmd, "@EditUser", DbType.Int64, issueContentEntity.EditUser); db.AddInParameter(cmd, "@EditDate", DbType.DateTime, issueContentEntity.EditDate); 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; } }
/// <summary> /// 新增期刊内容 /// </summary> /// <param name="issueContentEntity"></param> /// <returns></returns> private Int64 AddIssueContent(IssueContentEntity issueContentEntity, DbTransaction trans = null) { StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @JournalID"); sqlCommandText.Append(", @CID"); sqlCommandText.Append(", @AuthorID"); sqlCommandText.Append(", @Year"); sqlCommandText.Append(", @Volume"); sqlCommandText.Append(", @Issue"); sqlCommandText.Append(", @JChannelID"); sqlCommandText.Append(", @Title"); sqlCommandText.Append(", @EnTitle"); sqlCommandText.Append(", @Authors"); sqlCommandText.Append(", @EnAuthors"); sqlCommandText.Append(", @WorkUnit"); sqlCommandText.Append(", @EnWorkUnit"); sqlCommandText.Append(", @Keywords"); sqlCommandText.Append(", @EnKeywords"); sqlCommandText.Append(", @CLC"); sqlCommandText.Append(", @DOI"); sqlCommandText.Append(", @Abstract"); sqlCommandText.Append(", @EnAbstract"); sqlCommandText.Append(", @Reference"); sqlCommandText.Append(", @Funds"); sqlCommandText.Append(", @AuthorIntro"); sqlCommandText.Append(", @StartPageNum"); sqlCommandText.Append(", @EndPageNum"); sqlCommandText.Append(", @FilePath"); sqlCommandText.Append(", @FileKey"); sqlCommandText.Append(", @FileSize"); sqlCommandText.Append(", @FileExt"); sqlCommandText.Append(", @HtmlPath"); sqlCommandText.Append(", @HtmlSize"); sqlCommandText.Append(", @HtmlHits"); sqlCommandText.Append(", @Hits"); sqlCommandText.Append(", @Downloads"); sqlCommandText.Append(", @ViewMoney"); sqlCommandText.Append(", @IsHot"); sqlCommandText.Append(", @IsCommend"); sqlCommandText.Append(", @IsTop"); sqlCommandText.Append(", @SortID"); sqlCommandText.Append(", @InUser"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.IssueContent ({0},EditDate,AddDate) VALUES ({1},getdate(),getdate());select SCOPE_IDENTITY();", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd, "@JournalID", DbType.Int64, issueContentEntity.JournalID); db.AddInParameter(cmd, "@CID", DbType.Int64, issueContentEntity.CID); db.AddInParameter(cmd, "@AuthorID", DbType.Int64, issueContentEntity.AuthorID); db.AddInParameter(cmd, "@Year", DbType.Int32, issueContentEntity.Year); db.AddInParameter(cmd, "@Volume", DbType.Int32, issueContentEntity.Volume); db.AddInParameter(cmd, "@Issue", DbType.Int32, issueContentEntity.Issue); db.AddInParameter(cmd, "@JChannelID", DbType.Int64, issueContentEntity.JChannelID); db.AddInParameter(cmd, "@Title", DbType.AnsiString, issueContentEntity.Title); db.AddInParameter(cmd, "@EnTitle", DbType.AnsiString, issueContentEntity.EnTitle); db.AddInParameter(cmd, "@Authors", DbType.AnsiString, issueContentEntity.Authors); db.AddInParameter(cmd, "@EnAuthors", DbType.AnsiString, issueContentEntity.EnAuthors); db.AddInParameter(cmd, "@WorkUnit", DbType.AnsiString, issueContentEntity.WorkUnit); db.AddInParameter(cmd, "@EnWorkUnit", DbType.AnsiString, issueContentEntity.EnWorkUnit); db.AddInParameter(cmd, "@Keywords", DbType.AnsiString, issueContentEntity.Keywords); db.AddInParameter(cmd, "@EnKeywords", DbType.AnsiString, issueContentEntity.EnKeywords); db.AddInParameter(cmd, "@CLC", DbType.AnsiString, issueContentEntity.CLC); db.AddInParameter(cmd, "@DOI", DbType.AnsiString, issueContentEntity.DOI); db.AddInParameter(cmd, "@Abstract", DbType.AnsiString, issueContentEntity.Abstract); db.AddInParameter(cmd, "@EnAbstract", DbType.AnsiString, issueContentEntity.EnAbstract); db.AddInParameter(cmd, "@Reference", DbType.AnsiString, issueContentEntity.Reference); db.AddInParameter(cmd, "@Funds", DbType.AnsiString, issueContentEntity.Funds); db.AddInParameter(cmd, "@AuthorIntro", DbType.AnsiString, issueContentEntity.AuthorIntro); db.AddInParameter(cmd, "@StartPageNum", DbType.Int32, issueContentEntity.StartPageNum); db.AddInParameter(cmd, "@EndPageNum", DbType.Int32, issueContentEntity.EndPageNum); db.AddInParameter(cmd, "@FilePath", DbType.AnsiString, issueContentEntity.FilePath); db.AddInParameter(cmd, "@FileKey", DbType.AnsiString, issueContentEntity.FileKey); db.AddInParameter(cmd, "@FileSize", DbType.Decimal, issueContentEntity.FileSize); db.AddInParameter(cmd, "@FileExt", DbType.AnsiString, issueContentEntity.FileExt); db.AddInParameter(cmd, "@HtmlPath", DbType.AnsiString, issueContentEntity.HtmlPath); db.AddInParameter(cmd, "@HtmlSize", DbType.Decimal, issueContentEntity.HtmlSize); db.AddInParameter(cmd, "@HtmlHits", DbType.Decimal, issueContentEntity.HtmlHits); db.AddInParameter(cmd, "@Hits", DbType.Int32, issueContentEntity.Hits); db.AddInParameter(cmd, "@Downloads", DbType.Int32, issueContentEntity.Downloads); db.AddInParameter(cmd, "@ViewMoney", DbType.Decimal, issueContentEntity.ViewMoney); db.AddInParameter(cmd, "@IsHot", DbType.Boolean, issueContentEntity.IsHot); db.AddInParameter(cmd, "@IsCommend", DbType.Boolean, issueContentEntity.IsCommend); db.AddInParameter(cmd, "@IsTop", DbType.Boolean, issueContentEntity.IsTop); db.AddInParameter(cmd, "@SortID", DbType.Int32, issueContentEntity.SortID); db.AddInParameter(cmd, "@InUser", DbType.Int64, issueContentEntity.InUser); try { object obj = null; if (trans == null) obj = db.ExecuteScalar(cmd); else obj = db.ExecuteScalar(cmd, trans); if (obj == null) return 0; Int64 id = 0; Int64.TryParse(obj.ToString(), out id); if (id == 0) throw new Exception("新增期刊信息失败!"); return id; } catch (Exception ex) { throw ex; } }
/// <summary> /// 组装期刊信息数据 /// </summary> /// <param name="dr"></param> /// <returns></returns> private IssueContentEntity MakeIssueContent(IDataReader dr) { IssueContentEntity model = new IssueContentEntity(); model.ContentID = (Int64)dr["ContentID"]; model.JournalID = (Int64)dr["JournalID"]; if (dr.HasColumn("CID")) { model.CID = TypeParse.ToLong(dr["CID"]); } if (dr.HasColumn("AuthorID")) { model.AuthorID = TypeParse.ToLong(dr["AuthorID"]); } model.Year = (Int32)dr["Year"]; model.Volume = (Int32)dr["Volume"]; model.Issue = (Int32)dr["Issue"]; model.ChannelName = dr["ChannelName"]==System.DBNull.Value?"":(String)dr["ChannelName"]; model.JChannelID = (Int64)dr["JChannelID"]; model.Title = (String)dr["Title"]; model.EnTitle = (String)dr["EnTitle"]; model.Authors = (String)dr["Authors"]; model.EnAuthors = (String)dr["EnAuthors"]; model.WorkUnit = (String)dr["WorkUnit"]; model.EnWorkUnit = (String)dr["EnWorkUnit"]; model.Keywords = (String)dr["Keywords"]; model.EnKeywords = (String)dr["EnKeywords"]; model.CLC = dr["CLC"] == System.DBNull.Value ? "" : (String)dr["CLC"]; model.DOI = dr["DOI"] == System.DBNull.Value ? "" : (String)dr["DOI"]; model.isRegDoi = (Boolean)dr["isRegDoi"]; model.Abstract = dr["Abstract"]== System.DBNull.Value?"":(String)dr["Abstract"]; model.EnAbstract = (String)dr["EnAbstract"]; model.Reference = (String)dr["Reference"]; model.Funds = (String)dr["Funds"]; model.AuthorIntro = (String)dr["AuthorIntro"]; model.StartPageNum = (Int32)dr["StartPageNum"]; model.EndPageNum = (Int32)dr["EndPageNum"]; model.FilePath = dr["FilePath"]==System.DBNull.Value?"": (String)dr["FilePath"]; model.FileKey = dr["FileKey"]==System.DBNull.Value?"":(String)dr["FileKey"]; model.FileSize = (Decimal)dr["FileSize"]; model.FileExt = dr["FileExt"]==System.DBNull.Value?"":(String)dr["FileExt"]; model.HtmlPath = dr["HtmlPath"]==System.DBNull.Value?"":(String)dr["HtmlPath"]; model.HtmlSize = (Decimal)dr["HtmlSize"]; model.HtmlHits = (Int32)dr["HtmlHits"]; model.Hits = (Int32)dr["Hits"]; model.Downloads = (Int32)dr["Downloads"]; model.ViewMoney = (Decimal)dr["ViewMoney"]; model.IsHot = (Boolean)dr["IsHot"]; model.IsCommend = (Boolean)dr["IsCommend"]; model.IsTop = (Boolean)dr["IsTop"]; model.SortID = (Int32)dr["SortID"]; model.InUser = (Int64)dr["InUser"]; model.EditUser = (Int64)dr["EditUser"]; model.EditDate = (DateTime)dr["EditDate"]; model.AddDate = (DateTime)dr["AddDate"]; return model; }
/// <summary> /// 保存期刊信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public Int64 SaveIssueContent(IssueContentEntity model) { using (DbConnection conn = db.CreateConnection()) { if (conn.State != ConnectionState.Open) conn.Open(); DbTransaction trans = conn.BeginTransaction(); try { if (model.ContentID == 0) { Int64 ContentID = AddIssueContent(model, trans); if (ContentID == 0) throw new Exception(); model.ContentID = ContentID; //参考文献 if (model.ReferenceList != null && model.ReferenceList.Count > 0) { foreach (var item in model.ReferenceList) { item.ContentID = model.ContentID; item.JournalID = model.JournalID; AddIssueReference(item, trans); } } } else { UpdateIssueContent(model, trans); Int64[] ContentID = new Int64[] { model.ContentID }; //参考文献 Int64[] ReferenceIDs = null; if (model.ReferenceList != null && model.ReferenceList.Count > 0) { ReferenceIDs = model.ReferenceList.Where(p => p.ReferenceID > 0).Select(p => p.ReferenceID).ToArray(); } DelIssueReferenceByContentID(ContentID, trans, ReferenceIDs); if (model.ReferenceList != null && model.ReferenceList.Count > 0) { foreach (var item in model.ReferenceList) { if (item.ReferenceID > 0) { UpdateIssueReference(item, trans); } else { item.JournalID = model.JournalID; item.ContentID = model.ContentID; AddIssueReference(item, trans); } } } } trans.Commit(); conn.Close(); return model.ContentID; } catch (Exception ex) { trans.Rollback(); throw ex; } } }
/// <summary> /// 编辑期刊表信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateIssueContent(IssueContentEntity model) { return UpdateIssueContent(model, null); }
/// <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 } return View(contentEntity); }
/// <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 AddIssueContent(IssueContentEntity model) { return IssueDataAccess.Instance.AddIssueContent(model); }
/// <summary> /// 保存期刊信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public Int64 SaveIssueContent(IssueContentEntity model) { return IssueDataAccess.Instance.SaveIssueContent(model); }
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 }); }
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; }
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 }); }
/// <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="model"></param> /// <returns></returns> public bool UpdateIssueContent(IssueContentEntity model) { return IssueBusProvider.UpdateIssueContent(model); }
/// <summary> /// 确定录用稿件列表 TODO:没有用到,备用 /// 确定年卷期使用 /// </summary> /// <param name="query"></param> /// <returns></returns> public Pager<IssueContentEntity> GetContributionIssuePageList(IssueContentQuery query) { int recordCount = 0; List<SqlParameter> listParameters = new List<SqlParameter>(); StringBuilder sbSQL = new StringBuilder("SELECT i.ContentID,c.Title,c.CID,c.JournalID,c.CNumber,c.SubjectCat,c.AuthorID,c.AddDate,i.Issue,i.Year,i.Volume FROM dbo.ContributionInfo c WITH(NOLOCK) LEFT JOIN dbo.IssueContent i WITH(NOLOCK) ON c.JournalID=i.JournalID AND c.CID=i.CID WHERE c.JournalID=@JournalID AND c.Status=200"); SqlParameter pJournalID = new SqlParameter("@JournalID", SqlDbType.BigInt); pJournalID.Value = query.JournalID; listParameters.Add(pJournalID); if (query.AuthorID != null && query.AuthorID > 0) { SqlParameter pAuthorID = new SqlParameter("@AuthorID", SqlDbType.BigInt); pAuthorID.Value = query.AuthorID.Value; listParameters.Add(pAuthorID); sbSQL.Append(" AND i.AuthorID=@AuthorID"); } if (!string.IsNullOrEmpty(query.CNumber)) { SqlParameter pCNumber = new SqlParameter("@CNumber", SqlDbType.VarChar, 50); pCNumber.Value = SecurityUtils.SafeSqlString(query.CNumber); listParameters.Add(pCNumber); sbSQL.Append(" AND c.CNumber=@CNumber"); } if (query.JChannelID != null && query.JChannelID > 0) { SqlParameter pSubjectCat = new SqlParameter("@JChannelID", SqlDbType.BigInt); pSubjectCat.Value = query.JChannelID.Value; listParameters.Add(pSubjectCat); sbSQL.Append(" AND i.JChannelID=@JChannelID"); } if (!string.IsNullOrEmpty(query.Title)) { sbSQL.Append(" AND c.Title LIKE '%" + SecurityUtils.SafeSqlString(query.Title) + "%'"); } if (query.Year != null && query.Year > 0) { SqlParameter pYear = new SqlParameter("@Year", SqlDbType.Int); pYear.Value = query.Year.Value; listParameters.Add(pYear); sbSQL.Append(" AND i.Year=@Year"); } if (query.Issue != null && query.Issue > 0) { SqlParameter pIssue = new SqlParameter("@Issue", SqlDbType.Int); pIssue.Value = query.Issue.Value; listParameters.Add(pIssue); sbSQL.Append(" AND i.Issue=@Issue"); } DataSet ds = db.PageingQuery(query.CurrentPage, query.PageSize, sbSQL.ToString(), "c.AddDate DESC", listParameters.ToArray(), ref recordCount); Pager<IssueContentEntity> pager = new Pager<IssueContentEntity>(); if (ds != null && ds.Tables.Count > 0) { List<IssueContentEntity> list = new List<IssueContentEntity>(); if (ds != null) { IssueContentEntity cEntity = null; foreach (DataRow row in ds.Tables[0].Rows) { cEntity = new IssueContentEntity(); cEntity.ContentID = row.IsNull("ContentID") ? 0 : (Int64)row["ContentID"]; cEntity.CID = row.IsNull("CID") ? 0 : (Int64)row["CID"]; cEntity.JournalID = (Int64)row["JournalID"]; cEntity.CNumber = row["CNumber"].ToString(); cEntity.Title = row["Title"].ToString(); cEntity.AuthorID = (Int64)row["AuthorID"]; cEntity.Year = row.IsNull("Year") ? 0 : TypeParse.ToInt(row["Year"]); cEntity.Volume = row.IsNull("Volume") ? 0 : TypeParse.ToInt(row["Volume"]); cEntity.Issue = row.IsNull("Issue") ? 0 : TypeParse.ToInt(row["Issue"]); cEntity.AddDate = Convert.ToDateTime(row["AddDate"]); list.Add(cEntity); } } pager.ItemList = list; } pager.CurrentPage = query.CurrentPage; pager.PageSize = query.PageSize; pager.TotalRecords = recordCount; return pager; }
/// <summary> /// 编辑期刊表信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateIssueContent(IssueContentEntity model) { return IssueDataAccess.Instance.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 bool AddIssueContent(IssueContentEntity model) { return AddIssueContent(model, null) > 0; }
public ActionResult ShowDownloads(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); } return View(contentEntity); }
/// <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; }