/// <summary> /// 新增审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddReviewBill(ReviewBillEntity model) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @JournalID"); sqlCommandText.Append(", @Title"); sqlCommandText.Append(", @ItemType"); sqlCommandText.Append(", @PItemID"); sqlCommandText.Append(", @SortID"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.ReviewBill ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID); db.AddInParameter(cmd, "@Title", DbType.AnsiString, model.Title.TextFilter()); db.AddInParameter(cmd, "@ItemType", DbType.Byte, model.ItemType); db.AddInParameter(cmd, "@PItemID", DbType.Int64, model.PItemID); db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
/// <summary> /// 编辑审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateReviewBill(ReviewBillEntity model) { return ReviewBillDataAccess.Instance.UpdateReviewBill(model); }
/// <summary> /// 新增审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddReviewBill(ReviewBillEntity model) { return ReviewBillDataAccess.Instance.AddReviewBill(model); }
/// <summary> /// 新增审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddReviewBill(ReviewBillEntity model) { return ReviewBillBusProvider.AddReviewBill(model); }
/// <summary> /// 编辑审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateReviewBill(ReviewBillEntity model) { return ReviewBillBusProvider.UpdateReviewBill(model); }
/// <summary> /// 保存审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveReviewBill(ReviewBillEntity model) { ExecResult execResult = new ExecResult(); bool result = false; if (model.ItemID == 0) result = AddReviewBill(model); else { if (ReviewBillIsEnabled(model.JournalID, model.ItemID)) { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "该审稿单项已经被使用,不允许编辑!"; return execResult; } result = UpdateReviewBill(model); } if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "保存审稿单项成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "保存审稿单项失败!"; } return execResult; }
public ActionResult SaveReviewBill(ReviewBillEntity model) { IFlowFacadeService service = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>(); model.JournalID = CurAuthor.JournalID; ExecResult result = service.SaveReviewBill(model); return Json(new { result = result.result, msg = result.msg }); }
private ReviewBillEntity GetReviewBillModel(Int64 ItemID) { ReviewBillEntity model = null; if (ItemID > 0) { ReviewBillQuery query = new ReviewBillQuery(); query.JournalID = CurAuthor.JournalID; query.ItemID = ItemID; IFlowFacadeService service = ServiceContainer.Instance.Container.Resolve<IFlowFacadeService>(); model = service.GetReviewBillModel(query); } if (model == null) model = new ReviewBillEntity(); return model; }
/// <summary> /// 组装数据 /// </summary> /// <param name="dr"></param> /// <returns></returns> private ReviewBillEntity MakeReviewBill(IDataReader dr) { ReviewBillEntity reviewBillEntity = new ReviewBillEntity(); reviewBillEntity.ItemID = (Int64)dr["ItemID"]; reviewBillEntity.JournalID = (Int64)dr["JournalID"]; reviewBillEntity.Title = (String)dr["Title"]; reviewBillEntity.ItemType = (Byte)dr["ItemType"]; reviewBillEntity.PItemID = (Int64)dr["PItemID"]; reviewBillEntity.SortID = (Int32)dr["SortID"]; reviewBillEntity.AddDate = (DateTime)dr["AddDate"]; return reviewBillEntity; }
/// <summary> /// 编辑审稿单项 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateReviewBill(ReviewBillEntity model) { bool flag = false; StringBuilder whereCommandText = new StringBuilder(); whereCommandText.Append(" ItemID=@ItemID"); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" Title=@Title"); sqlCommandText.Append(", ItemType=@ItemType"); sqlCommandText.Append(", SortID=@SortID"); DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.ReviewBill SET {0} WHERE {1}", sqlCommandText.ToString(), whereCommandText.ToString())); db.AddInParameter(cmd, "@ItemID", DbType.Int64, model.ItemID); db.AddInParameter(cmd, "@Title", DbType.AnsiString, model.Title.TextFilter()); db.AddInParameter(cmd, "@ItemType", DbType.Byte, model.ItemType); db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
public ExecResult SaveReviewBill(ReviewBillEntity model) { IReviewBillService service = ServiceContainer.Instance.Container.Resolve<IReviewBillService>(); return service.SaveReviewBill(model); }