/// <summary> /// 组装期刊栏目数据 /// </summary> /// <param name="dr"></param> /// <returns></returns> private JournalChannelEntity MakeJournalChannel(IDataReader dr) { JournalChannelEntity journalChannelEntity = new JournalChannelEntity(); journalChannelEntity.JChannelID = (Int64)dr["JChannelID"]; journalChannelEntity.JournalID = (Int64)dr["JournalID"]; journalChannelEntity.PChannelID = (Int64)dr["PChannelID"]; journalChannelEntity.ChannelName = (String)dr["ChannelName"]; journalChannelEntity.SortID = (Int32)dr["SortID"]; journalChannelEntity.Status = (Byte)dr["Status"]; journalChannelEntity.AddDate = (DateTime)dr["AddDate"]; return journalChannelEntity; }
public ExecResult SaveJournalChannel(JournalChannelEntity model) { IIssueService service = ServiceContainer.Instance.Container.Resolve<IIssueService>(); return service.SaveJournalChannel(model); }
/// <summary> /// 编辑期刊栏目 /// </summary> /// <param name="journalChannelEntity"></param> /// <returns></returns> public bool UpdateJournalChannel(JournalChannelEntity journalChannelEntity) { bool flag = false; StringBuilder whereCommandText = new StringBuilder(); whereCommandText.Append(" JChannelID=@JChannelID"); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" ChannelName=@ChannelName"); sqlCommandText.Append(", SortID=@SortID"); sqlCommandText.Append(", Status=@Status"); DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.JournalChannel SET {0} WHERE {1}", sqlCommandText.ToString(), whereCommandText.ToString())); db.AddInParameter(cmd, "@JChannelID", DbType.Int64, journalChannelEntity.JChannelID); db.AddInParameter(cmd, "@ChannelName", DbType.AnsiString, journalChannelEntity.ChannelName); db.AddInParameter(cmd, "@SortID", DbType.Int32, journalChannelEntity.SortID); db.AddInParameter(cmd, "@Status", DbType.Byte, journalChannelEntity.Status); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
/// <summary> /// 新增期刊栏目 /// </summary> /// <param name="journalChannelEntity"></param> /// <returns></returns> public bool AddJournalChannel(JournalChannelEntity journalChannelEntity) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @JournalID"); sqlCommandText.Append(", @PChannelID"); sqlCommandText.Append(", @ChannelName"); sqlCommandText.Append(", @SortID"); sqlCommandText.Append(", @Status"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.JournalChannel ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd, "@JournalID", DbType.Int64, journalChannelEntity.JournalID); db.AddInParameter(cmd, "@PChannelID", DbType.Int64, journalChannelEntity.PChannelID); db.AddInParameter(cmd, "@ChannelName", DbType.AnsiString, journalChannelEntity.ChannelName); db.AddInParameter(cmd, "@SortID", DbType.Int32, journalChannelEntity.SortID); db.AddInParameter(cmd, "@Status", DbType.Byte, journalChannelEntity.Status); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
private JournalChannelEntity GetJournalChannelModel(Int64 JChannelID) { JournalChannelEntity model = null; if (JChannelID > 0) { JournalChannelQuery query = new JournalChannelQuery(); query.JournalID = CurAuthor.JournalID; query.JChannelID = JChannelID; IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>(); model = service.GetJournalChannelModel(query); } if (model == null) model = new JournalChannelEntity(); return model; }
/// <summary> /// 新增期刊栏目 /// </summary> /// <param name="journalChannelEntity"></param> /// <returns></returns> public bool AddJournalChannel(JournalChannelEntity journalChannelEntity) { return IssueDataAccess.Instance.AddJournalChannel(journalChannelEntity); }
public ActionResult SaveJournalChannel(JournalChannelEntity model) { IIssueFacadeService service = ServiceContainer.Instance.Container.Resolve<IIssueFacadeService>(); model.JournalID = CurAuthor.JournalID; ExecResult result = service.SaveJournalChannel(model); return Json(new { result = result.result, msg = result.msg }); }
/// <summary> /// 保存期刊栏目 /// </summary> /// <param name="query"></param> /// <returns></returns> public ExecResult SaveJournalChannel(JournalChannelEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, JournalChannelEntity>(GetAPIUrl(APIConstant.JOURNALCHANNEL_SAVE), model); return result; }
/// <summary> /// 编辑期刊栏目 /// </summary> /// <param name="journalChannelEntity"></param> /// <returns></returns> public bool UpdateJournalChannel(JournalChannelEntity journalChannelEntity) { return IssueBusProvider.UpdateJournalChannel(journalChannelEntity); }
/// <summary> /// 保存期刊栏目 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveJournalChannel(JournalChannelEntity model) { ExecResult execResult = new ExecResult(); bool result = false; model.ChannelName = model.ChannelName.TextFilter(); if (model.JChannelID == 0) result = AddJournalChannel(model); else result = UpdateJournalChannel(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "保存期刊栏目成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "保存期刊栏目失败!"; } return execResult; }
/// <summary> /// 新增期刊栏目 /// </summary> /// <param name="journalChannelEntity"></param> /// <returns></returns> public bool AddJournalChannel(JournalChannelEntity journalChannelEntity) { return IssueBusProvider.AddJournalChannel(journalChannelEntity); }